add resetmenu

Short script to combine "delmenu" and "newmenu" as used in menuinit
scripts.
This commit is contained in:
ac-stef
2016-02-07 18:34:32 +01:00
parent 7f86ae8d9f
commit 665c359907
3 changed files with 17 additions and 28 deletions
+11 -23
View File
@@ -112,8 +112,7 @@ menuitem "Fix heightfielding" [ solid 0; slope 0 0 ]
newmenu skymaps
menuinit [
delmenu skymaps
newmenu skymaps
resetmenu
if (&& $editing (! (getautomapconfig))) [
menuitem [Enable automapconfig to make changes permanent] [automapconfig ; closemenu (curmenu)] (concat loadsky (escape $loadsky))
menuitem "" -1 (concat loadsky (escape $loadsky))
@@ -189,8 +188,7 @@ menuinit __rebuildmapmodelmenus
// Edit mapmodel slot
newmenu [Edit mapmodel slot]
menuinit [
delmenu [Edit mapmodel slot]
newmenu [Edit mapmodel slot]
resetmenu
if (strlen $__mmslot) [
push info (editmapmodelslot $__mmslot)
menuheader "" (concatword "edit mapmodel slot #" $__mmslot ":\n" (mapmodelslotname $__mmslot))
@@ -232,8 +230,7 @@ tempalias __texslot ""
// Edit texture slots
newmenu [Edit texture slots]
menuinit [
delmenu (curmenu)
newmenu (curmenu)
resetmenu
menurenderoffset -20 0
if $editing [
push ecurmenu (escape (curmenu))
@@ -256,8 +253,7 @@ menuinit [
// Edit texture slot
newmenu [Edit texture slot]
menuinit [
delmenu (curmenu)
newmenu (curmenu)
resetmenu
if (strlen $__texslot) [
push info (edittextureslot $__texslot) // "<scale> <path>"
chmenutexture (curmenu) (at $info 1)
@@ -305,8 +301,7 @@ tempalias __tex_togo ""
newmenu "Texture slot merge"
menuinit [
delmenu (curmenu)
newmenu (curmenu)
resetmenu
if (strlen $__texslot) [
push info (edittextureslot $__texslot) // "<scale> <path>"
chmenutexture (curmenu) (at $info 1)
@@ -348,8 +343,7 @@ menuinit __rebuildtexturemenus
newmenu "Pick texture"
menuinit [
delmenu (curmenu)
newmenu (curmenu)
resetmenu
if (strlen $__lastwatchedtexture) [
chmenutexture (curmenu) $__lastwatchedtexture
push usedslots (textureslotbyname $__lastwatchedtexture)
@@ -395,8 +389,7 @@ tempalias __sndslot ""
newmenu "Pick mapsound"
menuinit [
delmenu (curmenu)
newmenu (curmenu)
resetmenu
if (strlen $__lastwatchedmapsound) [
push usedslots (mapsoundslotbyname $__lastwatchedmapsound)
menuitem (concat "Mapsound:" $__lastwatchedmapsound) -1
@@ -424,8 +417,7 @@ menuinit [
// Edit mapsound slots
newmenu [Edit mapsound slots]
menuinit [
delmenu (curmenu)
newmenu (curmenu)
resetmenu
if $editing [
push info ""
loop i 256 [
@@ -446,8 +438,7 @@ tempalias __snd_vol "255"
newmenu [Edit mapsound slot]
menuinit [
delmenu (curmenu)
newmenu (curmenu)
resetmenu
if (strlen $__sndslot) [
push info (editmapsoundslot $__sndslot) // "<path> <maxuses>"
menuheader "" (concatword "edit mapsound slot #" $__sndslot ":\n" (at $info 0))
@@ -509,11 +500,8 @@ menuitemtextinput "Make a map backup (.BAK) every: " "$numAutoSaveBackups" [ num
// deleted entities
newmenu "deleted entities"
menuinit __rebuilddeletedentitymenu
tempalias __rebuilddeletedentitymenu [
delmenu "deleted entities"
newmenu "deleted entities"
menuinit [
resetmenu
if (unlistdeletedentity) [
push i 0
looplist (getdeletedentities) [type x y z a1 a2 a3 a4 a5 a6 a7] [
+5 -5
View File
@@ -706,7 +706,7 @@ tempalias __pckserv ""
newmenu "Autodownload config"
menuinit [
delmenu (curmenu) ; newmenu (curmenu)
resetmenu
push serverlist (getpckserver)
push words (listlen $serverlist)
if (! $words) [
@@ -734,7 +734,7 @@ menuinit [
newmenu "Configure package server"
menuinit [
delmenu (curmenu) ; newmenu (curmenu)
resetmenu
if (!= (listlen $__pcksrv) 4) [
menuitem "----- no server selected ------" -1
] [
@@ -760,7 +760,7 @@ tempalias __zip ""
newmenu "Mod package"
menuinit [
delmenu (curmenu) ; newmenu (curmenu)
resetmenu
menurenderoffset -20 0
push ecurmenu (escape (curmenu))
push activezips (zipmodlist active)
@@ -787,7 +787,7 @@ menuinit [
newmenu "Configure mod package"
menuinit [
delmenu (curmenu) ; newmenu (curmenu)
resetmenu
menurenderoffset -20 0
push ecurmenu (escape (curmenu))
push activezips (zipmodlist active)
@@ -813,7 +813,7 @@ menuinit [
newmenu "Show files in package"
menuinit [
delmenu (curmenu) ; newmenu (curmenu)
resetmenu
if (strlen $__zip) [
menuitem (concat "Files in package\f9" $__zip) -1
menuitem "" -1
+1
View File
@@ -64,6 +64,7 @@ const editmapmsg [ editsvar mapmsg ]
const return [ result $arg1 ]
const run [ exec (concatword config/ $arg1 .cfg) ]
const closecurmenu [ closemenu (curmenu) ]
const resetmenu [ delmenu (curmenu) ; newmenu (curmenu) ]
// Auto-completions
const mapcomplete [complete $arg1 "packages/maps/official packages/maps" cgz]