[nexuiz-commits] r8582 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jan 27 08:40:04 EST 2010
Author: div0
Date: 2010-01-27 08:40:04 -0500 (Wed, 27 Jan 2010)
New Revision: 8582
Modified:
trunk/data/qcsrc/server/cl_weapons.qc
Log:
fix autoswitch + give
Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc 2010-01-27 13:28:23 UTC (rev 8581)
+++ trunk/data/qcsrc/server/cl_weapons.qc 2010-01-27 13:40:04 UTC (rev 8582)
@@ -22,8 +22,10 @@
.float weaponcomplainindex;
float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain)
{
- float n, i, weaponwant, first_valid, prev_valid, switchtonext, switchtolast, c;
- n = tokenize_console(weaponorder);
+ // We cannot tokenize in this function, as GiveItems calls this
+ // function. Thus we must use car/cdr.
+ float weaponwant, first_valid, prev_valid, switchtonext, switchtolast, c;
+ string rest;
switchtonext = switchtolast = 0;
first_valid = prev_valid = 0;
@@ -32,9 +34,10 @@
c = 0;
- for(i = 0; i < n; ++i)
+ rest = weaponorder;
+ while(rest != "")
{
- weaponwant = stof(argv(i));
+ weaponwant = stof(car(rest)); rest = cdr(rest);
if(imp >= 0)
if((get_weaponinfo(weaponwant)).impulse != imp)
continue;
@@ -71,9 +74,10 @@
{
self.weaponcomplainindex += 1;
c = mod(self.weaponcomplainindex, c) + 1;
- for(i = 0; i < n; ++i)
+ rest = weaponorder;
+ while(rest != "")
{
- weaponwant = stof(argv(i));
+ weaponwant = stof(car(rest)); rest = cdr(rest);
if(imp >= 0)
if((get_weaponinfo(weaponwant)).impulse != imp)
continue;
More information about the nexuiz-commits
mailing list