From 6d8d78334141c239acab03539a812fed996c21be Mon Sep 17 00:00:00 2001 From: sireus Date: Mon, 25 Apr 2011 18:45:35 +0000 Subject: [PATCH] sorry, forgot about that - now it's messier than before :S git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6336 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 5b18e8b9..dc56b786 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -281,8 +281,8 @@ VARP(autoscreenshot, 0, 0, 1); #define ATTR_SET_FLOAT(attribute) if(set) { attribute = atof(value); } #define ATTR_SET_STR(attribute) if (set) { copystring(attribute, value); } -#define ATTR_INT(attribute, readonly) if(!strcmp(attr, #attribute)) { if(!readonly) ATTR_SET_INT(p->attribute); intret(p->attribute); return; } -#define ATTR_FLOAT(attribute, readonly) if(!strcmp(attr, #attribute)) { if(!readonly) ATTR_SET_FLOAT(p->attribute); floatret(p->attribute); return; } +#define ATTR_INT(attribute, readonly, extra) if(!strcmp(attr, #attribute) extra) { if(!readonly) ATTR_SET_INT(p->attribute); intret(p->attribute); return; } +#define ATTR_POS(attribute, readonly) if(!strcmp(attr, #attribute)) { if(!readonly) ATTR_SET_FLOAT(p->o.attribute); floatret(p->o.attribute); return; } #define ATTR_STR(attribute, readonly) if(!strcmp(attr, #attribute)) { if(!readonly) ATTR_SET_STR(p->attribute); result(p->attribute); return; } void getplayer(const char *cn, const char *attr, const char *value) @@ -299,29 +299,29 @@ void getplayer(const char *cn, const char *attr, const char *value) bool set = *value && value && p==player1; // do we have to get or set an attribute (valid value, player selected is local client) if(p==player1) { - ATTR_INT(health, 1); - ATTR_INT(armour, 1); - ATTR_INT(weaponsel->mag, 1); - ATTR_INT(weaponsel->ammo, 1); - ATTR_INT(nextprimary, 0); + ATTR_INT(health, 1,); + ATTR_INT(armour, 1,); + ATTR_INT(weaponsel->mag, 1, || !strcmp(attr, "magcontent")); + ATTR_INT(weaponsel->ammo, 1, || !strcmp(attr, "ammo")); + ATTR_INT(nextprimary, 0,); } if(p->team == player1->team || player1->isspectating()) { - ATTR_FLOAT(o.x, 1); - ATTR_FLOAT(o.y, 1); - ATTR_FLOAT(o.z, 1); + ATTR_POS(x, 1); + ATTR_POS(y, 1); + ATTR_POS(z, 1); } ATTR_STR(name, 0); - ATTR_INT(team, 1); - ATTR_INT(ping, 1); - ATTR_INT(plag, 1); - ATTR_INT(state, 1); - ATTR_INT(clientrole, 1); - ATTR_INT(primary, 1); - ATTR_INT(frags, 1); - ATTR_INT(flagscore, 1); - ATTR_INT(points, 1); - ATTR_INT(deaths, 1); + ATTR_INT(team, 1,); + ATTR_INT(ping, 1,); + ATTR_INT(plag, 1, || !strcmp(attr, "pj")); + ATTR_INT(state, 1,); + ATTR_INT(clientrole, 1,); + ATTR_INT(primary, 1,); + ATTR_INT(frags, 1,); + ATTR_INT(flagscore, 1,); + ATTR_INT(points, 1,); + ATTR_INT(deaths, 1,); conoutf("invalid attribute"); }