Changeset 6601 for code/branches/ai
- Timestamp:
- Mar 22, 2010, 5:33:42 PM (15 years ago)
- Location:
- code/branches/ai/src/orxonox/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai/src/orxonox/controllers/ArtificialController.cc
r6502 r6601 30 30 31 31 #include "core/CoreIncludes.h" 32 #include "core/XMLPort.h" 32 33 #include "worldentities/ControllableEntity.h" 33 34 #include "worldentities/pawns/Pawn.h" … … 43 44 44 45 this->target_ = 0; 46 this->team_ = 0;//new 47 this->isMaster_ = false;//new 45 48 this->bShooting_ = false; 46 49 this->bHasTargetPosition_ = false; … … 52 55 ArtificialController::~ArtificialController() 53 56 { 57 } 58 59 void ArtificialController::XMLPort(Element& xmlelement, XMLPort::Mode mode) 60 { 61 SUPER(ArtificialController, XMLPort, xmlelement, mode); 62 63 XMLPortParam(ArtificialController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(0); 54 64 } 55 65 … … 188 198 int team2 = -1; 189 199 190 if (entity1->getXMLController()) 191 { 192 WaypointPatrolController* wpc = orxonox_cast<WaypointPatrolController*>(entity1->getXMLController()); 193 if (wpc) 194 team1 = wpc->getTeam(); 195 } 196 if (entity2->getXMLController()) 197 { 198 WaypointPatrolController* wpc = orxonox_cast<WaypointPatrolController*>(entity2->getXMLController()); 199 if (wpc) 200 team2 = wpc->getTeam(); 200 Controller* controller = 0; 201 if (entity1->getController()) 202 controller = entity1->getController(); 203 else 204 controller = entity1->getXMLController(); 205 if (controller) 206 { 207 ArtificialController* ac = orxonox_cast<ArtificialController*>(controller); 208 if (ac) 209 team1 = ac->getTeam(); 210 } 211 212 if (entity1->getController()) 213 controller = entity1->getController(); 214 else 215 controller = entity1->getXMLController(); 216 if (controller) 217 { 218 ArtificialController* ac = orxonox_cast<ArtificialController*>(controller); 219 if (ac) 220 team2 = ac->getTeam(); 201 221 } 202 222 -
code/branches/ai/src/orxonox/controllers/ArtificialController.h
r6417 r6601 43 43 virtual ~ArtificialController(); 44 44 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);//new 46 45 47 void abandonTarget(Pawn* target); 48 49 inline void setTeam(int team)//new 50 { this->team_ = team; } 51 inline int getTeam() const 52 { return this->team_; } 53 46 54 47 55 protected: … … 69 77 bool bShooting_; 70 78 79 bool isMaster_;//new 80 int team_;//new 81 71 82 private: 72 83 }; -
code/branches/ai/src/orxonox/controllers/WaypointPatrolController.cc
r6502 r6601 42 42 RegisterObject(WaypointPatrolController); 43 43 44 this->team_ = 0;44 //this->team_ = 0; 45 45 this->alertnessradius_ = 500; 46 46 … … 53 53 54 54 XMLPortParam(WaypointPatrolController, "alertnessradius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues(500.0f); 55 XMLPortParam(WaypointPatrolController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(0);55 // XMLPortParam(WaypointPatrolController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(0); 56 56 } 57 57 -
code/branches/ai/src/orxonox/controllers/WaypointPatrolController.h
r5929 r6601 46 46 virtual void tick(float dt); 47 47 48 inline void setTeam(int team)48 /* inline void setTeam(int team) 49 49 { this->team_ = team; } 50 50 inline int getTeam() const 51 { return this->team_; } 51 { return this->team_; } */ 52 52 53 53 inline void setAlertnessRadius(float radius) … … 59 59 void searchEnemy(); 60 60 61 int team_;61 //int team_; 62 62 float alertnessradius_; 63 63 Timer patrolTimer_;
Note: See TracChangeset
for help on using the changeset viewer.