Changeset 9962 for code/trunk/src/modules/gametypes/SpaceRaceController.cc
- Timestamp:
- Jan 3, 2014, 9:28:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/gametypes/SpaceRaceController.cc
r9945 r9962 207 207 // functions for dynamic Way-search 208 208 209 int SpaceRaceController::distanceSpaceshipToCheckPoint(RaceCheckPoint* CheckPoint)209 float SpaceRaceController::distanceSpaceshipToCheckPoint(RaceCheckPoint* CheckPoint) 210 210 { 211 211 if (this->getControllableEntity() != NULL) … … 222 222 RaceCheckPoint* SpaceRaceController::nextPointFind(RaceCheckPoint* raceCheckpoint) 223 223 { 224 int distances[] = {-1, -1, -1};224 float distances[] = {-1, -1, -1}; 225 225 int temp_i = 0; 226 226 for (std::set<int>::iterator it =raceCheckpoint->getVirtualNextCheckpoints().begin(); it!= raceCheckpoint->getVirtualNextCheckpoints().end(); ++it) … … 229 229 temp_i++; 230 230 } 231 if (distances[0] > distances[1] && distances[1] != -1)232 { 233 if (distances[2] < distances[1] && distances[2] != -1)231 if (distances[0] > distances[1] && distances[1] >= 0) 232 { 233 if (distances[2] < distances[1] && distances[2] >= 0) 234 234 { 235 235 return findCheckpoint(*raceCheckpoint->getVirtualNextCheckpoints().end()); // return checkpoint with ID of raceCheckpoint->getNextCheckpoints() [2] … … 243 243 else 244 244 { 245 if (distances[2] < distances[0] && distances[2] != -1)245 if (distances[2] < distances[0] && distances[2] >= 0) 246 246 { 247 247 return findCheckpoint(*raceCheckpoint->getVirtualNextCheckpoints().end()); // return [2] … … 258 258 * returns the distance between "currentPosition" and the next static checkpoint that can be reached from "currentCheckPoint" 259 259 */ 260 int SpaceRaceController::recCalculateDistance(RaceCheckPoint* currentCheckPoint, Vector3 currentPosition)260 float SpaceRaceController::recCalculateDistance(RaceCheckPoint* currentCheckPoint, Vector3 currentPosition) 261 261 { 262 262 // find: looks if the currentCheckPoint is a staticCheckPoint (staticCheckPoint is the same as: static Point) … … 267 267 else 268 268 { 269 int minimum = std::numeric_limits<int>::max();269 float minimum = std::numeric_limits<float>::max(); 270 270 for (std::set<int>::iterator it = currentCheckPoint->getVirtualNextCheckpoints().begin(); it != currentCheckPoint->getVirtualNextCheckpoints().end(); ++it) 271 271 {
Note: See TracChangeset
for help on using the changeset viewer.