]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reclaim the `new` keyword for entity classes
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 26 Apr 2015 06:46:37 +0000 (16:46 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 26 Apr 2015 08:04:40 +0000 (18:04 +1000)
qcsrc/common/util-pre.qh
qcsrc/menu/xonotic/inputbox.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/g_tetris.qc
qcsrc/server/target_spawn.qc

index f246200378ff5adcccb374212c0972797f4c9661..b3aacfa974858b0efe9318867231fd8739a70769 100644 (file)
     const int false = 0;
 #endif
 
+#ifndef QCC_SUPPORT_ENTITYCLASS
+    #define entityclass(name) typedef entity name
+    #define class(name)
+    #define new(class) spawn()
+#else
+    #define entityclass(name) entityclass name {}
+    #define class(name) [[class(name)]]
+    #define new(class) ((class) spawn())
+#endif
+
 // Transitional aliases
 [[deprecated("use true")]] [[alias("true")]] const bool TRUE;
 [[deprecated("use false")]] [[alias("false")]] const bool FALSE;
index 5d7d179995028719bc107d1158edcd91678bc1e8..fef5311c75c0841a0d6025682bf7a8da6180846e 100644 (file)
@@ -58,18 +58,18 @@ void XonoticInputBox_focusLeave(entity me)
 {
        me.saveCvars(me);
 }
-void XonoticInputBox_setText(entity me, string new)
+void XonoticInputBox_setText(entity me, string val)
 {
-       if(me.text != new)
+       if(me.text != val)
        {
-               SUPER(XonoticInputBox).setText(me, new);
+               SUPER(XonoticInputBox).setText(me, val);
                if(me.onChange)
                        me.onChange(me, me.onChangeEntity);
                if(me.saveImmediately)
                        me.saveCvars(me);
        }
        else
-               SUPER(XonoticInputBox).setText(me, new);
+               SUPER(XonoticInputBox).setText(me, val);
 }
 void XonoticInputBox_loadCvars(entity me)
 {
index 64d98f127b6591a0a559ebeefe1f2377f21d8ab1..d4489106dac8d8bd71c151efc841ed9679cc9d9b 100644 (file)
@@ -46,7 +46,7 @@ void make_mapinfo_Think()
 void changematchtime(float delta, float mi, float ma)
 {
        float cur;
-       float new;
+       float update;
        float lim;
 
        if(delta == 0)
@@ -67,21 +67,21 @@ void changematchtime(float delta, float mi, float ma)
                if(lim == 0)
                        return; // cannot increase any further
                else if(lim < ma)
-                       new = min(ma, lim + delta);
+                       update = min(ma, lim + delta);
                else // already above maximum: FAIL
                        return;
        }
        else
        {
                if(lim == 0) // infinite: try reducing to max, if we are allowed to
-                       new = max(mi, ma);
+                       update = max(mi, ma);
                else if(lim > mi) // above minimum: decrease
-                       new = max(mi, lim + delta);
+                       update = max(mi, lim + delta);
                else // already below minimum: FAIL
                        return;
        }
 
-       cvar_set("timelimit", ftos(new / 60));
+       cvar_set("timelimit", ftos(update / 60));
 }
 
 
index 63e498bfc36075512a8d0f0581e44d8d0f9dd3c4..70a316386e83d89458bca578c84284acb725eb5c 100644 (file)
@@ -100,11 +100,11 @@ float GetXBlock(float x, string dat)
        return stof(substring(dat, x-1, 1));
 }
 
-string SetXBlock(float x, string dat, float new)
+string SetXBlock(float x, string dat, float val)
 {
        return strcat(
                substring(dat, 0, x-1),
-               ftos(new),
+               ftos(val),
                substring(dat, x, -1)
        );
 }
index b4b9b1830509f846efa7aa64f3d701600a07974b..cba5f365d5c60424b40bb332abf61223965d7b1e 100644 (file)
@@ -315,7 +315,7 @@ void initialize_field_db()
        {
                float n, i;
                string fn;
-               vector prev, new;
+               vector prev, next;
                float ft;
 
                n = numentityfields();
@@ -323,11 +323,11 @@ void initialize_field_db()
                {
                        fn = entityfieldname(i);
                        ft = entityfieldtype(i);
-                       new = i * '1 0 0' + ft * '0 1 0' + '0 0 1';
+                       next = i * '1 0 0' + ft * '0 1 0' + '0 0 1';
                        prev = stov(db_get(TemporaryDB, strcat("/target_spawn/field/", fn)));
                        if(prev.y == 0)
                        {
-                               db_put(TemporaryDB, strcat("/target_spawn/field/", fn), vtos(new));
+                               db_put(TemporaryDB, strcat("/target_spawn/field/", fn), vtos(next));
                                if(fn == "target_spawn_spawnfunc")
                                        target_spawn_spawnfunc_field = i;
                        }