From: terencehill Date: Fri, 15 Feb 2019 17:40:29 +0000 (+0100) Subject: Some minor cleanups and optimizations X-Git-Tag: xonotic-v0.8.5~1602 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=123b8faad91aa21fb4e87d48f0f776dd77735b2e;p=xonotic%2Fxonotic-data.pk3dir.git Some minor cleanups and optimizations --- diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index 88540baf6..56cfabc50 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@ -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; diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index c2984aea5..4192185dc 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -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); diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 9a32b4277..42805b3a0 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -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 diff --git a/qcsrc/menu/xonotic/gametypelist.qc b/qcsrc/menu/xonotic/gametypelist.qc index 370339378..2de655940 100644 --- a/qcsrc/menu/xonotic/gametypelist.qc +++ b/qcsrc/menu/xonotic/gametypelist.qc @@ -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); diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 69f506e6e..734056412 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -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; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 6e722797b..9c1596f5d 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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);