]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some minor cleanups and optimizations
authorterencehill <piuntn@gmail.com>
Fri, 15 Feb 2019 17:40:29 +0000 (18:40 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 15 Feb 2019 17:40:29 +0000 (18:40 +0100)
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/weapons/all.qh
qcsrc/menu/xonotic/gametypelist.qc
qcsrc/menu/xonotic/util.qc
qcsrc/server/miscfunctions.qc

index 88540baf60091b5c496e93b3e67e2c1a251351d4..56cfabc501c151789bfd138556ab8c8f1a25976b 100644 (file)
@@ -163,7 +163,7 @@ entity CA_SpectateNext(entity player, entity start)
        {
                if (SAME_TEAM(player, e)) return e;
        }
-       // restart from begining
+       // restart from the beginning
        for (entity e = NULL; (e = find(e, classname, STR_PLAYER)); )
        {
                if (SAME_TEAM(player, e)) return e;
index c2984aea5a9851858aee92f5aad256ea5028d714..4192185dced0bd240245c72ba880b4d4016b2780 100644 (file)
@@ -348,7 +348,7 @@ vector drawspritearrow(vector o, float ang, vector rgb, float a, float t)
     float border = 1.5 * t;
     float margin = 4.0 * t;
 
-    float borderDiag = border * 1.414;
+    float borderDiag = border * M_SQRT2;
     vector arrowX  = eX * size;
     vector arrowY  = eY * (size+borderDiag);
     vector borderX = eX * (size+borderDiag);
index 9a32b4277839b32ddfdcb8368747615387556f06..42805b3a082a64ff988dea1c37497ecc399dc6fe 100644 (file)
@@ -144,9 +144,9 @@ X(weaponstart, float)
 X(weaponthrowable, float)
 #ifdef SVQC
 X(reload_ammo, float)
-.float reloading_ammo = reload_ammo;
+const .float reloading_ammo = reload_ammo;
 X(reload_time, float)
-.float reloading_time = reload_time;
+const .float reloading_time = reload_time;
 #endif
 #undef X
 
index 3703393789eaa1125b6777b170d470612f2bea75..2de655940f70d124f67887fca042cb8678176f3f 100644 (file)
@@ -31,16 +31,17 @@ void XonoticGametypeList_setSelected(entity me, float i)
 void XonoticGametypeList_loadCvars(entity me)
 {
        Gametype t = MapInfo_CurrentGametype();
+       int cnt = GameType_GetCount();
        float i;
-       for(i = 0; i < GameType_GetCount(); ++i)
+       for(i = 0; i < cnt; ++i)
                if(t == GameType_GetID(i))
                        break;
-       if(i >= GameType_GetCount())
+       if(i >= cnt)
        {
-               for(i = 0; i < GameType_GetCount(); ++i)
+               for(i = 0; i < cnt; ++i)
                        if(t == MAPINFO_TYPE_DEATHMATCH)
                                break;
-               if(i >= GameType_GetCount())
+               if(i >= cnt)
                        i = 0;
        }
        me.setSelected(me, i);
index 69f506e6e0eae97d0d44c5a23b7a6d955fb678eb..7340564126e52d7fb49b8aec751b583f08b14e1c 100644 (file)
@@ -712,10 +712,11 @@ Gametype GameType_GetID(int cnt)
 int GameType_GetCount()
 {
        int i = 0;
+       int dev = cvar("developer");
        #define GAMETYPE(id) ++i;
        GAMETYPES
        #undef GAMETYPE
-       #define GAMETYPE(it) if (cvar("developer")) ++i;
+       #define GAMETYPE(it) if (dev) ++i;
        HIDDEN_GAMETYPES
        #undef GAMETYPE
        return i;
index 6e722797b5d6f71db0d631b47d7130726b07cb38..9c1596f5d033551167bb5f130a7989e43fb51a16 100644 (file)
@@ -499,12 +499,7 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne
        allow_mutatorblocked = M_ARGV(3, bool);
 
        if(allguns)
-       {
-               if(weaponinfo.spawnflags & WEP_FLAG_NORMAL)
-                       d = true;
-               else
-                       d = false;
-       }
+               d = boolean(weaponinfo.spawnflags & WEP_FLAG_NORMAL);
        else if(!mutator_returnvalue)
                d = !(!weaponinfo.weaponstart);