- Timestamp:
- Oct 22, 2012, 5:05:14 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Racingbot/src/modules/gametypes/RaceCheckPoint.cc
r9348 r9412 43 43 CreateFactory(RaceCheckPoint); 44 44 45 RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceMultiTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this)) 45 RaceCheckPoint::RaceCheckPoint(BaseObject* creator) : 46 DistanceMultiTrigger(creator), RadarViewable(creator, 47 static_cast<WorldEntity*> (this)) 46 48 { 47 RegisterObject(RaceCheckPoint); 48 49 this->setDistance(100); 49 RegisterObject(RaceCheckPoint) 50 ; this->setDistance(100); 50 51 this->setBeaconMode("off"); 51 52 this->setBroadcast(false); … … 60 61 this->bIsLast_ = false; 61 62 this->timeLimit_ = 0; 62 this->player_ = NULL;63 //this->players_ = vector<PlayerInfo*>(); 63 64 } 64 65 66 RaceCheckPoint::~RaceCheckPoint() 67 { 65 68 66 RaceCheckPoint::~RaceCheckPoint() 67 { 68 } 69 } 69 70 70 71 void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode) … … 86 87 ControllableEntity* entity = orxonox_cast<ControllableEntity*>(originator); 87 88 if (entity) 88 this->player_ = entity->getPlayer();89 this->players_.push_back(entity->getPlayer()); 89 90 } 90 91 } … … 95 96 if (this->timeLimit_ != 0) 96 97 { 97 std::string message = 98 98 std::string message = "You have " + multi_cast<std::string>(this->timeLimit_) 99 + " seconds to reach the check point " + multi_cast<std::string>(this->checkpointIndex_ + 1); 99 100 this->getGametype()->getGametypeInfo()->sendAnnounceMessage(message); 100 101 ChatManager::message(message); … … 107 108 108 109 if (checkpoints.x > -1) 109 110 this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5)); 110 111 if (checkpoints.y > -1) 111 112 this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5)); 112 113 if (checkpoints.z > -1) 113 this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5)); 114 this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5)); 115 } 116 117 PlayerInfo* RaceCheckPoint::getPlayer(unsigned int clientID) const 118 { 119 if (players_.size() > 0) 120 { 121 for (int i = 0; i < players_.size(); i++) 122 { 123 if (this->players_[i]->getClientID() == clientID) 124 { 125 return players_[i]; 126 } 127 } 128 } 129 return NULL; 130 } 131 132 bool RaceCheckPoint::playerWasHere(PlayerInfo* player) const 133 { 134 if (players_.size() > 0) 135 { 136 for (int i = 0; i < players_.size(); i++) 137 { 138 if (this->players_[i] == player) 139 { 140 return true; 141 } 142 } 143 } 144 return false; 114 145 } 115 146
Note: See TracChangeset
for help on using the changeset viewer.