I don't understand why all this stuff is needed.
Wouldn't it be more simple to have something like this :
Code:
#define FLAG_ALLIES 2
#define FLAG_AXIS 1
#define FLAG_FREE 0
Code:
int GetFlagType (edict_t *pFlagEdict)
{
// look inside pFlagEdict's entvars and stop by the model...
if (strcmp ("models/w_aflag.mdl", STRING (pFlagEdict->v.model)) == 0)
return (FLAG_ALLIES); // this one is an allied flag
else if (strcmp ("models/w_gflag.mdl", STRING (pFlagEdict->v.model)) == 0)
return (FLAG_AXIS); // this one is an evil nazi flag
else
return (FLAG_FREE); // if none of the above, the flag must be free
}
and then later on use it like this
Code:
// in BotFindItem()
int flag_team = GetFlagType (pent);
if ((strcmp("dod_control_point", item_name) == 0) && (flag_team == FLAG_ALLIES))
// do stuff for allies flag
else if ((strcmp("dod_control_point", item_name) == 0) && (flag_team == FLAG_AXIS))
// do stuff for axis flag
else if ((strcmp("dod_control_point", item_name) == 0) && (flag_team == FLAG_FREE))
// do stuff for free flag