From 1f8769de9c9cdb4f2ac0003450aa8a5649f434b0 Mon Sep 17 00:00:00 2001 From: sireus Date: Mon, 25 Apr 2011 19:29:25 +0000 Subject: [PATCH] moar simplifooification, and a fix git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6337 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index dc56b786..e58f9ccf 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -277,13 +277,9 @@ VARP(autoscreenshot, 0, 0, 1); // macros for getplayer() // TODO : find a smarter way to implement this. -#define ATTR_SET_INT(attribute) if(set) { attribute = atoi(value); } -#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, 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; } +#define ATTR_INT(attribute, readonly, extra) if(!strcmp(attr, #attribute) extra) { if(!readonly && set) p->attribute = atoi(value); intret(p->attribute); return; } +#define ATTR_POS(attribute, readonly) if(!strcmp(attr, #attribute)) { if(!readonly && set) p->o.attribute = atof(value); floatret(p->o.attribute); return; } +#define ATTR_STR(attribute, readonly) if(!strcmp(attr, #attribute)) { if(!readonly && set) copystring(p->attribute, value); result(p->attribute); return; } void getplayer(const char *cn, const char *attr, const char *value) { @@ -316,7 +312,7 @@ void getplayer(const char *cn, const char *attr, const char *value) ATTR_INT(ping, 1,); ATTR_INT(plag, 1, || !strcmp(attr, "pj")); ATTR_INT(state, 1,); - ATTR_INT(clientrole, 1,); + ATTR_INT(clientrole, 1, || !strcmp(attr, "role")); ATTR_INT(primary, 1,); ATTR_INT(frags, 1,); ATTR_INT(flagscore, 1,);