- Timestamp:
- Jan 21, 2016, 1:59:04 PM (9 years ago)
- Location:
- code/trunk/src
- Files:
-
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/GUIManager.cc
r11071 r11083 104 104 #include "util/OrxAssert.h" 105 105 #include "util/output/BaseWriter.h" 106 #include "util/StringUtils.h" 107 #include "util/SubString.h" 106 108 #include "config/ConfigValueIncludes.h" 107 109 #include "Core.h" -
code/trunk/src/libraries/core/class/SubclassIdentifier.h
r11071 r11083 92 92 public: 93 93 /// Constructor: Automaticaly assigns the Identifier of the given class. 94 SubclassIdentifier() 94 SubclassIdentifier() : identifier_(nullptr) 95 95 { 96 96 this->identifier_ = ClassIdentifier<T>::getIdentifier(); … … 98 98 99 99 /// Constructor: Assigns the given Identifier. 100 SubclassIdentifier(Identifier* identifier) 100 SubclassIdentifier(Identifier* identifier) : identifier_(nullptr) 101 101 { 102 102 this->operator=(identifier); … … 105 105 /// Copyconstructor: Assigns the identifier of another SubclassIdentifier. 106 106 template <class O> 107 SubclassIdentifier(const SubclassIdentifier<O>& identifier) 107 SubclassIdentifier(const SubclassIdentifier<O>& identifier) : identifier_(nullptr) 108 108 { 109 109 this->operator=(identifier.getIdentifier()); -
code/trunk/src/libraries/core/input/KeyBinder.cc
r11071 r11083 67 67 for (unsigned int i = 0; i < KeyCode::numberOfKeys; i++) 68 68 { 69 const std::string &keyname = KeyCode::ByString[i];69 const std::string keyname = KeyCode::ByString[i]; 70 70 if (!keyname.empty()) 71 71 keys_[i].name_ = std::string("Key") + keyname; -
code/trunk/src/libraries/network/MasterServer.cc
r11071 r11083 253 253 /* convert to string */ 254 254 std::string ip = std::string( addrconv ); 255 /* output debug info about the data that has come */ 256 helper_output_debug(event, addrconv); 255 257 /* delete addrconv */ 256 258 if( addrconv ) free( addrconv ); … … 259 261 char * packetdata = (char *)event->packet->data; 260 262 261 /* output debug info about the data that has come */262 helper_output_debug( event, addrconv );263 263 264 264 /* GAME SERVER OR CLIENT CONNECTION? */ … … 332 332 { 333 333 /***** ENTER MAIN LOOP *****/ 334 ENetEvent *event = (ENetEvent *)calloc( sizeof(ENetEvent), sizeof(char));334 ENetEvent *event = (ENetEvent *)calloc(1, sizeof(ENetEvent)); 335 335 if( event == nullptr ) 336 336 { -
code/trunk/src/libraries/network/packet/Gamestate.cc
r11071 r11083 489 489 Gamestate* Gamestate::diffVariables(Gamestate *base) 490 490 { 491 assert( this &&base); assert(data_ && base->data_);491 assert(base); assert(data_ && base->data_); 492 492 assert(!header_.isCompressed() && !base->header_.isCompressed()); 493 493 assert(!header_.isDiffed()); -
code/trunk/src/libraries/network/packet/ServerInformation.cc
r11071 r11083 55 55 // Save ACK 56 56 uint8_t* temp = event->packet->data; 57 char* ack = n ew char[strlen(LAN_DISCOVERY_ACK)+1];57 char* ack = nullptr; 58 58 loadAndIncrease((char*&)ack, temp); 59 59 … … 64 64 // Save Server Name 65 65 loadAndIncrease(this->serverName_, temp); 66 delete[] ack; 66 67 } 67 68 … … 74 75 { 75 76 std::string payload = this->serverName_ + Ogre::StringConverter::toString(this->clientNumber_); 76 uint32_t size = returnSize( (char*&)LAN_DISCOVERY_ACK) + returnSize(payload);77 uint32_t size = returnSize(LAN_DISCOVERY_ACK) + returnSize(payload); 77 78 uint8_t* temp = new uint8_t[size]; 78 79 uint8_t* temp2 = temp; 79 saveAndIncrease( (char*&)LAN_DISCOVERY_ACK, temp2);80 saveAndIncrease(LAN_DISCOVERY_ACK, temp2); 80 81 saveAndIncrease(payload, temp2); 81 82 ENetPacket* packet = enet_packet_create( temp, size, 0 ); -
code/trunk/src/libraries/util/Serialise.h
r11071 r11083 48 48 template <class T> inline uint32_t returnSize( const T& variable ); 49 49 /** @brief loads the value of a variable out of the bytestream and increases the mem pointer */ 50 template <class T> inline void loadAndIncrease( constT& variable, uint8_t*& mem );50 template <class T> inline void loadAndIncrease( T& variable, uint8_t*& mem ); 51 51 /** @brief saves the value of a variable into the bytestream and increases the mem pointer */ 52 52 template <class T> inline void saveAndIncrease( const T& variable, uint8_t*& mem ); … … 57 57 // =========== char* 58 58 59 inline uint32_t returnSize( char*& variable )59 inline uint32_t returnSize(const char*& variable ) 60 60 { 61 61 return strlen(variable)+1; 62 62 } 63 63 64 inline void saveAndIncrease( char*& variable, uint8_t*& mem )64 inline void saveAndIncrease(const char*& variable, uint8_t*& mem ) 65 65 { 66 strcpy((char*)mem, variable); 67 mem += returnSize(variable); 66 uint32_t len = returnSize(variable); 67 std::memcpy(mem, variable, len); 68 mem += len; 68 69 } 69 70 … … 72 73 if( variable ) 73 74 delete variable; 74 uint32_t len = strlen((char*)mem)+1;75 uint32_t len = returnSize((const char*&)mem); 75 76 variable = new char[len]; 76 st rcpy((char*)variable, (char*)mem);77 std::memcpy(variable, mem, len); 77 78 mem += len; 78 79 } … … 92 93 } 93 94 94 template <> inline void loadAndIncrease( constbool& variable, uint8_t*& mem )95 template <> inline void loadAndIncrease( bool& variable, uint8_t*& mem ) 95 96 { 96 97 *(uint8_t*)( &variable ) = *static_cast<uint8_t*>(mem); … … 116 117 } 117 118 118 template <> inline void loadAndIncrease( c onst char& variable, uint8_t*& mem )119 template <> inline void loadAndIncrease( char& variable, uint8_t*& mem ) 119 120 { 120 121 *(uint8_t*)( &variable ) = *static_cast<uint8_t*>(mem); … … 140 141 } 141 142 142 template <> inline void loadAndIncrease( constunsigned char& variable, uint8_t*& mem )143 template <> inline void loadAndIncrease( unsigned char& variable, uint8_t*& mem ) 143 144 { 144 145 *(uint8_t*)( &variable ) = *static_cast<uint8_t*>(mem); … … 164 165 } 165 166 166 template <> inline void loadAndIncrease( constshort& variable, uint8_t*& mem )167 template <> inline void loadAndIncrease( short& variable, uint8_t*& mem ) 167 168 { 168 169 *(short*)( &variable ) = *(int16_t*)(mem); … … 188 189 } 189 190 190 template <> inline void loadAndIncrease( constunsigned short& variable, uint8_t*& mem )191 template <> inline void loadAndIncrease( unsigned short& variable, uint8_t*& mem ) 191 192 { 192 193 *(unsigned short*)( &variable ) = *(uint16_t*)(mem); … … 212 213 } 213 214 214 template <> inline void loadAndIncrease( constint& variable, uint8_t*& mem )215 template <> inline void loadAndIncrease( int& variable, uint8_t*& mem ) 215 216 { 216 217 *(int *)( &variable ) = *(int32_t*)(mem); … … 236 237 } 237 238 238 template <> inline void loadAndIncrease( constunsigned int& variable, uint8_t*& mem )239 template <> inline void loadAndIncrease( unsigned int& variable, uint8_t*& mem ) 239 240 { 240 241 *(unsigned int*)( &variable ) = *(uint32_t*)(mem); … … 260 261 } 261 262 262 template <> inline void loadAndIncrease( constlong& variable, uint8_t*& mem )263 template <> inline void loadAndIncrease( long& variable, uint8_t*& mem ) 263 264 { 264 265 *(long*)( &variable ) = *(int32_t*)(mem); … … 284 285 } 285 286 286 template <> inline void loadAndIncrease( constunsigned long& variable, uint8_t*& mem )287 template <> inline void loadAndIncrease( unsigned long& variable, uint8_t*& mem ) 287 288 { 288 289 *(unsigned long*)( &variable ) = *(uint32_t*)(mem); … … 308 309 } 309 310 310 template <> inline void loadAndIncrease( constlong long& variable, uint8_t*& mem )311 template <> inline void loadAndIncrease( long long& variable, uint8_t*& mem ) 311 312 { 312 313 *(long long*)( &variable ) = *(int64_t*)(mem); … … 332 333 } 333 334 334 template <> inline void loadAndIncrease( constunsigned long long& variable, uint8_t*& mem )335 template <> inline void loadAndIncrease( unsigned long long& variable, uint8_t*& mem ) 335 336 { 336 337 *(unsigned long long*)( &variable ) = *(uint64_t*)(mem); … … 356 357 } 357 358 358 template <> inline void loadAndIncrease( constfloat& variable, uint8_t*& mem )359 template <> inline void loadAndIncrease( float& variable, uint8_t*& mem ) 359 360 { 360 361 *(uint32_t*)( &variable ) = *(uint32_t*)(mem); … … 380 381 } 381 382 382 template <> inline void loadAndIncrease( constdouble& variable, uint8_t*& mem )383 template <> inline void loadAndIncrease( double& variable, uint8_t*& mem ) 383 384 { 384 385 *(uint64_t*)( &variable ) = *(uint64_t*)(mem); … … 404 405 } 405 406 406 template <> inline void loadAndIncrease( constlong double& variable, uint8_t*& mem )407 template <> inline void loadAndIncrease( long double& variable, uint8_t*& mem ) 407 408 { 408 409 double temp; … … 438 439 } 439 440 440 template <> inline void loadAndIncrease( conststd::string& variable, uint8_t*& mem )441 template <> inline void loadAndIncrease( std::string& variable, uint8_t*& mem ) 441 442 { 442 443 *(std::string*)( &variable ) = (const char *)mem; … … 464 465 } 465 466 466 template <> inline void loadAndIncrease( constDegree& variable, uint8_t*& mem )467 template <> inline void loadAndIncrease( Degree& variable, uint8_t*& mem ) 467 468 { 468 469 Ogre::Real* r = (Ogre::Real*)mem; … … 491 492 } 492 493 493 template <> inline void loadAndIncrease( constRadian& variable, uint8_t*& mem )494 template <> inline void loadAndIncrease( Radian& variable, uint8_t*& mem ) 494 495 { 495 496 Ogre::Real* r = (Ogre::Real*)mem; … … 517 518 } 518 519 519 template <> inline void loadAndIncrease( constVector2& variable, uint8_t*& mem )520 template <> inline void loadAndIncrease( Vector2& variable, uint8_t*& mem ) 520 521 { 521 522 loadAndIncrease( variable.x, mem ); … … 542 543 } 543 544 544 template <> inline void loadAndIncrease( constVector3& variable, uint8_t*& mem )545 template <> inline void loadAndIncrease( Vector3& variable, uint8_t*& mem ) 545 546 { 546 547 loadAndIncrease( variable.x, mem ); … … 570 571 } 571 572 572 template <> inline void loadAndIncrease( constVector4& variable, uint8_t*& mem )573 template <> inline void loadAndIncrease( Vector4& variable, uint8_t*& mem ) 573 574 { 574 575 loadAndIncrease( variable.w, mem ); … … 600 601 } 601 602 602 template <> inline void loadAndIncrease( constQuaternion& variable, uint8_t*& mem )603 template <> inline void loadAndIncrease( Quaternion& variable, uint8_t*& mem ) 603 604 { 604 605 loadAndIncrease( variable.w, mem ); … … 630 631 } 631 632 632 template <> inline void loadAndIncrease( constColourValue& variable, uint8_t*& mem )633 template <> inline void loadAndIncrease( ColourValue& variable, uint8_t*& mem ) 633 634 { 634 635 loadAndIncrease( variable.r, mem ); … … 657 658 } 658 659 659 template <> inline void loadAndIncrease( constmbool& variable, uint8_t*& mem )660 template <> inline void loadAndIncrease( mbool& variable, uint8_t*& mem ) 660 661 { 661 662 loadAndIncrease( (unsigned char&)((mbool&)variable).getMemory(), mem ); -
code/trunk/src/modules/gametypes/SpaceRaceController.cc
r11071 r11083 397 397 bool SpaceRaceController::vergleicheQuader(const Vector3& pointToPoint, const Vector3& groesse) 398 398 { 399 if( abs(pointToPoint.x) < groesse.x)399 if(std::abs(pointToPoint.x) < groesse.x) 400 400 return true; 401 if( abs(pointToPoint.y) < groesse.y)401 if(std::abs(pointToPoint.y) < groesse.y) 402 402 return true; 403 if( abs(pointToPoint.z) < groesse.z)403 if(std::abs(pointToPoint.z) < groesse.z) 404 404 return true; 405 405 return false; -
code/trunk/src/modules/hover/TimeHUD.cc
r11071 r11083 82 82 { 83 83 this->setCaption(getTimeString(this->time_)); 84 if (this->hoverGame_->getNumberOfFlags() == 0) 85 setRunning(false); 84 86 } 85 if(this->hoverGame_->getNumberOfFlags() == 0)86 setRunning(false);87 87 88 88 } -
code/trunk/src/modules/invader/Invader.cc
r11071 r11083 129 129 newPawn->addTemplate("enemyinvader"); 130 130 } 131 newPawn->set Player(player);131 newPawn->setInvaderPlayer(player); 132 132 newPawn->level = level; 133 133 // spawn enemy at random points in front of player. -
code/trunk/src/modules/invader/InvaderEnemy.cc
r11071 r11083 58 58 if (player != nullptr) 59 59 { 60 float newZ = 2/(pow( abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * (player->getPosition().z - getPosition().z);60 float newZ = 2/(pow(std::abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * (player->getPosition().z - getPosition().z); 61 61 setVelocity(Vector3(1000.f - level * 100 , 0, newZ)); 62 62 } -
code/trunk/src/modules/invader/InvaderEnemy.h
r11071 r11083 49 49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 50 50 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) override; 51 virtual void set Player(InvaderShip* player){this->player = player;}51 virtual void setInvaderPlayer(InvaderShip* player){this->player = player;} 52 52 53 53 int level; -
code/trunk/src/modules/invader/InvaderEnemyShooter.cc
r11071 r11083 63 63 float distPlayer = player->getPosition().z - getPosition().z; 64 64 // orxout() << "i'm different!" << endl; 65 float newZ = 2/(pow( abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * distPlayer;66 setVelocity(Vector3(950 - abs(distPlayer), 0, newZ));65 float newZ = 2/(pow(std::abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * distPlayer; 66 setVelocity(Vector3(950 - std::abs(distPlayer), 0, newZ)); 67 67 } 68 68 Pawn::tick(dt); -
code/trunk/src/modules/objects/ForceField.cc
r11071 r11083 63 63 //Standard Values 64 64 this->setDirection(Vector3::ZERO); 65 this->set Velocity(100);65 this->setFieldVelocity(100); 66 66 this->setDiameter(500); 67 67 this->setMassDiameter(0); //! We allow point-masses … … 88 88 SUPER(ForceField, XMLPort, xmlelement, mode); 89 89 90 XMLPortParam(ForceField, "velocity", set Velocity, getVelocity, xmlelement, mode).defaultValues(100);90 XMLPortParam(ForceField, "velocity", setFieldVelocity, getFieldVelocity, xmlelement, mode).defaultValues(100); 91 91 XMLPortParam(ForceField, "diameter", setDiameter, getDiameter, xmlelement, mode).defaultValues(500); 92 92 XMLPortParam(ForceField, "massDiameter", setMassDiameter, getMassDiameter, xmlelement, mode).defaultValues(0); -
code/trunk/src/modules/objects/ForceField.h
r11071 r11083 98 98 @param vel The velocity to be set. 99 99 */ 100 inline void set Velocity(float vel)100 inline void setFieldVelocity(float vel) 101 101 { this->velocity_ = vel; } 102 102 /** … … 104 104 @return Returns the velocity of the ForceField. 105 105 */ 106 inline float get Velocity()106 inline float getFieldVelocity() 107 107 { return this->velocity_; } 108 108 -
code/trunk/src/modules/objects/SpaceBoundaries.cc
r11071 r11083 221 221 } 222 222 } 223 if(/* humanItem &&*/ abs(this->maxDistance_ - distance) < this->showDistance_ )223 if(/* humanItem &&*/ std::abs(this->maxDistance_ - distance) < this->showDistance_ ) 224 224 { 225 225 this->displayBoundaries(currentPawn, 1.0f - fabs(this->maxDistance_ - distance) / this->showDistance_); // Show the boundary -
code/trunk/src/modules/objects/triggers/DistanceTrigger.h
r11071 r11083 97 97 virtual ~DistanceTrigger(); 98 98 99 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; // Method for creating a DistanceTrigger object through XML.99 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; // Method for creating a DistanceTrigger object through XML. 100 100 101 101 void addTarget(const std::string& targets); // Add some target to the DistanceTrigger. -
code/trunk/src/modules/objects/triggers/EventTrigger.h
r11071 r11083 73 73 virtual ~EventTrigger(); 74 74 75 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ; // Creates an event port.75 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; // Creates an event port. 76 76 77 77 /** -
code/trunk/src/modules/overlays/hud/ChatOverlay.cc
r11071 r11083 73 73 Timer* timer = new Timer(); 74 74 this->timers_.insert(timer); // store the timer in a set to destroy it in the destructor 75 const ExecutorPtr &executor = createExecutor(createFunctor(&ChatOverlay::dropMessage, this));75 const ExecutorPtr executor = createExecutor(createFunctor(&ChatOverlay::dropMessage, this)); 76 76 executor->setDefaultValues(timer); 77 77 timer->setTimer(this->displayTime_, false, executor, true); -
code/trunk/src/modules/pickup/items/ShrinkPickup.cc
r11071 r11083 277 277 { 278 278 Pawn* pawn = this->carrierToPawnHelper(); 279 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 279 if (pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 280 { 280 281 this->Pickupable::destroy(); 282 return; 283 } 281 284 282 285 this->timeRemainig_ -= dt; -
code/trunk/src/modules/pong/Pong.cc
r11071 r11083 326 326 PlayerInfo* Pong::getLeftPlayer() const 327 327 { 328 if (this->bat_ != nullptr && this->bat_[0] != nullptr)328 if (this->bat_[0] != nullptr) 329 329 return this->bat_[0]->getPlayer(); 330 330 else … … 340 340 PlayerInfo* Pong::getRightPlayer() const 341 341 { 342 if (this->bat_ != nullptr && this->bat_[1] != nullptr)342 if (this->bat_[1] != nullptr) 343 343 return this->bat_[1]->getPlayer(); 344 344 else -
code/trunk/src/modules/questsystem/QuestListener.cc
r11071 r11083 81 81 XMLPortParam(QuestListener, "mode", setMode, getMode, xmlelement, mode); 82 82 83 if(this->quest_ != nullptr) 83 std::string questid; 84 85 if (this->quest_ != nullptr) 86 { 84 87 this->quest_->addListener(this); // Adds the QuestListener to the Quests list of listeners. 85 86 orxout(verbose, context::quests) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << endl; 88 questid = this->quest_->getId(); 89 } 90 91 orxout(verbose, context::quests) << "QuestListener created for quest: {" << questid << "} with mode '" << this->getMode() << "'." << endl; 87 92 } 88 93 -
code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h
r11071 r11083 61 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a ChangeQuestStatus object through XML. 62 62 63 virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect.64 65 63 protected: 66 64 /** -
code/trunk/src/modules/tetris/Tetris.cc
r11071 r11083 140 140 const Vector3& currentStonePosition = someStone->getPosition(); //!< Saves the position of the currentStone 141 141 142 if((position.x == currentStonePosition.x) && abs(position.y-currentStonePosition.y) < this->center_->getStoneSize())142 if((position.x == currentStonePosition.x) && std::abs(position.y-currentStonePosition.y) < this->center_->getStoneSize()) 143 143 return false; 144 144 } … … 222 222 if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level 223 223 { 224 float baseOffset = abs(stone->getPosition().y);224 float baseOffset = std::abs(stone->getPosition().y); 225 225 if (this->activeBrick_->getRotationCount() == 1 || this->activeBrick_->getRotationCount() == 3) 226 baseOffset = abs(stone->getPosition().x);226 baseOffset = std::abs(stone->getPosition().x); 227 227 float yOffset = baseOffset + this->center_->getStoneSize()/2.0f;//calculate offset 228 228 if(yOffset < 0) //catch brake-throughs -
code/trunk/src/modules/tetris/TetrisBrick.cc
r11071 r11083 213 213 { 214 214 const Vector3& position = this->getPosition(); 215 Vector3 newPos = Vector3(position.x+value.x/ abs(value.x)*this->size_, position.y, position.z);215 Vector3 newPos = Vector3(position.x+value.x/std::abs(value.x)*this->size_, position.y, position.z); 216 216 if(!this->isValidMove(newPos)) 217 217 return; -
code/trunk/src/modules/tetris/TetrisStone.cc
r9667 r11083 92 92 { 93 93 const Vector3& position = this->getPosition(); 94 Vector3 newPos = Vector3(position.x+value.x/ abs(value.x)*this->size_, position.y, position.z);94 Vector3 newPos = Vector3(position.x+value.x/std::abs(value.x)*this->size_, position.y, position.z); 95 95 if(!this->tetris_->isValidMove(this, newPos)) 96 96 return; -
code/trunk/src/modules/towerdefense/TDCoordinate.cc
r10629 r11083 66 66 float tileScale = 100; 67 67 68 Vector3 *coord = new Vector3();69 coord ->x= (_x-8) * tileScale;70 coord ->y= (_y-8) * tileScale;71 coord ->z=0;68 Vector3 coord; 69 coord.x= (_x-8) * tileScale; 70 coord.y= (_y-8) * tileScale; 71 coord.z=0; 72 72 73 return *coord;73 return coord; 74 74 } 75 75 } -
code/trunk/src/modules/towerdefense/TowerDefense.cc
r11071 r11083 377 377 { 378 378 TowerDefenseField* thisField = fields_[thisCoord->GetX()][thisCoord->GetY()]; 379 TDCoordinate* nextCoord = new TDCoordinate(0,0);380 379 381 380 if (thisField->getType() != TowerDefenseFieldType::STREET && thisField->getType() != TowerDefenseFieldType::START) … … 384 383 } 385 384 385 TDCoordinate* nextCoord = new TDCoordinate(0, 0); 386 386 387 if (thisField->getAngle() == 0) 387 388 { … … 406 407 } 407 408 409 delete nextCoord; 408 410 return nullptr; 409 411 } -
code/trunk/src/modules/weapons/projectiles/GravityBombField.cc
r11071 r11083 34 34 fieldExploded_ = false; 35 35 36 set Velocity(FORCE_SPHERE_START_STRENGTH);36 setFieldVelocity(FORCE_SPHERE_START_STRENGTH); 37 37 setDiameter(2*FORCE_SPHERE_START_RADIUS); 38 38 setMode(modeSphere_s); … … 158 158 159 159 setDiameter(forceSphereRadius_*2); 160 set Velocity(forceStrength_);160 setFieldVelocity(forceStrength_); 161 161 if(lifetime_>0) particleSphere_->setScale(forceSphereRadius_/FORCE_SPHERE_START_RADIUS); 162 162 bombModel_->setScale(modelScaling_); -
code/trunk/src/orxonox/chat/ChatInputHandler.cc
r11071 r11083 214 214 { 215 215 /* sanity checks */ 216 if( !tocolor ) 217 orxout(internal_warning) << "Empty ListBoxTextItem given to " 218 "ChatInputhandler::sub_setcolor()." << endl; 216 if (!tocolor) 217 { 218 orxout(internal_warning) << "Empty ListBoxTextItem given to " 219 "ChatInputhandler::sub_setcolor()." << endl; 220 return; 221 } 219 222 220 223 /* "hash" the name */ -
code/trunk/src/orxonox/controllers/ActionpointController.cc
r11071 r11083 74 74 void ActionpointController::tick(float dt) 75 75 { 76 if (!this || !this->getControllableEntity() || !this->isActive())76 if (!this->getControllableEntity() || !this->isActive()) 77 77 return; 78 78 … … 86 86 } 87 87 88 if (!this || !this->getControllableEntity())89 return;90 88 //fly 91 89 if (this->bHasTargetPosition_) … … 98 96 } 99 97 100 101 if (!this || !this->getControllableEntity())102 return;103 98 //don't fire rocket each tick 104 99 if (timeout_ <= 0) … … 111 106 } 112 107 113 if (!this || !this->getControllableEntity())114 return;115 108 //sometimes dodge, sometimes attack 116 109 if (this->ticks_ % 80 <= 10) … … 123 116 } 124 117 125 if (!this || !this->getControllableEntity())126 return;127 118 //fire if you can 128 119 if (this->bShooting_) … … 140 131 void ActionpointController::action() 141 132 { 142 if (!this || !this->getControllableEntity() || !this->isActive())133 if (!this->getControllableEntity() || !this->isActive()) 143 134 return; 144 135 … … 152 143 this->startAttackingEnemiesThatAreClose(); 153 144 } 154 if (!this || !this->getControllableEntity())155 return;156 145 157 146 //No action -> pop one from stack … … 161 150 if (this->parsedActionpoints_.empty() && this->loopActionpoints_.empty() && this->bDefaultFightAll_) 162 151 { 163 if (!this || !this->getControllableEntity())164 return;165 152 Point p = { Action::FIGHTALL, "", Vector3::ZERO, false }; 166 153 this->parsedActionpoints_.push_back (p); 167 154 } 168 if (!this || !this->getControllableEntity())169 return;170 155 this->executeActionpoint(); 171 if (!this || !this->getControllableEntity())172 return;173 156 this->bTakenOver_ = false; 174 157 } 175 if (!this || !this->getControllableEntity())176 return;177 158 178 159 //Action fightall -> fight till nobody alive … … 185 166 if (newTarget) 186 167 { 187 if (!this || !this->getControllableEntity())188 return;189 168 this->setAction (Action::FIGHTALL, newTarget); 190 169 } 191 170 else 192 171 { 193 if (!this || !this->getControllableEntity())194 return;195 172 this->nextActionpoint(); 196 if (!this || !this->getControllableEntity())197 return;198 173 this->executeActionpoint(); 199 174 … … 207 182 { 208 183 //----find a target---- 209 ControllableEntity* newTarget = this->closestTarget(); 210 if (!this || !this->getControllableEntity()) 211 return; 184 ControllableEntity* newTarget = this->closestTarget(); 212 185 if (newTarget && 213 186 CommonController::distance (this->getControllableEntity(), newTarget) < this->attackRange_) 214 187 { 215 if (!this || !this->getControllableEntity())216 return;217 188 this->setAction (Action::FIGHT, newTarget); 218 189 } 219 190 else 220 191 { 221 if (!this || !this->getControllableEntity())222 return;223 192 this->nextActionpoint(); 224 if (!this || !this->getControllableEntity())225 return;226 193 this->executeActionpoint(); 227 194 } … … 235 202 { 236 203 ControllableEntity* newTarget = this->closestTarget(); 237 if (!this || !this->getControllableEntity())238 return;239 204 if (newTarget && 240 205 CommonController::distance (this->getControllableEntity(), newTarget) < this->attackRange_) 241 206 { 242 if (!this || !this->getControllableEntity())243 return;244 207 this->setAction (Action::FIGHT, newTarget); 245 208 } 246 209 else 247 210 { 248 if (!this || !this->getControllableEntity())249 return;250 211 this->nextActionpoint(); 251 if (!this || !this->getControllableEntity())252 return;253 212 this->executeActionpoint(); 254 213 } … … 260 219 if (this->squaredDistanceToTarget() <= this->squaredaccuracy_) 261 220 { 262 if (!this || !this->getControllableEntity())263 return;264 221 this->nextActionpoint(); 265 if (!this || !this->getControllableEntity())266 return;267 222 this->executeActionpoint(); 268 223 } … … 272 227 if (!this->getProtect()) 273 228 { 274 if (!this || !this->getControllableEntity())275 return;276 229 this->nextActionpoint(); 277 if (!this || !this->getControllableEntity())278 return;279 230 this->executeActionpoint(); 280 231 } 281 if (!this || !this->getControllableEntity())282 return;283 232 this->stayNearProtect(); 284 233 } 285 234 else if (this->action_ == Action::ATTACK) 286 235 { 287 if (!this || !this->getControllableEntity())288 return;289 236 if (!this->hasTarget()) 290 237 { 291 if (!this || !this->getControllableEntity())292 return;293 238 this->nextActionpoint(); 294 if (!this || !this->getControllableEntity())295 return;296 239 this->executeActionpoint(); 297 240 } … … 408 351 void ActionpointController::setAction (Action action, ControllableEntity* target) 409 352 { 410 if (!this || !this->getControllableEntity())353 if (!this->getControllableEntity()) 411 354 return; 412 355 this->action_ = action; … … 425 368 void ActionpointController::setAction (Action action, const Vector3& target) 426 369 { 427 if (!this || !this->getControllableEntity())370 if (!this->getControllableEntity()) 428 371 return; 429 372 this->action_ = action; … … 436 379 void ActionpointController::setAction (Action action, const Vector3& target, const Quaternion& orient ) 437 380 { 438 if (!this || !this->getControllableEntity())381 if (!this->getControllableEntity()) 439 382 return; 440 383 this->action_ = action; … … 454 397 void ActionpointController::executeActionpoint() 455 398 { 456 if (!this || !this->getControllableEntity())399 if (!this->getControllableEntity()) 457 400 return; 458 401 … … 473 416 else 474 417 { 475 if (!this || !this->getControllableEntity())476 return;477 478 418 this->setTarget(nullptr); 479 419 this->setTargetPosition(this->getControllableEntity()->getWorldPosition()); … … 481 421 return; 482 422 } 483 if (!this || !this->getControllableEntity())484 return;485 423 if (!this->bLoop_ && this->parsedActionpoints_.back().inLoop) 486 424 { 487 425 //MOVES all points that are in loop to a loop vector 488 426 this->fillLoop(); 489 if (!this || !this->getControllableEntity())490 return;491 427 this->bLoop_ = true; 492 428 executeActionpoint(); 493 429 return; 494 430 } 495 if (!this || !this->getControllableEntity())496 return;497 431 this->setAction (p.action); 498 if (!this || !this->getControllableEntity())499 return;500 432 501 433 switch (this->action_) … … 508 440 for (Pawn* pawn : ObjectList<Pawn>()) 509 441 { 510 if (!this || !this->getControllableEntity())511 return;512 442 if (CommonController::getName(pawn) == targetName) 513 443 { … … 520 450 { 521 451 this->setTargetPosition( p.position ); 522 if (!this || !this->getControllableEntity())523 return;524 452 if (this->squaredDistanceToTarget() <= this->squaredaccuracy_) 525 453 { 526 if (!this || !this->getControllableEntity())527 return;528 454 this->nextActionpoint(); 529 if (!this || !this->getControllableEntity())530 return;531 455 this->executeActionpoint(); 532 456 } … … 535 459 case Action::PROTECT: 536 460 { 537 if (!this || !this->getControllableEntity())538 return;539 461 540 462 std::string protectName = p.name; … … 582 504 if (CommonController::getName(pawn) == targetName) 583 505 { 584 if (!this || !this->getControllableEntity())585 return;586 506 this->setTarget (static_cast<ControllableEntity*>(pawn)); 587 507 } … … 590 510 { 591 511 this->nextActionpoint(); 592 if (!this || !this->getControllableEntity())593 return;594 512 this->executeActionpoint(); 595 513 } … … 604 522 void ActionpointController::stayNearProtect() 605 523 { 606 if (!this || !this->getControllableEntity())524 if (!this->getControllableEntity()) 607 525 return; 608 526 … … 626 544 void ActionpointController::nextActionpoint() 627 545 { 628 if (!this || !this->getControllableEntity())629 return;630 546 if (this->bLoop_) 631 547 { … … 653 569 void ActionpointController::moveBackToTop() 654 570 { 655 if (!this || !this->getControllableEntity())571 if (!this->getControllableEntity()) 656 572 return; 657 573 … … 684 600 void ActionpointController::takeActionpoints (const std::vector<Point>& vector, const std::vector<Point>& loop, bool b) 685 601 { 686 if (!this || !this->getControllableEntity())602 if (!this->getControllableEntity()) 687 603 return; 688 604 this->parsedActionpoints_ = vector; 689 if (!this || !this->getControllableEntity())690 return;691 605 this->loopActionpoints_ = loop; 692 606 this->bLoop_ = b; … … 701 615 Pawn* ActionpointController::closestTarget() 702 616 { 703 if (!this || !this->getControllableEntity())617 if (!this->getControllableEntity()) 704 618 return nullptr; 705 619 … … 709 623 for (Pawn* pawn : ObjectList<Pawn>()) 710 624 { 711 if (!this || !this->getControllableEntity())712 return nullptr;713 625 if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), gt) ) 714 626 continue; … … 730 642 void ActionpointController::startAttackingEnemiesThatAreClose() 731 643 { 732 if (!this || !this->getControllableEntity())644 if (!this->getControllableEntity()) 733 645 return; 734 646 735 647 if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_)) 736 648 { 737 if (!this || !this->getControllableEntity())738 return;739 649 Pawn* newTarget = this->closestTarget(); 740 650 if ( newTarget && … … 742 652 <= this->attackRange_ ) 743 653 { 744 if (!this || !this->getControllableEntity())745 return;746 654 this->setTarget(newTarget); 747 655 if (this->bLoop_ && !this->bPatrolling_) -
code/trunk/src/orxonox/controllers/DivisionController.cc
r11071 r11083 57 57 void DivisionController::action() 58 58 { 59 if (!this || !this->getControllableEntity() || !this->isActive())59 if (!this->getControllableEntity() || !this->isActive()) 60 60 return; 61 61 62 62 ActionpointController::action(); 63 if (!this || !this->getControllableEntity())64 return;65 63 if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty())) 66 64 { -
code/trunk/src/orxonox/controllers/FightingController.cc
r11071 r11083 58 58 void FightingController::lookAtTarget(float dt) 59 59 { 60 if (!this || !this->getControllableEntity())60 if (!this->getControllableEntity()) 61 61 return; 62 62 ControllableEntity* entity = this->getControllableEntity(); … … 124 124 Vector3 diffUnit = diffVector/diffLength; 125 125 126 if (!this || !this->getControllableEntity())127 return;128 129 126 //too far? well, come closer then 130 127 if (diffLength > this->attackRange_) … … 142 139 this->bKeepFormation_ = false; 143 140 144 if (!this || !this->getControllableEntity())145 return;146 141 if (!this->bDodge_) 147 142 { … … 217 212 float FightingController::squaredDistanceToTarget() const 218 213 { 219 if (!this || !this->getControllableEntity())214 if (!this->getControllableEntity()) 220 215 return 0; 221 216 if (!this->target_ || !this->getControllableEntity()) … … 237 232 Pawn* FightingController::closestTarget() const 238 233 { 239 if (!this || !this->getControllableEntity())234 if (!this->getControllableEntity()) 240 235 return nullptr; 241 236 -
code/trunk/src/orxonox/controllers/ScriptController.cc
r11071 r11083 227 227 { 228 228 // Specify the axis 229 Vector3 *a;229 Vector3 a; 230 230 switch ((int) currentEvent.d) { 231 231 case 3: 232 a = newVector3(this->currentEvent.v1.x + this->currentEvent.e*cos(2*math::pi*dl),232 a = Vector3(this->currentEvent.v1.x + this->currentEvent.e*cos(2*math::pi*dl), 233 233 this->currentEvent.v1.y + this->currentEvent.e*sin(2*math::pi*dl), 234 234 this->currentEvent.v1.z); 235 235 break; 236 236 case 2: 237 a = newVector3(this->currentEvent.v1.x + this->currentEvent.e*sin(2*math::pi*dl),237 a = Vector3(this->currentEvent.v1.x + this->currentEvent.e*sin(2*math::pi*dl), 238 238 this->currentEvent.v1.y, 239 239 this->currentEvent.v1.z + this->currentEvent.e*cos(2*math::pi*dl)); 240 240 break; 241 241 case 1: 242 a = newVector3(this->currentEvent.v1.x,242 a = Vector3(this->currentEvent.v1.x, 243 243 this->currentEvent.v1.y + this->currentEvent.e*sin(2*math::pi*dl), 244 244 this->currentEvent.v1.z + this->currentEvent.e*cos(2*math::pi*dl)); … … 246 246 } 247 247 248 this->entity_->setPosition( *a);248 this->entity_->setPosition(a); 249 249 250 250 /* Look at the specified position */ -
code/trunk/src/orxonox/controllers/SectionController.cc
r11071 r11083 59 59 void SectionController::action() 60 60 { 61 if (!this || !this->getControllableEntity() || !this->isActive())61 if (!this->getControllableEntity() || !this->isActive()) 62 62 return; 63 63 … … 66 66 { 67 67 ActionpointController* newDivisionLeader = findNewDivisionLeader(); 68 if (!this || !this->getControllableEntity())69 return;70 68 71 69 this->myDivisionLeader_ = newDivisionLeader; … … 78 76 { 79 77 ActionpointController::action(); 80 if (!this || !this->getControllableEntity())81 return;82 78 if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty())) 83 79 { … … 98 94 else if (!this->myDivisionLeader_->bKeepFormation_) 99 95 { 100 if (!this || !this->getControllableEntity())101 return;102 96 103 97 if (!this->hasTarget()) … … 121 115 if (action == Action::FIGHT || action == Action::FIGHTALL || action == Action::ATTACK) 122 116 { 123 Pawn* target ;117 Pawn* target = nullptr; 124 118 //----if he has a target---- 125 119 if (this->myDivisionLeader_->hasTarget()) -
code/trunk/src/orxonox/controllers/WingmanController.cc
r11071 r11083 58 58 void WingmanController::action() 59 59 { 60 if (!this || !this->getControllableEntity() || !this->isActive())60 if (!this->getControllableEntity() || !this->isActive()) 61 61 return; 62 62 //----If no leader, find one---- … … 64 64 { 65 65 ActionpointController* newLeader = (findNewLeader()); 66 if (!this || !this->getControllableEntity())67 return;68 66 69 67 this->myLeader_ = newLeader; … … 92 90 else if (!this->myLeader_->bKeepFormation_) 93 91 { 94 if (!this || !this->getControllableEntity())95 return;96 92 97 93 if (!this->hasTarget()) -
code/trunk/src/orxonox/gametypes/LastManStanding.cc
r11071 r11083 88 88 if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 89 89 return true; 90 const std::string &message = ""; // resets Camper-Warning-message90 const std::string message = ""; // resets Camper-Warning-message 91 91 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 92 92 } … … 195 195 if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 196 196 return; 197 const std::string &message = ""; // resets Camper-Warning-message197 const std::string message = ""; // resets Camper-Warning-message 198 198 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 199 199 } … … 262 262 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 263 263 return; 264 const std::string &message = ""; // resets Camper-Warning-message264 const std::string message = ""; // resets Camper-Warning-message 265 265 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 266 266 } … … 270 270 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 271 271 continue; 272 const std::string &message = "Camper Warning! Don't forget to shoot.";272 const std::string message = "Camper Warning! Don't forget to shoot."; 273 273 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 274 274 } -
code/trunk/src/orxonox/gametypes/LastTeamStanding.cc
r11071 r11083 136 136 if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 137 137 return true; 138 const std::string &message = ""; // resets Camper-Warning-message138 const std::string message = ""; // resets Camper-Warning-message 139 139 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 140 140 } … … 170 170 if (it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 171 171 return; 172 const std::string &message = ""; // resets Camper-Warning-message172 const std::string message = ""; // resets Camper-Warning-message 173 173 this->gtinfo_->sendFadingMessage(message,it->first->getClientID()); 174 174 } … … 209 209 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 210 210 return; 211 const std::string &message = ""; // resets Camper-Warning-message211 const std::string message = ""; // resets Camper-Warning-message 212 212 this->gtinfo_->sendFadingMessage(message, mapEntry.first->getClientID()); 213 213 } … … 217 217 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 218 218 continue; 219 const std::string &message = "Camper Warning! Don't forget to shoot.";219 const std::string message = "Camper Warning! Don't forget to shoot."; 220 220 this->gtinfo_->sendFadingMessage(message, mapEntry.first->getClientID()); 221 221 } -
code/trunk/src/orxonox/graphics/LensFlare.cc
r11080 r11083 34 34 #include "LensFlare.h" 35 35 36 #include "core/CoreIncludes.h" 36 37 #include "core/XMLPort.h" 37 38 #include "graphics/Billboard.h" 38 39 #include "CameraManager.h" 40 #include "Camera.h" 39 41 #include "RenderQueueListener.h" 42 #include "Scene.h" 40 43 41 44 #include <OgreSphere.h> 42 45 #include <OgreRenderWindow.h> 46 #include <OgreCamera.h> 43 47 44 48 namespace orxonox -
code/trunk/src/orxonox/graphics/LensFlare.h
r11080 r11083 41 41 #include "core/GraphicsManager.h" 42 42 #include "util/Math.h" 43 #include "tools/interfaces/Tickable.h" 43 44 #include "worldentities/StaticEntity.h" 44 45 #include "graphics/Billboard.h" -
code/trunk/src/orxonox/weaponsystem/Munition.cc
r11071 r11083 544 544 if (bUseReloadTime && munition->reloadTime_ > 0 && munition->deployment_ != MunitionDeployment::Stack) 545 545 { 546 const ExecutorPtr &executor = createExecutor(createFunctor(&Magazine::loaded, this));546 const ExecutorPtr executor = createExecutor(createFunctor(&Magazine::loaded, this)); 547 547 executor->setDefaultValues(munition); 548 548 -
code/trunk/src/orxonox/worldentities/StaticEntity.cc
r11071 r11083 54 54 void StaticEntity::registerVariables() 55 55 { 56 registerVariable(this->getPosition(), VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::positionChanged)); 57 registerVariable(this->getOrientation(), VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::orientationChanged)); 56 // Ugly const casts, but are valid because position and orientation are not actually const 57 registerVariable(const_cast<Vector3&>(this->getPosition()), VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::positionChanged)); 58 registerVariable(const_cast<Quaternion&>(this->getOrientation()), VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::orientationChanged)); 58 59 } 59 60 -
code/trunk/src/orxonox/worldentities/WorldEntity.cc
r11071 r11083 190 190 registerVariable(this->bVisible_, VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility)); 191 191 192 registerVariable(this->getScale3D(), VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::scaleChanged)); 192 // Ugly const cast, but is valid because the scale is not actually const 193 registerVariable(const_cast<Vector3&>(this->getScale3D()), VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::scaleChanged)); 193 194 194 195 // Physics stuff -
code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h
r11071 r11083 46 46 virtual ~FpsPlayer(); 47 47 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;49 virtual void tick(float dt) ;48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 virtual void tick(float dt) override; 50 50 void registerVariables(); 51 51 void setConfigValues(); 52 52 53 virtual void moveFrontBack(const Vector2& value) ;54 virtual void moveRightLeft(const Vector2& value) ;55 virtual void moveUpDown(const Vector2& value) ;53 virtual void moveFrontBack(const Vector2& value) override; 54 virtual void moveRightLeft(const Vector2& value) override; 55 virtual void moveUpDown(const Vector2& value) override; 56 56 57 virtual void rotateYaw(const Vector2& value) ;58 virtual void rotatePitch(const Vector2& value) ;59 virtual void rotateRoll(const Vector2& value) ;57 virtual void rotateYaw(const Vector2& value) override; 58 virtual void rotatePitch(const Vector2& value) override; 59 virtual void rotateRoll(const Vector2& value) override; 60 60 61 61 … … 65 65 { return this->meshSrc_; } 66 66 67 void boost(bool bBoost) ; //acctually jump67 void boost(bool bBoost) override; //actually jump 68 68 69 69 virtual void fire(); … … 71 71 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 72 72 73 virtual void addedWeaponPack(WeaponPack* wPack) ;73 virtual void addedWeaponPack(WeaponPack* wPack) override; 74 74 75 75 protected: 76 virtual void setPlayer(PlayerInfo* player) ;77 virtual void startLocalHumanControl() ;76 virtual void setPlayer(PlayerInfo* player) override; 77 virtual void startLocalHumanControl() override; 78 78 bool bInvertYAxis_; 79 79 … … 89 89 90 90 private: 91 virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const ;91 virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const override; 92 92 float speed_; 93 93 -
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
r11071 r11083 235 235 236 236 // This function call adds a lift to the ship when it is rotating to make it's movement more "realistic" and enhance the feeling. 237 if (this->getLocalVelocity().z < 0 && abs(this->getLocalVelocity().z) < stallSpeed_)238 this->moveRightLeft(-lift_ / 5.0f * value * sqrt( abs(this->getLocalVelocity().z)));237 if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_) 238 this->moveRightLeft(-lift_ / 5.0f * value * sqrt(std::abs(this->getLocalVelocity().z))); 239 239 } 240 240 … … 257 257 258 258 // This function call adds a lift to the ship when it is pitching to make it's movement more "realistic" and enhance the feeling. 259 if (this->getLocalVelocity().z < 0 && abs(this->getLocalVelocity().z) < stallSpeed_)260 this->moveUpDown(lift_ / 5.0f * pitch * sqrt( abs(this->getLocalVelocity().z)));259 if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_) 260 this->moveUpDown(lift_ / 5.0f * pitch * sqrt(std::abs(this->getLocalVelocity().z))); 261 261 } 262 262 … … 505 505 this->shakeDt_ += dt; 506 506 507 float frequency = this->shakeFrequency_ * (square( abs(this->getLocalVelocity().z)));507 float frequency = this->shakeFrequency_ * (square(std::abs(this->getLocalVelocity().z))); 508 508 509 509 if (this->shakeDt_ >= 1.0f/frequency)
Note: See TracChangeset
for help on using the changeset viewer.