From e1572dcdee1c7fb551579f90a314e6bb1c5067ac Mon Sep 17 00:00:00 2001 From: ac-stef Date: Wed, 14 Jun 2017 19:01:15 +0200 Subject: [PATCH] move ++, --, ++f and --f to compatibility.cfg useless, because of the "failing silently" behaviour DOCREF ++ -- ++f --f --- config/menus_bot.cfg | 6 +++--- config/opt/autosave.cfg | 2 +- config/opt/compatibility.cfg | 6 ++++++ config/opt/mapeditscripts.cfg | 2 +- config/opt/survival.cfg | 4 ++-- config/scripts.cfg | 6 +----- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/config/menus_bot.cfg b/config/menus_bot.cfg index a009c3cf..17a39867 100644 --- a/config/menus_bot.cfg +++ b/config/menus_bot.cfg @@ -20,10 +20,10 @@ const startbotmatch [ if ($tmp_isbotteammode) [ // team botmode tempalias numrvsf (div $tmp_numbots 2) tempalias numcla (div $tmp_numbots 2) - if (= (player1 team) 0) [ -- numcla ] [ - if (= (player1 team) 1) [ -- numrvsf ] + if (= (player1 team) 0) [ -= numcla 1 ] [ + if (= (player1 team) 1) [ -= numrvsf 1 ] ] - if (&& (= $numrvsf $numcla) $needsswitch) [ -- numrvsf ] + if (&& (= $numrvsf $numcla) $needsswitch) [ -= numrvsf 1 ] addnbot $numrvsf RVSF $tmp_botskill addnbot $numcla CLA $tmp_botskill ] [ // bot FFA diff --git a/config/opt/autosave.cfg b/config/opt/autosave.cfg index abe41a40..8c677dc8 100644 --- a/config/opt/autosave.cfg +++ b/config/opt/autosave.cfg @@ -13,7 +13,7 @@ tempalias numAutoSaves 0 const autoSaveCheck [ if $autosavemap [ sleep $timeBetAutoSaves doAutoSave ] ] const execAutoSave [ - ++ numAutoSaves + += numAutoSaves 1 push oldmapbackups $mapbackupsonsave if (|| (!= $numAutoSaveBackups $numAutoSaves) (= $numAutoSaveBackups 0)) [ mapbackupsonsave 0 ] [ numAutoSaves = 0 ] // Temporarily turn off map backups to avoid clutter. savemap (curmap) diff --git a/config/opt/compatibility.cfg b/config/opt/compatibility.cfg index 16686287..d97593f9 100644 --- a/config/opt/compatibility.cfg +++ b/config/opt/compatibility.cfg @@ -101,3 +101,9 @@ const seteditshow [ ] pop n ] + +// commands to increment/decrement an alias - or to fail silently, if the alias doesn't exist +const ++ [ if (checkalias $arg1) [ += $arg1 1 ] ] +const -- [ if (checkalias $arg1) [ -= $arg1 1 ] ] +const ++f [ if (checkalias $arg1) [ +=f $arg1 1 ] ] +const --f [ if (checkalias $arg1) [ -=f $arg1 1 ] ] diff --git a/config/opt/mapeditscripts.cfg b/config/opt/mapeditscripts.cfg index 64a97bfb..a4b21bb3 100644 --- a/config/opt/mapeditscripts.cfg +++ b/config/opt/mapeditscripts.cfg @@ -212,7 +212,7 @@ tempalias unclipentclippedmodels [ push h (at $slotinfo 1) // model clip height looplist (enumentities clip) ci [ push clipinfo (editentity $ci) - if (&& (! (at $clipinfo 10)) (+ (at $clipinfo 5) (at $clipinfo 6))) [ + if (&& (! (at $clipinfo 10)) (at $clipinfo 7)) [ // skip non-zero shapes push cibot (+f (getcubedata (at $clipinfo 1) (at $clipinfo 2) floor) (at $clipinfo 4)) // clip bottom, float push cih (at $clipinfo 7) // clip height, float push clipped (&& (<=f $cibot $bot) (>= (+f $cibot $cih) (+f $bot $h))) // check height range diff --git a/config/opt/survival.cfg b/config/opt/survival.cfg index 31041ee9..7e7462d5 100644 --- a/config/opt/survival.cfg +++ b/config/opt/survival.cfg @@ -63,7 +63,7 @@ const genSurvDifStr [ const survOnKill [ if (&& (= $arg1 (player1 cn)) (!= $arg1 $arg2)) [ // Player1 was actor and was not suicide - ++ survKills // Increment enemies killed counter + += survKills 1 // Increment enemies killed counter if (! (listlen $survTimeBetKills)) [ // First kill tempalias survTimeBetKills (- (millis) $startSurvMillis) // ] [ add2list survTimeBetKills (- (millis) $survLastKill) ] // Other kills @@ -270,7 +270,7 @@ const increaseDifficulty [ tempalias lastCheckPoint (millis) if (curmodeattr bot) [ if (<= (+ $survNumBots $survBotsToAdd) $survMaxBots) [ += survNumBots $survBotsToAdd; addnbot $survBotsToAdd CLA best ] [ tmpSurvInt = (- $survMaxBots $survNumBots); += survNumBots $tmpSurvInt; addnbot $tmpSurvInt CLA best ] - if (< $curSurvDifficulty 4) [ ++ curSurvDifficulty; botskillall (at [bad worse medium good best] $curSurvDifficulty) ] + if (< $curSurvDifficulty 4) [ += curSurvDifficulty 1 ; botskillall (at [bad worse medium good best] $curSurvDifficulty) ] ] ] diff --git a/config/scripts.cfg b/config/scripts.cfg index 0293dfd2..9c3094c7 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -291,11 +291,7 @@ const dlmap [ getmap $arg1 [ sleep 2500 (concat map $arg1) ] ] const rndmap [ result (at $__defaultmaps (rnd (listlen $__defaultmaps))) ] const rrnd [ + (rnd (- $arg2 $arg1)) $arg1 ] -const ++ [ if (checkalias $arg1) [ += $arg1 1 ] ] -const -- [ if (checkalias $arg1) [ -= $arg1 1 ] ] -const ++f [ if (checkalias $arg1) [ +=f $arg1 1 ] ] -const --f [ if (checkalias $arg1) [ -=f $arg1 1 ] ] -const listaverage [ if (listlen $arg1) [ tempalias tmp_sum 0; loop gsl (listlen $arg1) [ +=f tmp_sum (at $arg1 $gsl) ]; result (divf $tmp_sum (listlen $arg1)) ] ] +const listaverage [ push sum "" ; looplist $arg1 n [ +=f sum $n ] ; if (strlen $sum) [ div=f sum (listlen $arg1) ] ; result (pop sum) ] forceinit [cp_entbuf cp_entstr] NULL const get_ent_attrs [ cp_entbuf = (getenttype); loop gea $ENT_NUM_ATTRS [ add2list cp_entbuf (getentattr $gea) ] ]