X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmiscfunctions.qc;h=bbbefd5a88f11cbb32e959a313366da154c3de74;hb=7530a8fe25423d8545e3622c8e36b4f82090b55d;hp=ab837c8945b873c0982d13834693c4a1a0f1fe9e;hpb=35b5d15a47d8e309396453c03e36ac717789c600;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index ab837c894..bbbefd5a8 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -8,6 +8,7 @@ #include "mutators/_mod.qh" #include "../common/t_items.qh" #include "resources.qh" +#include "items.qh" #include "weapons/accuracy.qh" #include "weapons/csqcprojectile.qh" #include "weapons/selection.qh" @@ -297,17 +298,13 @@ void GetCvars_handleString(entity this, entity store, string thisname, float f, { if (f < 0) { - if (store.(field)) - strunzone(store.(field)); - store.(field) = string_null; + strfree(store.(field)); } else if (f > 0) { if (thisname == name) { - if (store.(field)) - strunzone(store.(field)); - store.(field) = strzone(argv(f + 1)); + strcpy(store.(field), argv(f + 1)); } } else @@ -322,8 +319,7 @@ void GetCvars_handleString_Fixup(entity this, entity store, string thisname, flo string s = func(this, strcat1(store.(field))); if (s != store.(field)) { - strunzone(store.(field)); - store.(field) = strzone(s); + strcpy(store.(field), s); } } } @@ -365,14 +361,8 @@ void GetCvars_handleFloatOnce(entity this, entity store, string thisname, float } string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo) { - string o; - o = W_FixWeaponOrder_ForceComplete(wo); - if(this.weaponorder_byimpulse) - { - strunzone(this.weaponorder_byimpulse); - this.weaponorder_byimpulse = string_null; - } - this.weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(o)); + string o = W_FixWeaponOrder_ForceComplete(wo); + strcpy(CS(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o)); return o; } @@ -653,7 +643,7 @@ void readplayerstartcvars() "g_random_start_shells")); SetResourceAmount(random_start_ammo, RESOURCE_BULLETS, cvar( "g_random_start_bullets")); - SetResourceAmount(random_start_ammo, RESOURCE_ROCKETS, + SetResourceAmount(random_start_ammo, RESOURCE_ROCKETS, cvar("g_random_start_rockets")); SetResourceAmount(random_start_ammo, RESOURCE_CELLS, cvar( "g_random_start_cells")); @@ -1243,6 +1233,7 @@ float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundma }); if(!sp) { + int items_checked = 0; IL_EACH(g_items, checkpvs(mstart, it), { if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1) @@ -1250,6 +1241,10 @@ float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundma sp = it; break; } + + ++items_checked; + if(items_checked >= attempts) + break; // sanity }); if(!sp) @@ -1437,10 +1432,13 @@ bool isPushable(entity e) return false; if(e.iscreature) return true; + if (Item_IsLoot(e)) + { + return true; + } switch(e.classname) { case "body": - case "droppedweapon": return true; case "bullet": // antilagged bullets can't hit this either return false;