]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make some mutators accept cvar expressions for being enabled
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 2 Sep 2017 01:30:30 +0000 (11:30 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 2 Sep 2017 01:30:30 +0000 (11:30 +1000)
28 files changed:
qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc
qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc
qcsrc/common/mutators/mutator/cloaked/sv_cloaked.qc
qcsrc/common/mutators/mutator/hook/sv_hook.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qc
qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc
qcsrc/common/mutators/mutator/midair/sv_midair.qc
qcsrc/common/mutators/mutator/multijump/multijump.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc
qcsrc/common/mutators/mutator/nix/sv_nix.qc
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/mutators/mutator/physical_items/sv_physical_items.qc
qcsrc/common/mutators/mutator/pinata/sv_pinata.qc
qcsrc/common/mutators/mutator/rocketflying/sv_rocketflying.qc
qcsrc/common/mutators/mutator/sandbox/sv_sandbox.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc
qcsrc/common/mutators/mutator/superspec/sv_superspec.qc
qcsrc/common/mutators/mutator/touchexplode/sv_touchexplode.qc
qcsrc/common/mutators/mutator/vampire/sv_vampire.qc
qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc
qcsrc/common/mutators/mutator/walljump/walljump.qc
qcsrc/server/autocvars.qh
qcsrc/server/resources.qc
qcsrc/server/resources.qh
qcsrc/server/sv_main.qc
qcsrc/server/sv_main.qh

index d1b2658161ccc9c0741ba26ba5a4c01bd18e33ff..1164e0ade66efd9dcf05c924fa76ff109dcd0e65 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_bloodloss.qh"
 
-REGISTER_MUTATOR(bloodloss, cvar("g_bloodloss"));
+float autocvar_g_bloodloss;
+REGISTER_MUTATOR(bloodloss, autocvar_g_bloodloss);
 
 .float bloodloss_timer;
 
index a64f9d0805166d2e80b1516d3b1e863db1919f14..987645aaa0c719a5546ceeb03d47ee9b2901c804 100644 (file)
@@ -1,10 +1,11 @@
 #include "sv_campcheck.qh"
 
+string autocvar_g_campcheck;
 float autocvar_g_campcheck_damage;
 float autocvar_g_campcheck_distance;
 float autocvar_g_campcheck_interval;
 
-REGISTER_MUTATOR(campcheck, cvar("g_campcheck"));
+REGISTER_MUTATOR(campcheck, expr_evaluate(autocvar_g_campcheck));
 
 .float campcheck_nextcheck;
 .float campcheck_traveled_distance;
index eb45d4baf40a5950f81bdb466c0305cf616da70e..a1fe27a877c3e46e5e4dfe59a15239c583930f0a 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_cloaked.qh"
 
-REGISTER_MUTATOR(cloaked, cvar("g_cloaked"));
+string autocvar_g_cloaked;
+REGISTER_MUTATOR(cloaked, expr_evaluate(autocvar_g_cloaked));
 
 float autocvar_g_balance_cloaked_alpha;
 
index 5dfdf4386642933e5d98404e5be6914d785c2f0c..c3967811973a9ec009bbe17d120a0be38f86387d 100644 (file)
@@ -5,7 +5,7 @@
 #ifdef SVQC
 AUTOCVAR(g_grappling_hook_useammo, bool, false, "Use ammunition with the off-hand grappling hook");
 
-REGISTER_MUTATOR(hook, cvar("g_grappling_hook")) {
+REGISTER_MUTATOR(hook, expr_evaluate(cvar_string("g_grappling_hook"))) {
     MUTATOR_ONADD {
         g_grappling_hook = true;
         if(!autocvar_g_grappling_hook_useammo)
index 3de831198d7f4e5ff48056ff55ed2d1545d9778d..1561dc10db9a326acf932de70df86365e179bd4f 100644 (file)
@@ -1,5 +1,10 @@
 #include "sv_instagib.qh"
 
+bool autocvar_g_instagib_damagedbycontents = true;
+bool autocvar_g_instagib_blaster_keepdamage = false;
+bool autocvar_g_instagib_blaster_keepforce = false;
+bool autocvar_g_instagib_mirrordamage;
+bool autocvar_g_instagib_friendlypush = true;
 //int autocvar_g_instagib_ammo_drop;
 bool autocvar_g_instagib_ammo_convert_cells;
 bool autocvar_g_instagib_ammo_convert_rockets;
@@ -12,7 +17,7 @@ float autocvar_g_instagib_speed_highspeed;
 
 #include <common/items/_mod.qh>
 
-REGISTER_MUTATOR(mutator_instagib, cvar("g_instagib") && !g_nexball);
+REGISTER_MUTATOR(mutator_instagib, autocvar_g_instagib && !g_nexball);
 
 spawnfunc(item_minst_cells)
 {
index 23e0d0d85033ac05004679c72606a9f005eb9f8c..e68c687bdeb65058bac0c887c5f8aab8967bd560 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_invincibleproj.qh"
 
-REGISTER_MUTATOR(invincibleprojectiles, cvar("g_invincible_projectiles"));
+string autocvar_g_invincible_projectiles;
+REGISTER_MUTATOR(invincibleprojectiles, expr_evaluate(autocvar_g_invincible_projectiles));
 
 MUTATOR_HOOKFUNCTION(invincibleprojectiles, EditProjectile)
 {
index a542921221a6a37bc7bddf4bb485f26fdcbd8d08..ac06a8f7747160259588667e74a20ba33878da9e 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_melee_only.qh"
 
-REGISTER_MUTATOR(melee_only, cvar("g_melee_only") && !cvar("g_instagib") && !cvar("g_overkill") && !g_nexball);
+string autocvar_g_melee_only;
+REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) && !cvar("g_instagib") && !cvar("g_overkill") && !g_nexball);
 
 MUTATOR_HOOKFUNCTION(melee_only, SetStartItems, CBC_ORDER_LAST)
 {
index 92bbacc00663c2eb70d50dda92b913874eb2493d..54b3673c6e245331c69b72dc69a0bffaa3f5ad13 100644 (file)
@@ -1,8 +1,9 @@
 #include "sv_midair.qh"
 
+string autocvar_g_midair;
 float autocvar_g_midair_shieldtime;
 
-REGISTER_MUTATOR(midair, cvar("g_midair"));
+REGISTER_MUTATOR(midair, expr_evaluate(autocvar_g_midair));
 
 .float midair_shieldtime;
 
index 47dcfd4afd550230ab85fbff4872d03cdc6e13bd..081a1fdb6fd69d7767de22b0ebecd8c8445e93b4 100644 (file)
@@ -9,7 +9,7 @@
 
 
 #if defined(SVQC)
-REGISTER_MUTATOR(multijump, cvar("g_multijump"));
+REGISTER_MUTATOR(multijump, autocvar_g_multijump);
 #elif defined(CSQC)
 REGISTER_MUTATOR(multijump, true);
 #endif
index ab8e175e72e02d43e0b61ee4705ff47b8761eef1..92e16b48d22e04bc65a49f33b12dbdacbf17eee3 100644 (file)
@@ -150,7 +150,7 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
 #include <common/monsters/sv_monsters.qh>
 #include <server/g_subs.qh>
 
-REGISTER_MUTATOR(nades, cvar("g_nades"));
+REGISTER_MUTATOR(nades, autocvar_g_nades);
 
 .float nade_time_primed;
 .float nade_lifetime;
@@ -872,7 +872,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
 
        hp -= damage;
        SetResourceAmount(this, RESOURCE_HEALTH, hp);
-       
+
 
        if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
                this.realowner = attacker;
index 288c2d5c8363ea473d824edf867275700221b677..af364995a1e92bc13c42b287babb5e3471938441 100644 (file)
@@ -68,9 +68,11 @@ roflsound "New toys, new toys!" sound.
 
 */
 
+string autocvar_g_new_toys;
+
 bool nt_IsNewToy(int w);
 
-REGISTER_MUTATOR(nt, cvar("g_new_toys") && !cvar("g_instagib") && !cvar("g_overkill"))
+REGISTER_MUTATOR(nt, expr_evaluate(autocvar_g_new_toys) && !cvar("g_instagib") && !cvar("g_overkill"))
 {
        MUTATOR_ONADD
        {
index 33536fb0a15d88ca00720ac7387b72cdcb93e26b..4de24a5898c8b214afb2351ec70b786ee9848434 100644 (file)
@@ -1,5 +1,6 @@
 #include "sv_nix.qh"
 
+string autocvar_g_nix;
 int autocvar_g_balance_nix_ammo_cells;
 int autocvar_g_balance_nix_ammo_plasma;
 int autocvar_g_balance_nix_ammo_fuel;
@@ -35,7 +36,7 @@ float nix_nextweapon;
 
 bool NIX_CanChooseWeapon(int wpn);
 
-REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"))
+REGISTER_MUTATOR(nix, expr_evaluate(autocvar_g_nix) && !cvar("g_instagib") && !cvar("g_overkill"))
 {
        MUTATOR_ONADD
        {
index d2a7308dedf04267af31ea7b599a4abd447ca08f..b47e587511643e3076e172835052c16787d3079d 100644 (file)
@@ -3,6 +3,8 @@
 #include "hmg.qh"
 #include "rpc.qh"
 
+string autocvar_g_overkill;
+
 bool autocvar_g_overkill_powerups_replace;
 
 bool autocvar_g_overkill_itemwaypoints = true;
@@ -18,7 +20,7 @@ bool autocvar_g_overkill_filter_armormega;
 
 void ok_Initialize();
 
-REGISTER_MUTATOR(ok, cvar("g_overkill") && !cvar("g_instagib") && !g_nexball && cvar_string("g_mod_balance") == "Overkill")
+REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !cvar("g_instagib") && !g_nexball && cvar_string("g_mod_balance") == "Overkill")
 {
        MUTATOR_ONADD
        {
index 62781c92073cfbd11278ea0313364bdac5bc0d8e..38cd7474b786c34343e4acf30009421d3fb8ec05 100644 (file)
@@ -4,7 +4,7 @@ int autocvar_g_physical_items;
 float autocvar_g_physical_items_damageforcescale;
 float autocvar_g_physical_items_reset;
 
-REGISTER_MUTATOR(physical_items, cvar("g_physical_items"))
+REGISTER_MUTATOR(physical_items, autocvar_g_physical_items)
 {
        // check if we have a physics engine
        MUTATOR_ONADD
index 53e4f49e60aadf08b13f9eb0880d3fe18711acd1..1084ff77895aa079e2dd9104ffe1159551f54db2 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_pinata.qh"
 
-REGISTER_MUTATOR(pinata, cvar("g_pinata") && !cvar("g_instagib") && !cvar("g_overkill"));
+string autocvar_g_pinata;
+REGISTER_MUTATOR(pinata, expr_evaluate(autocvar_g_pinata) && !cvar("g_instagib") && !cvar("g_overkill"));
 
 MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
 {
index 9f0d8fbf0d5ec4907204169f4a7e53d17e338dbb..d3c1922b997c9437ab82ba9f9c27603d1ed14e1f 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_rocketflying.qh"
 
-REGISTER_MUTATOR(rocketflying, cvar("g_rocket_flying"));
+string autocvar_g_rocket_flying;
+REGISTER_MUTATOR(rocketflying, expr_evaluate(autocvar_g_rocket_flying));
 
 MUTATOR_HOOKFUNCTION(rocketflying, EditProjectile)
 {
index 93dc602f0299df56c21597ea6cf966e951d2db78..d121cf1094685ac9263f55143b59da831cf37610 100644 (file)
@@ -1,5 +1,6 @@
 #include "sv_sandbox.qh"
 
+string autocvar_g_sandbox;
 int autocvar_g_sandbox_info;
 bool autocvar_g_sandbox_readonly;
 string autocvar_g_sandbox_storage_name;
@@ -18,7 +19,7 @@ float autocvar_g_sandbox_object_material_velocity_factor;
 float autosave_time;
 void sandbox_Database_Load();
 
-REGISTER_MUTATOR(sandbox, cvar("g_sandbox"))
+REGISTER_MUTATOR(sandbox, expr_evaluate(autocvar_g_sandbox))
 {
        MUTATOR_ONADD
        {
index 9ff3644748112eaad8c6dc1894487b52afe4dd21..ad40f978d3df800b414a28857d3625f8f66a1cb2 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <lib/float.qh>
 
+string autocvar_g_spawn_near_teammate;
 float autocvar_g_spawn_near_teammate_distance;
 int autocvar_g_spawn_near_teammate_ignore_spawnpoint;
 int autocvar_g_spawn_near_teammate_ignore_spawnpoint_max;
@@ -10,7 +11,7 @@ float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
 bool autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health;
 bool autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath;
 
-REGISTER_MUTATOR(spawn_near_teammate, cvar("g_spawn_near_teammate"));
+REGISTER_MUTATOR(spawn_near_teammate, expr_evaluate(autocvar_g_spawn_near_teammate));
 
 .entity msnt_lookat;
 
index 4c99095b79df43f68e4daa402d97599cda72ebae..eb20082359ec1f25f92643bdd3f6a2b4624ebe17 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_superspec.qh"
 
-REGISTER_MUTATOR(superspec, cvar("g_superspectate"));
+string autocvar_g_superspectate;
+REGISTER_MUTATOR(superspec, expr_evaluate(autocvar_g_superspectate));
 
 #define _SSMAGIX "SUPERSPEC_OPTIONSFILE_V1"
 #define _ISLOCAL(ent) ((edict_num(1) == (ent)) ? true : false)
index 3e6edb04b356cf4b722504cbe2d5b04af8f494c8..a1b38fb6e750a2a44b6638189b6d18f3d89a3f0d 100644 (file)
@@ -1,11 +1,12 @@
 #include "sv_touchexplode.qh"
 
+string autocvar_g_touchexplode;
 float autocvar_g_touchexplode_radius;
 float autocvar_g_touchexplode_damage;
 float autocvar_g_touchexplode_edgedamage;
 float autocvar_g_touchexplode_force;
 
-REGISTER_MUTATOR(touchexplode, cvar("g_touchexplode"));
+REGISTER_MUTATOR(touchexplode, expr_evaluate(autocvar_g_touchexplode));
 
 .float touchexplode_time;
 
index 1b07ecd669b5467d9307fc66b239086cf2602931..199b4e202a7351a9b2d25bfb4364ec02119a259d 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_vampire.qh"
 
-REGISTER_MUTATOR(vampire, cvar("g_vampire") && !cvar("g_instagib"));
+string autocvar_g_vampire;
+REGISTER_MUTATOR(vampire, expr_evaluate(autocvar_g_vampire) && !cvar("g_instagib"));
 
 MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor)
 {
index e2b0f57d760e8cd13ba17925c0211809f31f8d3b..ce9e270654cb498281e01db990aa652e0ae8f8c1 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_vampirehook.qh"
 
-REGISTER_MUTATOR(vh, cvar("g_vampirehook"));
+string autocvar_g_vampirehook;
+REGISTER_MUTATOR(vh, expr_evaluate(autocvar_g_vampirehook));
 
 bool autocvar_g_vampirehook_teamheal;
 float autocvar_g_vampirehook_damage;
index b0d95ea29eb784570f48fb4621724dd930e0e292..c462a7e2b7c869398e733019a107f69049d16472 100644 (file)
@@ -4,7 +4,7 @@
 #ifdef CSQC
 REGISTER_MUTATOR(walljump, true);
 #elif defined(SVQC)
-REGISTER_MUTATOR(walljump, cvar("g_walljump"));
+REGISTER_MUTATOR(walljump, autocvar_g_walljump);
 #endif
 
 #define PHYS_WALLJUMP(s)                                               STAT(WALLJUMP, s)
index f585a9a2c33db3eafb7b72168b2b3d8a50de8afd..fa8cee7172c6d96b73e630b417079f4d9f55211d 100644 (file)
@@ -165,12 +165,7 @@ int autocvar_g_maxplayers;
 float autocvar_g_maxplayers_spectator_blocktime;
 float autocvar_g_maxpushtime;
 float autocvar_g_maxspeed;
-#define autocvar_g_instagib cvar("g_instagib")
-bool autocvar_g_instagib_damagedbycontents = true;
-bool autocvar_g_instagib_blaster_keepdamage = false;
-bool autocvar_g_instagib_blaster_keepforce = false;
-bool autocvar_g_instagib_mirrordamage;
-bool autocvar_g_instagib_friendlypush = true;
+bool autocvar_g_instagib;
 #define autocvar_g_mirrordamage cvar("g_mirrordamage")
 #define autocvar_g_mirrordamage_virtual cvar("g_mirrordamage_virtual")
 bool autocvar_g_mirrordamage_onlyweapons;
@@ -416,7 +411,6 @@ float autocvar_g_monsters_armor_blockpercent;
 float autocvar_g_monsters_healthbars;
 bool autocvar_g_monsters_lineofsight = true;
 //bool autocvar_g_monsters_ignoretraces = true;
-#define autocvar_g_bloodloss cvar("g_bloodloss")
 bool autocvar_g_nades;
 bool autocvar_g_nades_override_dropweapon = true;
 vector autocvar_g_nades_throw_offset;
index 7677c6c2ce892278a536998a5c8748d1dde73da2..edf4ff16238ee591537546037eba9eff8fe14750 100644 (file)
@@ -1,10 +1,9 @@
+#include "resources.qh"
 /// \file
 /// \brief Source file that contains implementation of the resource system.
 /// \author Lyberta
 /// \copyright GNU GPLv2 or any later version.
 
-#include "resources.qh"
-
 #include "autocvars.qh"
 #include "miscfunctions.qh"
 
index 3189fde95a29c61d2252d2df0847a89ff23cdde9..ce8e1e8e5daaa3f023cfe169f814a5aa5c8ba89c 100644 (file)
@@ -1,10 +1,9 @@
+#pragma once
 /// \file
 /// \brief Header file that describes the resource system.
 /// \author Lyberta
 /// \copyright GNU GPLv2 or any later version.
 
-#pragma once
-
 /// \brief Unconditional maximum amount of resources the entity can have.
 const int RESOURCE_AMOUNT_HARD_LIMIT = 999;
 
index 87430a93eff4502037e10c52e8dd511f820e1852..68e7b375b507a09051f3607114f60d14cd9da0f2 100644 (file)
@@ -247,6 +247,77 @@ void StartFrame()
 .string gametypefilter;
 .string cvarfilter;
 bool DoesQ3ARemoveThisEntity(entity this);
+
+/**
+ * Evaluate an expression of the form: [+ | -]? [var[op]val | [op]var | val | var] ...
+ * +: all must match. this is the default
+ * -: one must NOT match
+ *
+ * var>x
+ * var<x
+ * var>=x
+ * var<=x
+ * var==x
+ * var!=x
+ * var===x
+ * var!==x
+ */
+bool expr_evaluate(string s)
+{
+    bool ret = false;
+    if (str2chr(s, 0) == '+') {
+        s = substring(s, 1, -1);
+    } else if (str2chr(s, 0) == '-') {
+        ret = true;
+        s = substring(s, 1, -1);
+    }
+    bool expr_fail = false;
+    for (int i = 0, n = tokenize_console(s); i < n; ++i) {
+        int o;
+        string k, v;
+        s = argv(i);
+        #define X(expr) \
+            if (expr) { \
+                continue; \
+            } else { \
+                expr_fail = true; \
+                break; \
+            }
+        #define BINOP(op, len, expr) \
+            if ((o = strstrofs(s, op, 0)) >= 0) { \
+                k = substring(s, 0, o); \
+                v = substring(s, o + len, -1); \
+                X(expr); \
+            }
+        BINOP(">=", 2, cvar(k) >= stof(v));
+        BINOP("<=", 2, cvar(k) <= stof(v));
+        BINOP(">",  1, cvar(k) >  stof(v));
+        BINOP("<",  1, cvar(k) <  stof(v));
+        BINOP("==", 2, cvar(k) == stof(v));
+        BINOP("!=", 2, cvar(k) != stof(v));
+        BINOP("===", 3, cvar_string(k) == v);
+        BINOP("!==", 3, cvar_string(k) != v);
+        {
+            k = s;
+            bool b = true;
+            if (str2chr(k, 0) == '!') {
+                k = substring(s, 1, -1);
+                b = false;
+            }
+            float f = stof(k);
+            bool isnum = ftos(f) == k;
+            X(boolean(isnum ? f : cvar(k)) == b);
+        }
+        #undef BINOP
+        #undef X
+    }
+    if (!expr_fail) {
+        ret = !ret;
+    }
+    // now ret is true if we want to keep the item, and false if we want to get rid of it
+    return ret;
+}
+
 void SV_OnEntityPreSpawnFunction(entity this)
 {
        __spawnfunc_expecting = true;
@@ -257,65 +328,8 @@ void SV_OnEntityPreSpawnFunction(entity this)
        {
                goto cleanup;
        }
-       if (this.cvarfilter != "") {
-               bool inv = false;
-
-               string s = this.cvarfilter;
-               if (str2chr(s, 0) == '+') {
-                       s = substring(s, 1, -1);
-               } else if(str2chr(s, 0) == '-') {
-                       inv = true;
-                       s = substring(s, 1, -1);
-               }
-
-        bool cvar_fail = false;
-               for (int i = 0, n = tokenize_console(s); i < n; ++i) {
-                   int o;
-            string k, v;
-                       s = argv(i);
-                       // syntax:
-                       // var>x
-                       // var<x
-                       // var>=x
-                       // var<=x
-                       // var==x
-                       // var!=x
-                       // var===x
-                       // var!==x
-                       #define X(expr) \
-                           if (expr) { \
-                    continue; \
-                } else { \
-                    cvar_fail = true; \
-                    break; \
-                }
-                       #define BINOP(op, len, expr) \
-                           if ((o = strstrofs(s, op, 0)) >= 0) { \
-                    k = substring(s, 0, o); \
-                    v = substring(s, o + len, -1); \
-                    X(expr); \
-                }
-            BINOP(">=", 2, cvar(k) >= stof(v));
-            BINOP("<=", 2, cvar(k) <= stof(v));
-            BINOP(">",  1, cvar(k) >  stof(v));
-            BINOP("<",  1, cvar(k) <  stof(v));
-            BINOP("==", 2, cvar(k) == stof(v));
-            BINOP("!=", 2, cvar(k) != stof(v));
-            // fixme: did these two ever work?
-            BINOP("===", 2, cvar_string(k) == v);
-            BINOP("!==", 2, cvar_string(k) != v);
-            if (str2chr(s, 0) == '!') { k = substring(s, 1, -1); X(!cvar(k)); }
-            { k = s; X(cvar(k)); }
-                       #undef BINOP
-                       #undef X
-               }
-               if (!cvar_fail) {
-                   inv = !inv;
-               }
-               // now inv is true if we want to keep the item, and false if we want to get rid of it
-               if (!inv) {
-                       goto cleanup;
-               }
+       if (this.cvarfilter != "" && !expr_evaluate(this.cvarfilter)) {
+        goto cleanup;
        }
 
        if (DoesQ3ARemoveThisEntity(this)) {
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..7f86d19c01a47bc83cfd2870c0f0c170a0e93b99 100644 (file)
@@ -1 +1,3 @@
 #pragma once
+
+bool expr_evaluate(string s);