void botConnect( int whichteam, int whichClass, char* name ) { gedict_t *oself; int ednum; gedict_t *ent = &g_edicts[ednum = trap_AddBot( name, 0, 0, "base" )]; if ( ent == world ) { G_sprint( self, 2, "cannot add bot\n" ); return; } oself = self; self = ent; self->bot_skin = whichClass; self->bot_team = whichteam; ClearAllWaypoints( ); ClearAllTargets( ); self->action = BOT_RESUPPLYING; self->obs_time = 0; self->oldAction = BOT_IDLE; self = oself; }
void GoForResupply() { if ( self->action == BOT_FIGHTING ) return; self->action = BOT_RESUPPLYING; ClearAllTargets(); ClearAllWaypoints(); self->s.v.button1 = 0; self->s.v.button2 = 0; }
//I am not happy with this: //this function exists to deal with a specific problem with the // destruction chain where we reference a SystemEntity (m_self), which // also contains their TargetManager. The TargetManager object is // not destroyed until the base SystemEntity is destroyed, but // the SystemEntity pointer itself becomes invalid as soon as the // first child class in its hierarchy (such as Client or NPC) are // destroyed. Thus, all terminal children of SystemEntity must call // this from their destructor. void TargetManager::DoDestruction() { if(!m_destroyed) { ClearAllTargets(false); } }