Changeset 10349 in orxonox.OLD for branches/ai/src/ai/swarm_module.cc
- Timestamp:
- Jan 24, 2007, 6:55:21 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ai/src/ai/swarm_module.cc
r10249 r10349 24 24 25 25 26 void SwarmModule::addAI(WorldEntity* npc )26 void SwarmModule::addAI(WorldEntity* npc, float maxSpeed, float attackDistance) 27 27 { 28 28 std::pair< std::map<WorldEntity*,AIModule*>::iterator , bool > p; 29 29 AIModule* newAIModule=new MovementModule(npc); 30 newAIModule->setAttackDistance(attackDistance); 31 newAIModule->setMaxSpeed(maxSpeed); 32 this->attackDistance=attackDistance; 33 this->maxSpeed=maxSpeed; 30 34 p=members.insert(std::make_pair(npc,newAIModule)); 31 35 if(!p.second)delete newAIModule; 32 36 33 37 this->initialize(); 34 38 } … … 40 44 delete it->second; //delete AIModule 41 45 members.erase(it); //remove AIModule from members 42 46 43 47 this->initialize(); 44 48 } … … 77 81 this->enemys=other->getEnemyList(); 78 82 this->position=other->getPosition(); 79 83 this->maxSpeed=other->getMaxSpeed(); 84 this->attackDistance=other->getAttackDistance(); 85 80 86 this->initialize(); 81 87 }
Note: See TracChangeset
for help on using the changeset viewer.