Changeset 11054 for code/branches/cpp11_v3/src/modules/jump/Jump.cc
- Timestamp:
- Jan 10, 2016, 1:54:11 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/modules/jump/Jump.cc
r10262 r11054 34 34 #include "Jump.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/EventIncludes.h" 37 #include "core/command/Executor.h" 38 #include "core/config/ConfigValueIncludes.h" 39 #include "gamestates/GSLevel.h" 40 #include "chat/ChatManager.h" 36 41 37 #include "JumpCenterpoint.h" 42 38 #include "JumpPlatform.h" … … 56 52 #include "JumpBoots.h" 57 53 #include "JumpShield.h" 54 55 #include "gamestates/GSLevel.h" 58 56 #include "infos/PlayerInfo.h" 57 #include "graphics/Camera.h" 59 58 60 59 namespace orxonox … … 66 65 RegisterObject(Jump); 67 66 68 center_ = 0;69 figure_ = 0;70 camera = 0;67 center_ = nullptr; 68 figure_ = nullptr; 69 camera = nullptr; 71 70 setHUDTemplate("JumpHUD"); 72 73 setConfigValues();74 71 } 75 72 … … 86 83 SUPER(Jump, tick, dt); 87 84 88 if (figure_ != NULL)85 if (figure_ != nullptr) 89 86 { 90 87 Vector3 figurePosition = figure_->getPosition(); … … 101 98 if (screenShiftSinceLastUpdate_ > center_->getSectionLength()) 102 99 { 103 if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0 && figure_->propellerActive_ == false && figure_->rocketActive_ == false&& addAdventure(adventureNumber_) == true)100 if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0 && figure_->propellerActive_ == nullptr && figure_->rocketActive_ == nullptr && addAdventure(adventureNumber_) == true) 104 101 { 105 102 screenShiftSinceLastUpdate_ -= 2*center_->getSectionLength(); … … 133 130 134 131 135 if (camera != NULL)132 if (camera != nullptr) 136 133 { 137 134 Vector3 cameraPosition = Vector3(0, totalScreenShift_, 0); … … 144 141 } 145 142 146 ObjectList<JumpPlatform>::iterator beginPlatform = ObjectList<JumpPlatform>::begin(); 147 ObjectList<JumpPlatform>::iterator endPlatform = ObjectList<JumpPlatform>::end(); 148 ObjectList<JumpPlatform>::iterator itPlatform = beginPlatform; 143 ObjectList<JumpPlatform> listPlatform; 144 ObjectList<JumpPlatform>::iterator itPlatform = listPlatform.begin(); 149 145 Vector3 platformPosition; 150 146 151 while (itPlatform != endPlatform)147 while (itPlatform != listPlatform.end()) 152 148 { 153 149 platformPosition = itPlatform->getPosition(); … … 166 162 167 163 // Deleted deactivated platforms 168 ObjectList<JumpPlatformDisappear>::iterator beginDisappear = ObjectList<JumpPlatformDisappear>::begin(); 169 ObjectList<JumpPlatformDisappear>::iterator endDisappear = ObjectList<JumpPlatformDisappear>::end(); 170 ObjectList<JumpPlatformDisappear>::iterator itDisappear = beginDisappear; 171 172 while (itDisappear != endDisappear) 164 ObjectList<JumpPlatformDisappear> listDisappear; 165 ObjectList<JumpPlatformDisappear>::iterator itDisappear = listDisappear.begin(); 166 167 while (itDisappear != listDisappear.end()) 173 168 { 174 169 if (!itDisappear->isActive()) … … 185 180 } 186 181 187 ObjectList<JumpPlatformTimer>::iterator beginTimer = ObjectList<JumpPlatformTimer>::begin(); 188 ObjectList<JumpPlatformTimer>::iterator endTimer = ObjectList<JumpPlatformTimer>::end(); 189 ObjectList<JumpPlatformTimer>::iterator itTimer = beginTimer; 190 191 while (itTimer != endTimer) 182 ObjectList<JumpPlatformTimer> listTimer; 183 ObjectList<JumpPlatformTimer>::iterator itTimer = listTimer.begin(); 184 185 while (itTimer != listTimer.end()) 192 186 { 193 187 if (!itTimer->isActive()) … … 204 198 } 205 199 206 ObjectList<JumpProjectile>::iterator beginProjectile = ObjectList<JumpProjectile>::begin(); 207 ObjectList<JumpProjectile>::iterator endProjectile = ObjectList<JumpProjectile>::end(); 208 ObjectList<JumpProjectile>::iterator itProjectile = beginProjectile; 200 ObjectList<JumpProjectile> listProjectile; 201 ObjectList<JumpProjectile>::iterator itProjectile = listProjectile.begin(); 209 202 Vector3 projectilePosition; 210 203 211 while (itProjectile != endProjectile)204 while (itProjectile != listProjectile.end()) 212 205 { 213 206 projectilePosition = itProjectile->getPosition(); … … 225 218 } 226 219 227 ObjectList<JumpEnemy>::iterator beginEnemy = ObjectList<JumpEnemy>::begin(); 228 ObjectList<JumpEnemy>::iterator endEnemy = ObjectList<JumpEnemy>::end(); 229 ObjectList<JumpEnemy>::iterator itEnemy = beginEnemy; 220 ObjectList<JumpEnemy> listEnemy; 221 ObjectList<JumpEnemy>::iterator itEnemy = listEnemy.begin(); 230 222 Vector3 enemyPosition; 231 223 232 while (itEnemy != endEnemy)224 while (itEnemy != listEnemy.end()) 233 225 { 234 226 enemyPosition = itEnemy->getPosition(); … … 246 238 } 247 239 248 ObjectList<JumpItem>::iterator beginItem = ObjectList<JumpItem>::begin(); 249 ObjectList<JumpItem>::iterator endItem = ObjectList<JumpItem>::end(); 250 ObjectList<JumpItem>::iterator itItem = beginItem; 240 ObjectList<JumpItem> listItem; 241 ObjectList<JumpItem>::iterator itItem = listItem.begin(); 251 242 Vector3 itemPosition; 252 243 253 while (itItem != endItem)244 while (itItem != listItem.end()) 254 245 { 255 246 itemPosition = itItem->getPosition(); … … 273 264 void Jump::cleanup() 274 265 { 275 camera = 0;266 camera = nullptr; 276 267 } 277 268 278 269 void Jump::start() 279 270 { 280 if (center_ != NULL) // There needs to be a JumpCenterpoint, i.e. the area the game takes place.281 { 282 if (figure_ == NULL)271 if (center_ != nullptr) // There needs to be a JumpCenterpoint, i.e. the area the game takes place. 272 { 273 if (figure_ == nullptr) 283 274 { 284 275 figure_ = new JumpFigure(center_->getContext()); … … 301 292 Deathmatch::start(); 302 293 303 if (figure_ != NULL)294 if (figure_ != nullptr) 304 295 { 305 296 camera = figure_->getCamera(); … … 328 319 assert(player); 329 320 330 if (figure_->getPlayer() == NULL)321 if (figure_->getPlayer() == nullptr) 331 322 { 332 323 player->startControl(figure_); … … 337 328 PlayerInfo* Jump::getPlayer() const 338 329 { 339 if (this->figure_ != NULL)330 if (this->figure_ != nullptr) 340 331 { 341 332 return this->figure_->getPlayer(); … … 343 334 else 344 335 { 345 return 0;336 return nullptr; 346 337 } 347 338 } … … 349 340 void Jump::addPlatform(JumpPlatform* newPlatform, std::string platformTemplate, float xPosition, float zPosition) 350 341 { 351 if (newPlatform != NULL && center_ != NULL)342 if (newPlatform != nullptr && center_ != nullptr) 352 343 { 353 344 newPlatform->addTemplate(platformTemplate); … … 417 408 { 418 409 JumpProjectile* newProjectile = new JumpProjectile(center_->getContext()); 419 if (newProjectile != NULL && center_ != NULL)410 if (newProjectile != nullptr && center_ != nullptr) 420 411 { 421 412 newProjectile->addTemplate(center_->getProjectileTemplate()); … … 430 421 { 431 422 JumpSpring* newSpring = new JumpSpring(center_->getContext()); 432 if (newSpring != NULL && center_ != NULL)423 if (newSpring != nullptr && center_ != nullptr) 433 424 { 434 425 newSpring->addTemplate(center_->getSpringTemplate()); … … 443 434 { 444 435 JumpSpring* newSpring = new JumpSpring(center_->getContext()); 445 if (newSpring != NULL && center_ != NULL)436 if (newSpring != nullptr && center_ != nullptr) 446 437 { 447 438 newSpring->addTemplate(center_->getSpringTemplate()); … … 456 447 { 457 448 JumpRocket* newRocket = new JumpRocket(center_->getContext()); 458 if (newRocket != NULL && center_ != NULL)449 if (newRocket != nullptr && center_ != nullptr) 459 450 { 460 451 newRocket->addTemplate(center_->getRocketTemplate()); … … 469 460 { 470 461 JumpRocket* newRocket = new JumpRocket(center_->getContext()); 471 if (newRocket != NULL && center_ != NULL)462 if (newRocket != nullptr && center_ != nullptr) 472 463 { 473 464 newRocket->addTemplate(center_->getRocketTemplate()); … … 482 473 { 483 474 JumpPropeller* newPropeller = new JumpPropeller(center_->getContext()); 484 if (newPropeller != NULL && center_ != NULL)475 if (newPropeller != nullptr && center_ != nullptr) 485 476 { 486 477 newPropeller->addTemplate(center_->getPropellerTemplate()); … … 495 486 { 496 487 JumpPropeller* newPropeller = new JumpPropeller(center_->getContext()); 497 if (newPropeller != NULL && center_ != NULL)488 if (newPropeller != nullptr && center_ != nullptr) 498 489 { 499 490 newPropeller->addTemplate(center_->getPropellerTemplate()); … … 508 499 { 509 500 JumpBoots* newBoots = new JumpBoots(center_->getContext()); 510 if (newBoots != NULL && center_ != NULL)501 if (newBoots != nullptr && center_ != nullptr) 511 502 { 512 503 newBoots->addTemplate(center_->getBootsTemplate()); … … 521 512 { 522 513 JumpBoots* newBoots = new JumpBoots(center_->getContext()); 523 if (newBoots != NULL && center_ != NULL)514 if (newBoots != nullptr && center_ != nullptr) 524 515 { 525 516 newBoots->addTemplate(center_->getBootsTemplate()); … … 534 525 { 535 526 JumpShield* newShield = new JumpShield(center_->getContext()); 536 if (newShield != NULL && center_ != NULL)527 if (newShield != nullptr && center_ != nullptr) 537 528 { 538 529 newShield->addTemplate(center_->getShieldTemplate()); … … 547 538 { 548 539 JumpShield* newShield = new JumpShield(center_->getContext()); 549 if (newShield != NULL && center_ != NULL)540 if (newShield != nullptr && center_ != nullptr) 550 541 { 551 542 newShield->addTemplate(center_->getShieldTemplate()); … … 560 551 { 561 552 JumpEnemy* newEnemy = new JumpEnemy(center_->getContext()); 562 if (newEnemy != NULL && center_ != NULL)553 if (newEnemy != nullptr && center_ != nullptr) 563 554 { 564 555 switch (type) … … 1273 1264 float Jump::getFuel() const 1274 1265 { 1275 if (this->figure_ != NULL)1276 { 1277 if (this->figure_->rocketActive_ != NULL)1266 if (this->figure_ != nullptr) 1267 { 1268 if (this->figure_->rocketActive_ != nullptr) 1278 1269 { 1279 1270 return this->figure_->rocketActive_->getFuelState(); 1280 1271 } 1281 else if (this->figure_->propellerActive_ != NULL)1272 else if (this->figure_->propellerActive_ != nullptr) 1282 1273 { 1283 1274 return this->figure_->propellerActive_->getFuelState(); 1284 1275 } 1285 else if (this->figure_->shieldActive_ != NULL)1276 else if (this->figure_->shieldActive_ != nullptr) 1286 1277 { 1287 1278 return this->figure_->shieldActive_->getFuelState(); 1288 1279 } 1289 else if (this->figure_->bootsActive_ != NULL)1280 else if (this->figure_->bootsActive_ != nullptr) 1290 1281 { 1291 1282 return this->figure_->bootsActive_->getFuelState(); … … 1300 1291 return figure_->dead_; 1301 1292 } 1293 1294 void Jump::setCenterpoint(JumpCenterpoint* center) 1295 { 1296 center_ = center; 1297 } 1298 1302 1299 }
Note: See TracChangeset
for help on using the changeset viewer.