Changeset 3300 for code/trunk/src
- Timestamp:
- Jul 17, 2009, 11:53:35 PM (15 years ago)
- Location:
- code/trunk/src
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/CommandLine.h
r3280 r3300 196 196 inline void CommandLine::getValue<std::string>(const std::string& name, std::string* value) 197 197 { 198 *value = (std::string)(getArgument(name)->getValue().getString());198 *value = getArgument(name)->getValue().getString(); 199 199 } 200 200 -
code/trunk/src/core/Game.cc
r3280 r3300 287 287 assert(it != this->statisticsTickTimes_.end()); 288 288 int64_t lastTime = currentTime - this->configuration_->statisticsAvgLength_; 289 if ( (int64_t)it->tickTime< lastTime)289 if (static_cast<int64_t>(it->tickTime) < lastTime) 290 290 { 291 291 do … … 295 295 ++it; 296 296 assert(it != this->statisticsTickTimes_.end()); 297 } while ( (int64_t)it->tickTime< lastTime);297 } while (static_cast<int64_t>(it->tickTime) < lastTime); 298 298 this->statisticsTickTimes_.erase(this->statisticsTickTimes_.begin(), it); 299 299 } -
code/trunk/src/core/Shell.cc
r3280 r3300 129 129 this->inputBuffer_->registerListener(this, &Shell::backspace, '\b', true); 130 130 this->inputBuffer_->registerListener(this, &Shell::deletechar, KeyCode::Delete); 131 this->inputBuffer_->registerListener(this, &Shell::exit, (char)27, true);131 this->inputBuffer_->registerListener(this, &Shell::exit, static_cast<char>(27), true); 132 132 this->inputBuffer_->registerListener(this, &Shell::cursor_right, KeyCode::Right); 133 133 this->inputBuffer_->registerListener(this, &Shell::cursor_left, KeyCode::Left); … … 149 149 Shell& instance = Shell::getInstance(); 150 150 151 for ( int i = instance.historyOffset_; i < (int)instance.commandHistory_.size(); ++i)151 for (unsigned int i = instance.historyOffset_; i < instance.commandHistory_.size(); ++i) 152 152 instance.addLine(instance.commandHistory_[i], -1); 153 for ( int i = 0; i < (int)instance.historyOffset_; ++i)153 for (unsigned int i = 0; i < instance.historyOffset_; ++i) 154 154 instance.addLine(instance.commandHistory_[i], -1); 155 155 } -
code/trunk/src/core/TclThreadManager.cc
r3280 r3300 577 577 this->debug("TclThread_query: " + command); 578 578 try 579 { output = (std::string)target->interpreter_->eval(command); }579 { output = static_cast<std::string>(target->interpreter_->eval(command)); } 580 580 catch (Tcl::tcl_error const &e) 581 { this->error("Tcl error: " + (std::string)e.what()); }581 { this->error("Tcl error: " + static_cast<std::string>(e.what())); } 582 582 catch (std::exception const &e) 583 { this->error("Error while executing Tcl: " + (std::string)e.what()); }583 { this->error("Error while executing Tcl: " + static_cast<std::string>(e.what())); } 584 584 } 585 585 else -
code/trunk/src/orxonox/gamestates/GSDedicated.cc
r3280 r3300 119 119 msleep(static_cast<unsigned int>((NETWORK_PERIOD - timeSinceLastUpdate_)*1000)); 120 120 msleep(static_cast<unsigned int>(NETWORK_PERIOD*1000)); // NOTE: this is to throttle the non-network framerate 121 // COUT(0) << "sleeping for " << (int)((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000) << " usec" << endl;121 // COUT(0) << "sleeping for " << static_cast<int>((NETWORK_PERIOD - timeSinceLastUpdate_) * 1000 * 1000) << " usec" << endl; 122 122 } 123 123 processQueue(); -
code/trunk/src/orxonox/interfaces/RadarViewable.cc
r3280 r3300 122 122 { 123 123 this->MapNode_->setPosition( this->getRVWorldPosition() ); 124 this->MapNode_->translate( this->getRVOrientedVelocity(), (Ogre::Node::TransformSpace)3);124 this->MapNode_->translate( this->getRVOrientedVelocity(), static_cast<Ogre::Node::TransformSpace>(3) ); 125 125 this->MapNode_->setOrientation( this->getWorldEntity()->getOrientation() ); 126 126 //Vector3 v = this->getRVWorldPosition(); -
code/trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
r3196 r3300 71 71 72 72 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it) 73 if (it->second < (int)this->teams_&& it->second >= 0)73 if (it->second < static_cast<int>(this->teams_) && it->second >= 0) 74 74 playersperteam[it->second]++; 75 75 … … 127 127 { 128 128 TeamSpawnPoint* tsp = dynamic_cast<TeamSpawnPoint*>(*it); 129 if (tsp && (int)tsp->getTeamNumber() != desiredTeamNr)129 if (tsp && static_cast<int>(tsp->getTeamNumber()) != desiredTeamNr) 130 130 { 131 131 teamSpawnPoints.erase(it++); … … 160 160 // Set the team colour 161 161 std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player); 162 if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < (int)this->teamcolours_.size())162 if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < static_cast<int>(this->teamcolours_.size())) 163 163 { 164 164 if (pawn) -
code/trunk/src/orxonox/objects/gametypes/UnderAttack.cc
r3280 r3300 51 51 52 52 this->setConfigValues(); 53 this->timesequence_ = (int) this->gameTime_;53 this->timesequence_ = static_cast<this->gameTime_); 54 54 } 55 55 -
code/trunk/src/orxonox/objects/infos/Bot.cc
r3196 r3300 52 52 this->setConfigValues(); 53 53 54 this->setName(this->names_[ (size_t)(rnd() * this->names_.size())]);54 this->setName(this->names_[static_cast<size_t>(rnd() * this->names_.size())]); 55 55 56 56 if (this->getGametype()) -
code/trunk/src/orxonox/objects/pickup/PickupCollection.cc
r3280 r3300 86 86 bool PickupCollection::checkSlot(BaseItem* item) 87 87 { 88 return ( (int)this->items_.count(item->getPickupIdentifier()) < item->getMaxCarryAmount());88 return (static_cast<int>(this->items_.count(item->getPickupIdentifier())) < item->getMaxCarryAmount()); 89 89 } 90 90 /** -
code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h
r3280 r3300 64 64 protected: 65 65 inline void setLODxml(unsigned int level) 66 { this->LOD_ = (LODParticle::Value)level; this->LODchanged(); }66 { this->LOD_ = static_cast<LODParticle::Value>(level); this->LODchanged(); } 67 67 inline unsigned int getLODxml() const 68 68 { return (unsigned int)this->LOD_; } -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
r3280 r3300 281 281 else 282 282 { 283 callMemberNetworkFunction(Pawn, doFire, this->getObjectID(), 0, ((uint8_t)firemode));283 callMemberNetworkFunction(Pawn, doFire, this->getObjectID(), 0, firemode); 284 284 if (this->weaponSystem_) 285 285 this->weaponSystem_->fire(firemode); -
code/trunk/src/orxonox/overlays/GUIOverlay.cc
r3196 r3300 67 67 std::string str; 68 68 std::stringstream out; 69 out << (long)this;69 out << static_cast<long>(this); 70 70 str = out.str(); 71 71 GUIManager::getInstance().executeCode("showCursor()"); -
code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
r3280 r3300 215 215 if (angle < 0.0) 216 216 angle = -angle; 217 angle -= 180.0f * (int)(angle / 180.0);217 angle -= 180.0f * static_caste<int>(angle / 180.0); 218 218 219 219 // take the reverse if angle is about 90 degrees … … 277 277 if (angle < 0.0) 278 278 angle = -angle; 279 angle -= Ogre::Math::PI * (int)(angle / (Ogre::Math::PI));279 angle -= Ogre::Math::PI * static_cast<int>(angle / (Ogre::Math::PI)); 280 280 if (angle > Ogre::Math::PI * 0.5) 281 281 angle = Ogre::Math::PI - angle; -
code/trunk/src/orxonox/overlays/console/InGameConsole.cc
r3280 r3300 332 332 333 333 this->consoleOverlayCursor_->setCaption(std::string(pos,' ') + cursorSymbol_); 334 this->consoleOverlayCursor_->setTop( (int) this->windowH_ * this->relativeHeight- 24);334 this->consoleOverlayCursor_->setTop(static_cast<int>(this->windowH_ * this->relativeHeight) - 24); 335 335 } 336 336 … … 416 416 this->windowW_ = newWidth; 417 417 this->windowH_ = newHeight; 418 this->consoleOverlayBorder_->setWidth( (int) this->windowW_* this->relativeWidth);419 this->consoleOverlayBorder_->setHeight( (int) this->windowH_ * this->relativeHeight);420 this->consoleOverlayNoise_->setWidth( (int) this->windowW_ * this->relativeWidth- 10);421 this->consoleOverlayNoise_->setHeight( (int) this->windowH_ * this->relativeHeight- 5);418 this->consoleOverlayBorder_->setWidth(static_cast<int>(this->windowW_* this->relativeWidth)); 419 this->consoleOverlayBorder_->setHeight(static_cast<int>(this->windowH_ * this->relativeHeight)); 420 this->consoleOverlayNoise_->setWidth(static_cast<int>(this->windowW_ * this->relativeWidth) - 10); 421 this->consoleOverlayNoise_->setHeight(static_cast<int>(this->windowH_ * this->relativeHeight) - 5); 422 422 this->consoleOverlayNoise_->setTiling(consoleOverlayNoise_->getWidth() / (50.0f * this->noiseSize_), consoleOverlayNoise_->getHeight() / (50.0f * this->noiseSize_)); 423 423 424 424 // now adjust the text lines... 425 this->desiredTextWidth_ = (int)(this->windowW_ * this->relativeWidth) - 12;425 this->desiredTextWidth_ = static_cast<int>(this->windowW_ * this->relativeWidth) - 12; 426 426 427 427 if (LINES > 0) 428 this->maxCharsPerLine_ = std::max( (unsigned int)10, (unsigned int) ((float)this->desiredTextWidth_/ CHAR_WIDTH));428 this->maxCharsPerLine_ = std::max(10U, static_cast<unsigned int>(static_cast<float>(this->desiredTextWidth_) / CHAR_WIDTH)); 429 429 else 430 430 this->maxCharsPerLine_ = 10; … … 433 433 { 434 434 this->consoleOverlayTextAreas_[i]->setWidth(this->desiredTextWidth_); 435 this->consoleOverlayTextAreas_[i]->setTop( (int) this->windowH_ * this->relativeHeight- 24 - 14*i);435 this->consoleOverlayTextAreas_[i]->setTop(static_cast<int>(this->windowH_ * this->relativeHeight) - 24 - 14*i); 436 436 } 437 437 -
code/trunk/src/orxonox/overlays/hud/GametypeStatus.cc
r3280 r3300 70 70 { 71 71 if (gtinfo->isStartCountdownRunning()) 72 this->setCaption(multi_cast<std::string>( (int)ceil(gtinfo->getStartCountdown())));72 this->setCaption(multi_cast<std::string>(static_cast<int>(ceil(gtinfo->getStartCountdown())))); 73 73 else if (ce->isA(Class(Spectator))) 74 74 this->setCaption("Press [Fire] to respawn"); -
code/trunk/src/orxonox/overlays/hud/HUDBar.cc
r3280 r3300 73 73 // create new material 74 74 std::string materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++); 75 Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General");75 Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialname, "General")); 76 76 material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); 77 77 this->textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState(); -
code/trunk/src/orxonox/overlays/hud/HUDHealthBar.cc
r3280 r3300 83 83 { 84 84 this->setValue(this->owner_->getHealth() / this->owner_->getInitialHealth()); 85 this->textoverlay_->setCaption(multi_cast<std::string>( (int)this->owner_->getHealth()));85 this->textoverlay_->setCaption(multi_cast<std::string>(static_cast<int>(this->owner_->getHealth()))); 86 86 } 87 87 -
code/trunk/src/orxonox/overlays/hud/HUDTimer.cc
r3280 r3300 59 59 if (gametype->getTimerIsActive()) 60 60 { 61 this->setCaption(multi_cast<std::string>( (int)gametype->getTime() + 1));61 this->setCaption(multi_cast<std::string>(static_cast<int>(gametype->getTime()) + 1)); 62 62 } 63 63 } -
code/trunk/src/orxonox/overlays/map/Map.cc
r3196 r3300 332 332 //this->CamNodeHelper_->attachObject(this->Cam_); 333 333 this->Cam_->setPosition(0, 0, DISTANCE); 334 this->Cam_->pitch( (Degree)PITCH);334 this->Cam_->pitch( static_cast<Degree>(PITCH) ); 335 335 this->Cam_->lookAt(Vector3(0,0,0)); 336 336 //this->Cam_->setAutoTracking(true, this->playerShipNode_); … … 425 425 426 426 /* 427 singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(1) ));427 singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(1) )); 428 428 429 429 Map::singletonMap_s->CamNodeHelper_->setDirection(Vector3::UNIT_Y, Ogre::Node::TS_PARENT, Vector3::UNIT_Y); 430 430 Map::singletonMap_s->CamNodeHelper_->lookAt(Vector3(0,0,0), Ogre::Node::TS_PARENT); 431 431 */ 432 singletonMap_s->CamNode_->yaw( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_PARENT);432 singletonMap_s->CamNode_->yaw( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_PARENT); 433 433 } 434 434 … … 437 437 if(!( Map::singletonMap_s && Map::singletonMap_s->CamNode_ )) 438 438 return; 439 //singletonMap_s->Cam_->setOrientation(singletonMap_s->Cam_->getOrientation() * Quaternion( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_) , Vector3::UNIT_X));440 /* singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( (Degree)(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(0) ));439 //singletonMap_s->Cam_->setOrientation(singletonMap_s->Cam_->getOrientation() * Quaternion( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_) , Vector3::UNIT_X)); 440 /* singletonMap_s->CamNode_->setOrientation(singletonMap_s->CamNode_->getOrientation() * Quaternion( static_cast<Degree>(-value.y * singletonMap_s->mouseLookSpeed_) , singletonMap_s->playerShipNode_->getLocalAxes().GetColumn(0) )); 441 441 442 442 Map::singletonMap_s->CamNodeHelper_->setDirection(Vector3::UNIT_Y, Ogre::Node::TS_PARENT, Vector3::UNIT_Y); 443 443 Map::singletonMap_s->CamNodeHelper_->lookAt(Vector3(0,0,0), Ogre::Node::TS_PARENT); 444 444 */ 445 singletonMap_s->CamNode_->pitch( (Degree)(value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_LOCAL);445 singletonMap_s->CamNode_->pitch( static_cast<Degree>(value.y * singletonMap_s->mouseLookSpeed_), Ogre::Node::TS_LOCAL); 446 446 447 447 } -
code/trunk/src/orxonox/tools/TextureGenerator.cc
r3280 r3300 73 73 { 74 74 std::string materialName = textureName + "_Material_" + multi_cast<std::string>(materialCount_s++); 75 Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialName, "General");75 Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialName, "General")); 76 76 material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); 77 77 Ogre::TextureUnitState* textureUnitState = material->getTechnique(0)->getPass(0)->createTextureUnitState(); -
code/trunk/src/orxonox/tools/Timer.h
r3196 r3300 100 100 /** @brief Returns the remaining time until the Timer calls the function. @return The remaining time */ 101 101 inline float getRemainingTime() const 102 { return (float)this->time_ / 1000000.0f; }102 { return static_cast<float>(this->time_ / 1000000.0f); } 103 103 /** @brief Gives the Timer some extra time. @param time The amount of extra time in seconds */ 104 104 inline void addTime(float time) -
code/trunk/src/util/Math.h
r3280 r3300 122 122 inline int round(T x) 123 123 { 124 return (int)(x + 0.5);124 return static_cast<int>(x + 0.5); 125 125 } 126 126 -
code/trunk/src/util/StringUtils.cc
r3280 r3300 82 82 { 83 83 size_t pos1 = 0; 84 int pos2 = (int)(str.size() - 1);84 int pos2 = static_cast<int>(str.size() - 1); 85 85 for (; pos1 < str.size() && (str[pos1] == ' ' || str[pos1] == '\t' || str[pos1] == '\n'); pos1++); 86 86 for (; pos2 > 0 && (str[pos2] == ' ' || str[pos2] == '\t' || str[pos2] == '\n'); pos2--); … … 352 352 for (size_t i = 0; i < str->size(); ++i) 353 353 { 354 (*str)[i] = (char)tolower((*str)[i]);354 (*str)[i] = static_cast<char>(tolower((*str)[i])); 355 355 } 356 356 } … … 376 376 for (size_t i = 0; i < str->size(); ++i) 377 377 { 378 (*str)[i] = (char)toupper((*str)[i]);378 (*str)[i] = static_cast<char>(toupper((*str)[i])); 379 379 } 380 380 }
Note: See TracChangeset
for help on using the changeset viewer.