Changeset 2171 for code/trunk/src/orxonox
- Timestamp:
- Nov 10, 2008, 12:05:03 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 deleted
- 63 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/objecthierarchy merged: 2111-2115,2123,2132-2134,2143-2144,2153-2158,2160-2169
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/CMakeLists.txt
r2130 r2171 4 4 LevelManager.cc 5 5 Main.cc 6 PlayerManager.cc 6 7 Settings.cc 7 8 -
code/trunk/src/orxonox/CameraManager.cc
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/orxonox/CameraManager.h
- Property svn:mergeinfo changed
/code/branches/objecthierarchy/src/orxonox/CameraManager.h merged: 2114
r2103 r2171 28 28 29 29 /** 30 @file CameraManager.h30 @file 31 31 @brief Handles the instances of Camera class 32 32 @author Benjamin Knecht <beni_at_orxonox.net> - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/LevelManager.cc
r2087 r2171 28 28 29 29 #include "OrxonoxStableHeaders.h" 30 31 30 #include "LevelManager.h" 32 31 33 #include "core/CoreIncludes.h" 34 35 #include "objects/infos/Level.h" 32 #include "PlayerManager.h" 33 #include "objects/Level.h" 36 34 #include "objects/infos/HumanPlayer.h" 37 35 … … 42 40 LevelManager::LevelManager() 43 41 { 44 RegisterRootObject(LevelManager);45 46 42 assert(singletonRef_s == 0); 47 43 singletonRef_s = this; 48 49 this->getConnectedClients();50 44 } 51 45 … … 95 89 { 96 90 this->levels_s.front()->setActive(true); 97 for (std::map<unsigned int, PlayerInfo*>:: iterator it = this->clients_.begin(); it != this->clients_.end(); ++it)91 for (std::map<unsigned int, PlayerInfo*>::const_iterator it = PlayerManager::getInstance().getClients().begin(); it != PlayerManager::getInstance().getClients().end(); ++it) 98 92 this->levels_s.front()->playerEntered(it->second); 99 93 } 100 94 } 101 102 103 void LevelManager::clientConnected(unsigned int clientID)104 {105 COUT(3) << "client connected" << std::endl;106 107 // create new HumanPlayer instance108 HumanPlayer* player = new HumanPlayer(0);109 player->setClientID(clientID);110 111 // add to clients-map112 assert(!this->clients_[clientID]);113 this->clients_[clientID] = player;114 115 if (this->getActiveLevel())116 this->getActiveLevel()->playerEntered(player);117 }118 119 void LevelManager::clientDisconnected(unsigned int clientID)120 {121 COUT(3) << "client disconnected" << std::endl;122 123 // remove from clients-map124 PlayerInfo* player = this->clients_[clientID];125 this->clients_.erase(clientID);126 127 if (this->getActiveLevel())128 this->getActiveLevel()->playerLeft(player);129 130 // delete PlayerInfo instance131 if (player)132 delete player;133 }134 135 136 PlayerInfo* LevelManager::getClient(unsigned int clientID) const137 {138 std::map<unsigned int, PlayerInfo*>::const_iterator it = this->clients_.find(clientID);139 if (it != this->clients_.end())140 return it->second;141 else142 return 0;143 }144 95 } -
code/trunk/src/orxonox/LevelManager.h
r2087 r2171 36 36 #include <cassert> 37 37 38 #include "network/ClientConnectionListener.h"39 40 38 namespace orxonox 41 39 { 42 class _OrxonoxExport LevelManager : public network::ClientConnectionListener40 class _OrxonoxExport LevelManager 43 41 { 44 42 public: … … 50 48 Level* getActiveLevel(); 51 49 52 PlayerInfo* getClient(unsigned int clientID) const; 53 inline const std::map<unsigned int, PlayerInfo*>& getClients() const 54 { return this->clients_; } 55 50 static LevelManager* getInstancePtr() { return singletonRef_s; } 56 51 static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 57 52 … … 59 54 LevelManager(const LevelManager&); 60 55 61 void clientConnected(unsigned int clientID);62 void clientDisconnected(unsigned int clientID);63 64 56 void activateNextLevel(); 65 57 66 58 std::list<Level*> levels_s; 67 std::map<unsigned int, PlayerInfo*> clients_;68 69 59 static LevelManager* singletonRef_s; 70 60 }; -
code/trunk/src/orxonox/OrxonoxPrereqs.h
r2096 r2171 82 82 class CameraManager; 83 83 class LevelManager; 84 class PlayerManager; 84 85 85 86 // objects 87 class Level; 86 88 class Scene; 87 89 … … 142 144 143 145 class Info; 144 class Level;145 146 class PlayerInfo; 146 147 class HumanPlayer; -
code/trunk/src/orxonox/Settings.h
r2087 r2171 28 28 29 29 /** 30 @file Core.h30 @file 31 31 @brief Declaration of the Settings class. 32 32 -
code/trunk/src/orxonox/gamestates/GSClient.cc
r2087 r2171 53 53 Core::setIsClient(true); 54 54 55 this->client_ = new network::Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));55 this->client_ = new Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port")); 56 56 57 57 if(!client_->establishConnection()) -
code/trunk/src/orxonox/gamestates/GSClient.h
r2087 r2171 49 49 void ticked(const Clock& time); 50 50 51 network::Client* client_;51 Client* client_; 52 52 }; 53 53 } -
code/trunk/src/orxonox/gamestates/GSDedicated.cc
r2087 r2171 32 32 #include "core/CommandLine.h" 33 33 #include "core/Core.h" 34 #include "core/Iterator.h" 34 35 #include "network/Server.h" 36 #include "objects/Tickable.h" 35 37 36 38 namespace orxonox … … 50 52 Core::setHasServer(true); 51 53 52 this->server_ = new network::Server(CommandLine::getValue("port"));54 this->server_ = new Server(CommandLine::getValue("port")); 53 55 COUT(0) << "Loading scene in server mode" << std::endl; 54 56 -
code/trunk/src/orxonox/gamestates/GSDedicated.h
r2087 r2171 48 48 void ticked(const Clock& time); 49 49 50 network::Server* server_;50 Server* server_; 51 51 }; 52 52 } -
code/trunk/src/orxonox/gamestates/GSGraphics.cc
r2103 r2171 56 56 #include "gui/GUIManager.h" 57 57 #include "tools/WindowEventListener.h" 58 #include "objects/Tickable.h"59 58 #include "Settings.h" 60 59 … … 242 241 this->tickChild(time); 243 242 244 /*** HACK *** HACK ***/245 // Call the Tickable objects246 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)247 it->tick(time.getDeltaTime());248 /*** HACK *** HACK ***/249 250 243 if (this->bWindowEventListenerUpdateRequired_) 251 244 { -
code/trunk/src/orxonox/gamestates/GSRoot.cc
r2087 r2171 41 41 #include "core/TclThreadManager.h" 42 42 #include "tools/Timer.h" 43 #include "objects/Tickable.h" 43 44 #include "Settings.h" 44 45 … … 143 144 it->tick(time); 144 145 146 /*** HACK *** HACK ***/ 147 // Call the Tickable objects 148 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it) 149 it->tick(time.getDeltaTime()); 150 /*** HACK *** HACK ***/ 151 145 152 this->tickChild(time); 146 153 } -
code/trunk/src/orxonox/gamestates/GSServer.cc
r2087 r2171 52 52 Core::setHasServer(true); 53 53 54 this->server_ = new network::Server(CommandLine::getValue("port"));54 this->server_ = new Server(CommandLine::getValue("port")); 55 55 COUT(0) << "Loading scene in server mode" << std::endl; 56 56 -
code/trunk/src/orxonox/gamestates/GSServer.h
r2087 r2171 48 48 void ticked(const Clock& time); 49 49 50 network::Server* server_;50 Server* server_; 51 51 }; 52 52 } -
code/trunk/src/orxonox/objects/CMakeLists.txt
r2131 r2171 3 3 EventDispatcher.cc 4 4 EventTarget.cc 5 Level.cc 5 6 Radar.cc 6 7 RadarListener.cc -
code/trunk/src/orxonox/objects/Scene.cc
r2087 r2171 43 43 CreateFactory(Scene); 44 44 45 Scene::Scene(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)45 Scene::Scene(BaseObject* creator) : BaseObject(creator), Synchronisable(creator) 46 46 { 47 47 RegisterObject(Scene); … … 114 114 void Scene::registerVariables() 115 115 { 116 REGISTERSTRING(this->skybox_, network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox));117 REGISTERDATA(this->ambientLight_, network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight));116 REGISTERSTRING(this->skybox_, direction::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox)); 117 REGISTERDATA(this->ambientLight_, direction::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight)); 118 118 } 119 119 … … 164 164 return 0; 165 165 } 166 167 void Scene::tick(float dt) 168 { 169 if (!Core::showsGraphics()) 170 { 171 // We need to update the scene nodes if we don't render 172 this->rootSceneNode_->_update(true, false); 173 } 174 } 166 175 } -
code/trunk/src/orxonox/objects/Scene.h
r2087 r2171 35 35 #include "core/BaseObject.h" 36 36 #include "util/Math.h" 37 #include "objects/Tickable.h" 37 38 38 39 namespace orxonox 39 40 { 40 class _OrxonoxExport Scene : public BaseObject, public network::Synchronisable41 class _OrxonoxExport Scene : public BaseObject, public Synchronisable, public Tickable 41 42 { 42 43 public: … … 64 65 { return this->bShadows_; } 65 66 67 virtual void tick(float dt); 68 66 69 private: 67 70 void addObject(BaseObject* object); -
code/trunk/src/orxonox/objects/Test.cc
r2087 r2171 30 30 #include "core/CoreIncludes.h" 31 31 #include "core/ConfigValueIncludes.h" 32 #include "core/ConsoleCommand.h" 32 33 #include "Test.h" 33 34 … … 35 36 { 36 37 CreateFactory ( Test ); 38 39 SetConsoleCommand(Test, printV1, true).accessLevel(AccessLevel::User); 40 SetConsoleCommand(Test, printV2, true).accessLevel(AccessLevel::User); 41 SetConsoleCommand(Test, printV3, true).accessLevel(AccessLevel::User); 42 SetConsoleCommand(Test, printV4, true).accessLevel(AccessLevel::User); 43 44 Test* Test::instance_ = 0; 37 45 38 Test::Test(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)46 Test::Test(BaseObject* creator) : BaseObject(creator), Synchronisable(creator) 39 47 { 48 assert(instance_==0); 49 instance_=this; 40 50 RegisterObject ( Test ); 41 42 51 setConfigValues(); 52 registerVariables(); 43 53 setObjectMode(0x3); 44 54 } … … 46 56 Test::~Test() 47 57 { 48 58 instance_=0; 49 59 } 50 60 51 61 void Test::setConfigValues() 52 62 { 53 SetConfigValue ( v1, 1 ).callback ( this, &Test::checkV1 ); 54 SetConfigValue ( v2, 2 ).callback ( this, &Test::checkV2 ); 55 SetConfigValue ( v3, 3 ).callback ( this, &Test::checkV3 ); 63 SetConfigValue ( v1, 1 )/*.callback ( this, &Test::checkV1 )*/; 64 SetConfigValue ( v2, 2 )/*.callback ( this, &Test::checkV2 )*/; 65 SetConfigValue ( v3, 3 )/*.callback ( this, &Test::checkV3 )*/; 66 SetConfigValue ( v4, 4 )/*.callback ( this, &Test::checkV4 )*/; 56 67 } 57 68 … … 59 70 void Test::registerVariables() 60 71 { 61 REGISTERDATA ( v1,network::direction::toclient, new network::NetworkCallback<Test> ( this, &Test::checkV1 ) ); 62 REGISTERDATA ( v2,network::direction::toserver, new network::NetworkCallback<Test> ( this, &Test::checkV2 ) ); 63 REGISTERDATA ( v3,network::direction::bidirectional, new network::NetworkCallback<Test> ( this, &Test::checkV3 ) ); 72 REGISTERDATA ( v1,direction::toclient, new NetworkCallback<Test> ( this, &Test::checkV1 ) ); 73 REGISTERDATA ( v2,direction::toserver, new NetworkCallback<Test> ( this, &Test::checkV2 ) ); 74 REGISTERDATA ( v3,direction::serverMaster, new NetworkCallback<Test> ( this, &Test::checkV3 ) ); 75 REGISTERDATA ( v4,direction::clientMaster, new NetworkCallback<Test> ( this, &Test::checkV4 ) ); 64 76 } 65 77 66 67 68 78 void Test::checkV1(){ 79 COUT(1) << "V1 changed: " << v1 << std::endl; 80 } 69 81 70 71 72 82 void Test::checkV2(){ 83 COUT(1) << "V2 changed: " << v2 << std::endl; 84 } 73 85 74 void Test::checkV3(){ 75 COUT(1) << "V3 changed: " << v3 << std::endl; 76 } 86 void Test::checkV3(){ 87 COUT(1) << "V3 changed: " << v3 << std::endl; 88 } 89 90 void Test::checkV4(){ 91 COUT(1) << "V4 changed: " << v4 << std::endl; 92 } 77 93 78 94 -
code/trunk/src/orxonox/objects/Test.h
r2087 r2171 36 36 namespace orxonox 37 37 { 38 class _OrxonoxExport Test: public BaseObject, public network::Synchronisable38 class _OrxonoxExport Test: public BaseObject, public Synchronisable 39 39 { 40 40 public: … … 48 48 void setV2(unsigned int value){ v2 = value; } 49 49 void setV3(unsigned int value){ v3 = value; } 50 void setV4(unsigned int value){ v4 = value; } 50 51 51 52 void checkV1(); 52 53 void checkV2(); 53 54 void checkV3(); 55 void checkV4(); 56 57 void printV1(){ instance_->checkV1(); } 58 void printV2(){ instance_->checkV2(); } 59 void printV3(){ instance_->checkV3(); } 60 void printV4(){ instance_->checkV4(); } 54 61 55 62 private: … … 57 64 unsigned int v2; 58 65 unsigned int v3; 66 unsigned int v4; 67 68 static Test* instance_; 59 69 }; 60 70 } -
code/trunk/src/orxonox/objects/Tickable.h
r1790 r2171 28 28 29 29 /*! 30 @file Tickable.h30 @file 31 31 @brief Declaration of the Tickable interface. 32 32 -
code/trunk/src/orxonox/objects/gametypes/Gametype.cc
r2087 r2171 67 67 if (!this->bStarted_) 68 68 this->checkStart(); 69 else 70 this->spawnDeadPlayersIfRequested(); 69 71 70 72 this->assignDefaultPawnsIfNeeded(); 71 this->spawnDeadPlayersIfRequested();72 73 } 73 74 … … 88 89 void Gametype::playerEntered(PlayerInfo* player) 89 90 { 90 this->players_ .insert(player);91 this->players_[player] = PlayerState::Joined; 91 92 92 93 std::string message = player->getName() + " entered the game"; 93 94 COUT(0) << message << std::endl; 94 network::Host::Broadcast(message);95 Host::Broadcast(message); 95 96 } 96 97 97 98 void Gametype::playerLeft(PlayerInfo* player) 98 99 { 99 std:: set<PlayerInfo*>::iterator it = this->players_.find(player);100 std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.find(player); 100 101 if (it != this->players_.end()) 101 102 { … … 104 105 std::string message = player->getName() + " left the game"; 105 106 COUT(0) << message << std::endl; 106 network::Host::Broadcast(message);107 Host::Broadcast(message); 107 108 } 108 109 } … … 124 125 std::string message = player->getOldName() + " changed name to " + player->getName(); 125 126 COUT(0) << message << std::endl; 126 network::Host::Broadcast(message);127 Host::Broadcast(message); 127 128 } 128 129 } … … 165 166 } 166 167 167 void Gametype::assignDefaultPawnsIfNeeded() const168 { 169 for (std:: set<PlayerInfo*>::const_iterator it = this->players_.begin(); it != this->players_.end(); ++it)170 { 171 if (! (*it)->getControllableEntity() && (!(*it)->isReadyToSpawn() || !this->bStarted_))172 { 173 SpawnPoint* spawn = this->getBestSpawnPoint( *it);168 void Gametype::assignDefaultPawnsIfNeeded() 169 { 170 for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 171 { 172 if (!it->first->getControllableEntity() && (!it->first->isReadyToSpawn() || !this->bStarted_)) 173 { 174 SpawnPoint* spawn = this->getBestSpawnPoint(it->first); 174 175 if (spawn) 175 176 { … … 177 178 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn); 178 179 spawn->spawn(entity); 179 (*it)->startControl(entity); 180 it->first->startControl(entity); 181 it->second = PlayerState::Dead; 180 182 } 181 183 else … … 210 212 { 211 213 bool allplayersready = true; 212 for (std:: set<PlayerInfo*>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)214 for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 213 215 { 214 if (! (*it)->isReadyToSpawn())216 if (!it->first->isReadyToSpawn()) 215 217 allplayersready = false; 216 218 } … … 227 229 void Gametype::spawnPlayersIfRequested() 228 230 { 229 for (std:: set<PlayerInfo*>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)230 if ( (*it)->isReadyToSpawn() || this->bForceSpawn_)231 this->spawnPlayer( *it);231 for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 232 if (it->first->isReadyToSpawn() || this->bForceSpawn_) 233 this->spawnPlayer(it->first); 232 234 } 233 235 234 236 void Gametype::spawnDeadPlayersIfRequested() 235 237 { 236 for (std:: set<PlayerInfo*>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)237 if ( !(*it)->getControllableEntity())238 if ( (*it)->isReadyToSpawn() || this->bForceSpawn_)239 this->spawnPlayer( *it);238 for (std::map<PlayerInfo*, PlayerState::Enum>::iterator it = this->players_.begin(); it != this->players_.end(); ++it) 239 if (it->second == PlayerState::Dead) 240 if (it->first->isReadyToSpawn() || this->bForceSpawn_) 241 this->spawnPlayer(it->first); 240 242 } 241 243 … … 246 248 { 247 249 player->startControl(spawnpoint->spawn()); 250 this->players_[player] = PlayerState::Alive; 248 251 } 249 252 else -
code/trunk/src/orxonox/objects/gametypes/Gametype.h
r2087 r2171 41 41 namespace orxonox 42 42 { 43 namespace PlayerState 44 { 45 enum Enum 46 { 47 Uninitialized, 48 Joined, 49 Alive, 50 Dead 51 }; 52 } 53 43 54 class _OrxonoxExport Gametype : public BaseObject, public Tickable 44 55 { … … 70 81 virtual void pawnPostSpawn(Pawn* pawn); 71 82 72 inline const std:: set<PlayerInfo*>& getPlayers() const83 inline const std::map<PlayerInfo*, PlayerState::Enum>& getPlayers() const 73 84 { return this->players_; } 74 85 … … 87 98 void removePlayer(PlayerInfo* player); 88 99 89 void assignDefaultPawnsIfNeeded() const;100 void assignDefaultPawnsIfNeeded(); 90 101 void checkStart(); 91 102 void spawnPlayer(PlayerInfo* player); … … 102 113 bool bStartCountdownRunning_; 103 114 104 std:: set<PlayerInfo*> players_;115 std::map<PlayerInfo*, PlayerState::Enum> players_; 105 116 std::set<SpawnPoint*> spawnpoints_; 106 117 SubclassIdentifier<ControllableEntity> defaultControllableEntity_; -
code/trunk/src/orxonox/objects/infos/CMakeLists.txt
r2131 r2171 1 1 SET( SRC_FILES 2 2 Info.cc 3 Level.cc4 3 PlayerInfo.cc 5 4 HumanPlayer.cc -
code/trunk/src/orxonox/objects/infos/HumanPlayer.cc
r2087 r2171 46 46 RegisterObject(HumanPlayer); 47 47 48 this->server_ ready_ = Core::isMaster();49 this->client_ ready_ = false;48 this->server_initialized_ = Core::isMaster(); 49 this->client_initialized_ = false; 50 50 51 51 this->bHumanPlayer_ = true; … … 67 67 void HumanPlayer::registerVariables() 68 68 { 69 REGISTERSTRING(this->synchronize_nick_, network::direction::toserver, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));69 REGISTERSTRING(this->synchronize_nick_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick)); 70 70 71 REGISTERDATA(this->clientID_, network::direction::toclient, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));72 REGISTERDATA(this->server_ ready_, network::direction::toclient, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_ready));73 REGISTERDATA(this->client_ ready_, network::direction::toserver, new network::NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_ready));71 REGISTERDATA(this->clientID_, direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged)); 72 REGISTERDATA(this->server_initialized_, direction::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_initialized)); 73 REGISTERDATA(this->client_initialized_, direction::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_initialized)); 74 74 } 75 75 … … 92 92 void HumanPlayer::networkcallback_clientIDchanged() 93 93 { 94 if (this->clientID_ == network::Host::getPlayerID())94 if (this->clientID_ == Host::getPlayerID()) 95 95 { 96 96 this->bLocalPlayer_ = true; 97 97 this->synchronize_nick_ = this->nick_; 98 this->client_ ready_ = true;98 this->client_initialized_ = true; 99 99 100 100 if (!Core::isMaster()) 101 this->setObjectMode( network::direction::bidirectional);101 this->setObjectMode(direction::bidirectional); 102 102 else 103 103 this->setName(this->nick_); … … 107 107 } 108 108 109 void HumanPlayer::networkcallback_server_ ready()109 void HumanPlayer::networkcallback_server_initialized() 110 110 { 111 this->client_ ready_ = true;111 this->client_initialized_ = true; 112 112 } 113 113 114 void HumanPlayer::networkcallback_client_ ready()114 void HumanPlayer::networkcallback_client_initialized() 115 115 { 116 116 if (this->getGametype()) … … 118 118 } 119 119 120 bool HumanPlayer::is Ready() const120 bool HumanPlayer::isInitialized() const 121 121 { 122 return (this->server_ ready_ && this->client_ready_);122 return (this->server_initialized_ && this->client_initialized_); 123 123 } 124 124 125 125 float HumanPlayer::getPing() const 126 126 { 127 return network::ClientInformation::findClient(this->getClientID())->getRTT();127 return ClientInformation::findClient(this->getClientID())->getRTT(); 128 128 } 129 129 130 130 float HumanPlayer::getPacketLossRatio() const 131 131 { 132 return network::ClientInformation::findClient(this->getClientID())->getPacketLoss();132 return ClientInformation::findClient(this->getClientID())->getPacketLoss(); 133 133 } 134 134 -
code/trunk/src/orxonox/objects/infos/HumanPlayer.h
r2087 r2171 47 47 void setConfigValues(); 48 48 49 bool is Ready() const;49 bool isInitialized() const; 50 50 float getPing() const; 51 51 float getPacketLossRatio() const; … … 57 57 void networkcallback_changednick(); 58 58 void networkcallback_clientIDchanged(); 59 void networkcallback_server_ ready();60 void networkcallback_client_ ready();59 void networkcallback_server_initialized(); 60 void networkcallback_client_initialized(); 61 61 62 62 std::string nick_; 63 63 std::string synchronize_nick_; 64 bool server_ ready_;65 bool client_ ready_;64 bool server_initialized_; 65 bool client_initialized_; 66 66 }; 67 67 } -
code/trunk/src/orxonox/objects/infos/Info.cc
r2087 r2171 34 34 namespace orxonox 35 35 { 36 Info::Info(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)36 Info::Info(BaseObject* creator) : BaseObject(creator), Synchronisable(creator) 37 37 { 38 38 RegisterObject(Info); -
code/trunk/src/orxonox/objects/infos/Info.h
r2087 r2171 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport Info : public BaseObject, public network::Synchronisable39 class _OrxonoxExport Info : public BaseObject, public Synchronisable 40 40 { 41 41 public: -
code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
r2087 r2171 42 42 RegisterObject(PlayerInfo); 43 43 44 this->clientID_ = network::CLIENTID_UNKNOWN;44 this->clientID_ = CLIENTID_UNKNOWN; 45 45 this->bHumanPlayer_ = false; 46 46 this->bLocalPlayer_ = false; … … 48 48 this->controller_ = 0; 49 49 this->controllableEntity_ = 0; 50 this->controllableEntityID_ = network::CLIENTID_UNKNOWN;50 this->controllableEntityID_ = CLIENTID_UNKNOWN; 51 51 52 52 this->registerVariables(); … … 55 55 PlayerInfo::~PlayerInfo() 56 56 { 57 if (this-> isInitialized())57 if (this->BaseObject::isInitialized()) 58 58 { 59 59 this->stopControl(this->controllableEntity_); … … 69 69 void PlayerInfo::registerVariables() 70 70 { 71 REGISTERSTRING(this->name_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));72 REGISTERDATA (this->controllableEntityID_, network::direction::toclient, new network::NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));73 REGISTERDATA (this->bReadyToSpawn_, network::direction::toserver);71 REGISTERSTRING(this->name_, direction::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName)); 72 REGISTERDATA (this->controllableEntityID_, direction::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID)); 73 REGISTERDATA (this->bReadyToSpawn_, direction::toserver); 74 74 } 75 75 76 76 void PlayerInfo::changedName() 77 77 { 78 if (this->is Ready() && this->getGametype())78 if (this->isInitialized() && this->getGametype()) 79 79 this->getGametype()->playerChangedName(this); 80 80 } … … 82 82 void PlayerInfo::changedGametype() 83 83 { 84 if (this->is Ready())84 if (this->isInitialized()) 85 85 { 86 86 if (this->getOldGametype()) … … 126 126 else 127 127 { 128 this->controllableEntityID_ = network::OBJECTID_UNKNOWN;128 this->controllableEntityID_ = OBJECTID_UNKNOWN; 129 129 } 130 130 … … 138 138 { 139 139 this->controllableEntity_ = 0; 140 this->controllableEntityID_ = network::OBJECTID_UNKNOWN;140 this->controllableEntityID_ = OBJECTID_UNKNOWN; 141 141 142 142 if (this->controller_) … … 150 150 void PlayerInfo::networkcallback_changedcontrollableentityID() 151 151 { 152 if (this->controllableEntityID_ != network::OBJECTID_UNKNOWN)152 if (this->controllableEntityID_ != OBJECTID_UNKNOWN) 153 153 { 154 154 Synchronisable* temp = Synchronisable::getSynchronisable(this->controllableEntityID_); -
code/trunk/src/orxonox/objects/infos/PlayerInfo.h
r2087 r2171 55 55 inline unsigned int getClientID() const 56 56 { return this->clientID_; } 57 inline bool isReadyToSpawn() const58 { return this->bReadyToSpawn_; }59 57 60 virtual bool is Ready() const = 0;58 virtual bool isInitialized() const = 0; 61 59 virtual float getPing() const = 0; 62 60 virtual float getPacketLossRatio() const = 0; … … 64 62 inline void setReadyToSpawn(bool bReady) 65 63 { this->bReadyToSpawn_ = bReady; } 64 inline bool isReadyToSpawn() const 65 { return this->bReadyToSpawn_; } 66 66 67 67 void startControl(ControllableEntity* entity); -
code/trunk/src/orxonox/objects/weaponSystem/WeaponSystem.h
- Property svn:mergeinfo changed
/code/branches/objecthierarchy/src/orxonox/objects/weaponSystem/WeaponSystem.h (added) merged: 2110-2169
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/worldentities/Backlight.cc
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/orxonox/objects/worldentities/Backlight.h
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/orxonox/objects/worldentities/Billboard.cc
r2087 r2171 64 64 void Billboard::registerVariables() 65 65 { 66 REGISTERSTRING(this->material_, network::direction::toclient, new network::NetworkCallback<Billboard>(this, &Billboard::changedMaterial));67 REGISTERDATA (this->colour_, network::direction::toclient, new network::NetworkCallback<Billboard>(this, &Billboard::changedColour));66 REGISTERSTRING(this->material_, direction::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial)); 67 REGISTERDATA (this->colour_, direction::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedColour)); 68 68 } 69 69 … … 75 75 { 76 76 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1); 77 this->getNode()->attachObject(this->billboard_.getBillboardSet()); 77 if (this->billboard_.getBillboardSet()) 78 this->getNode()->attachObject(this->billboard_.getBillboardSet()); 78 79 this->billboard_.setVisible(this->isVisible()); 79 80 } … … 90 91 { 91 92 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1); 92 this->getNode()->attachObject(this->billboard_.getBillboardSet()); 93 if (this->billboard_.getBillboardSet()) 94 this->getNode()->attachObject(this->billboard_.getBillboardSet()); 93 95 this->billboard_.setVisible(this->isVisible()); 94 96 } -
code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc
r2087 r2171 68 68 void BlinkingBillboard::registerVariables() 69 69 { 70 // REGISTERDATA(this->amplitude_, network::direction::toclient);71 // REGISTERDATA(this->frequency_, network::direction::toclient);72 // REGISTERDATA(this->phase_, network::direction::toclient);70 // REGISTERDATA(this->amplitude_, direction::toclient); 71 // REGISTERDATA(this->frequency_, direction::toclient); 72 // REGISTERDATA(this->phase_, direction::toclient); 73 73 } 74 74 -
code/trunk/src/orxonox/objects/worldentities/Camera.cc
- Property svn:mergeinfo changed
/code/branches/objecthierarchy/src/orxonox/objects/worldentities/Camera.cc merged: 2161-2162
r2103 r2171 38 38 #include <OgreViewport.h> 39 39 40 #include "util/Exception.h" 40 41 #include "core/CoreIncludes.h" 41 42 #include "core/ConfigValueIncludes.h" … … 51 52 RegisterObject(Camera); 52 53 53 assert(this->getScene());54 assert(this->getScene()->getSceneManager());54 if (!this->getScene() || !this->getScene()->getSceneManager()) 55 ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given."); 55 56 56 57 this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString()); - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/worldentities/Camera.h
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
r2087 r2171 52 52 this->client_overwrite_ = 0; 53 53 this->player_ = 0; 54 this->playerID_ = network::OBJECTID_UNKNOWN;54 this->playerID_ = OBJECTID_UNKNOWN; 55 55 this->hud_ = 0; 56 56 this->camera_ = 0; … … 165 165 this->client_overwrite_ = this->server_overwrite_; 166 166 COUT(0) << "CE: bidirectional synchronization" << std::endl; 167 this->setObjectMode( network::direction::bidirectional);167 this->setObjectMode(direction::bidirectional); 168 168 } 169 169 } … … 176 176 177 177 this->player_ = 0; 178 this->playerID_ = network::OBJECTID_UNKNOWN;178 this->playerID_ = OBJECTID_UNKNOWN; 179 179 this->bControlled_ = false; 180 this->setObjectMode( network::direction::toclient);180 this->setObjectMode(direction::toclient); 181 181 182 182 if (this->bDestroyWhenPlayerLeft_) … … 187 187 { 188 188 // just do this in case the entity wasn't yet synchronized when the corresponding PlayerInfo got our objectID 189 if (this->playerID_ != network::OBJECTID_UNKNOWN)190 { 191 this->player_ = dynamic_cast<PlayerInfo*>( network::Synchronisable::getSynchronisable(this->playerID_));189 if (this->playerID_ != OBJECTID_UNKNOWN) 190 { 191 this->player_ = dynamic_cast<PlayerInfo*>(Synchronisable::getSynchronisable(this->playerID_)); 192 192 if (this->player_ && (this->player_->getControllableEntity() != this)) 193 193 this->player_->startControl(this); … … 248 248 void ControllableEntity::registerVariables() 249 249 { 250 REGISTERSTRING(this->cameraPositionTemplate_, network::direction::toclient);251 252 REGISTERDATA(this-> server_position_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));253 REGISTERDATA(this->server_velocity_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerVelocity));254 REGISTERDATA(this->server_ orientation_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));255 256 REGISTERDATA(this->server_o verwrite_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));257 REGISTERDATA(this-> client_overwrite_, network::direction::toserver);258 259 REGISTERDATA(this->client_position_, network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));260 REGISTERDATA(this->client_velocity_, network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientVelocity));261 REGISTERDATA(this->client_orientation_, network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));262 263 264 REGISTERDATA(this->playerID_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));250 REGISTERSTRING(this->cameraPositionTemplate_, direction::toclient); 251 252 REGISTERDATA(this->client_overwrite_, direction::toserver); 253 254 REGISTERDATA(this->server_position_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition)); 255 REGISTERDATA(this->server_velocity_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerVelocity)); 256 REGISTERDATA(this->server_orientation_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation)); 257 REGISTERDATA(this->server_overwrite_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite)); 258 259 REGISTERDATA(this->client_position_, direction::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition)); 260 REGISTERDATA(this->client_velocity_, direction::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientVelocity)); 261 REGISTERDATA(this->client_orientation_, direction::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation)); 262 263 264 REGISTERDATA(this->playerID_, direction::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID)); 265 265 } 266 266 -
code/trunk/src/orxonox/objects/worldentities/Light.cc
r2087 r2171 79 79 void Light::registerVariables() 80 80 { 81 REGISTERDATA(this->type_, network::direction::toclient, new network::NetworkCallback<Light>(this, &Light::changedType));82 REGISTERDATA(this->light_->getDiffuseColour(), network::direction::toclient);83 REGISTERDATA(this->light_->getSpecularColour(), network::direction::toclient);84 REGISTERDATA(this->light_->getDirection(), network::direction::toclient);81 REGISTERDATA(this->type_, direction::toclient, new NetworkCallback<Light>(this, &Light::changedType)); 82 REGISTERDATA(this->light_->getDiffuseColour(), direction::toclient); 83 REGISTERDATA(this->light_->getSpecularColour(), direction::toclient); 84 REGISTERDATA(this->light_->getDirection(), direction::toclient); 85 85 } 86 86 -
code/trunk/src/orxonox/objects/worldentities/Model.cc
r2087 r2171 61 61 void Model::registerVariables() 62 62 { 63 REGISTERSTRING(this->meshSrc_, network::direction::toclient, new network::NetworkCallback<Model>(this, &Model::changedMesh));64 REGISTERDATA(this->bCastShadows_, network::direction::toclient, new network::NetworkCallback<Model>(this, &Model::changedShadows));63 REGISTERSTRING(this->meshSrc_, direction::toclient, new NetworkCallback<Model>(this, &Model::changedMesh)); 64 REGISTERDATA(this->bCastShadows_, direction::toclient, new NetworkCallback<Model>(this, &Model::changedShadows)); 65 65 } 66 66 -
code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc
r2087 r2171 84 84 void MovableEntity::registerVariables() 85 85 { 86 REGISTERDATA(this->velocity_.x, network::direction::toclient);87 REGISTERDATA(this->velocity_.y, network::direction::toclient);88 REGISTERDATA(this->velocity_.z, network::direction::toclient);86 REGISTERDATA(this->velocity_.x, direction::toclient); 87 REGISTERDATA(this->velocity_.y, direction::toclient); 88 REGISTERDATA(this->velocity_.z, direction::toclient); 89 89 90 REGISTERDATA(this->rotationAxis_.x, network::direction::toclient);91 REGISTERDATA(this->rotationAxis_.y, network::direction::toclient);92 REGISTERDATA(this->rotationAxis_.z, network::direction::toclient);90 REGISTERDATA(this->rotationAxis_.x, direction::toclient); 91 REGISTERDATA(this->rotationAxis_.y, direction::toclient); 92 REGISTERDATA(this->rotationAxis_.z, direction::toclient); 93 93 94 REGISTERDATA(this->rotationRate_, network::direction::toclient);94 REGISTERDATA(this->rotationRate_, direction::toclient); 95 95 96 REGISTERDATA(this->overwrite_position_, network::direction::toclient, new network::NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition));97 REGISTERDATA(this->overwrite_orientation_, network::direction::toclient, new network::NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation));96 REGISTERDATA(this->overwrite_position_, direction::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition)); 97 REGISTERDATA(this->overwrite_orientation_, direction::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation)); 98 98 } 99 99 -
code/trunk/src/orxonox/objects/worldentities/MovableEntity.h
r2087 r2171 38 38 namespace orxonox 39 39 { 40 class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable, public network::ClientConnectionListener40 class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable, public ClientConnectionListener 41 41 { 42 42 public: -
code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc
r2087 r2171 28 28 29 29 /** 30 * @file ParticleInterface.cc30 * @file 31 31 * @brief class to control praticle effects 32 32 */ … … 37 37 38 38 #include "tools/ParticleInterface.h" 39 #include "util/Exception.h" 39 40 #include "core/CoreIncludes.h" 40 41 #include "core/XMLPort.h" … … 49 50 RegisterObject(ParticleEmitter); 50 51 51 assert(this->getScene());52 assert(this->getScene()->getSceneManager());52 if (!this->getScene() || !this->getScene()->getSceneManager()) 53 ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given."); 53 54 54 55 this->particles_ = 0; … … 74 75 void ParticleEmitter::registerVariables() 75 76 { 76 REGISTERSTRING(this->source_, network::direction::toclient, new network::NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));77 REGISTERDATA (this->LOD_, network::direction::toclient, new network::NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));77 REGISTERSTRING(this->source_, direction::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged)); 78 REGISTERDATA (this->LOD_, direction::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged)); 78 79 } 79 80 -
code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.cc
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.h
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/orxonox/objects/worldentities/PositionableEntity.cc
r2087 r2171 48 48 void PositionableEntity::registerVariables() 49 49 { 50 REGISTERDATA(this->getPosition().x, network::direction::toclient);51 REGISTERDATA(this->getPosition().y, network::direction::toclient);52 REGISTERDATA(this->getPosition().z, network::direction::toclient);50 REGISTERDATA(this->getPosition().x, direction::toclient); 51 REGISTERDATA(this->getPosition().y, direction::toclient); 52 REGISTERDATA(this->getPosition().z, direction::toclient); 53 53 54 REGISTERDATA(this->getOrientation().w, network::direction::toclient);55 REGISTERDATA(this->getOrientation().x, network::direction::toclient);56 REGISTERDATA(this->getOrientation().y, network::direction::toclient);57 REGISTERDATA(this->getOrientation().z, network::direction::toclient);54 REGISTERDATA(this->getOrientation().w, direction::toclient); 55 REGISTERDATA(this->getOrientation().x, direction::toclient); 56 REGISTERDATA(this->getOrientation().y, direction::toclient); 57 REGISTERDATA(this->getOrientation().z, direction::toclient); 58 58 } 59 59 } -
code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc
r2087 r2171 36 36 #include "core/XMLPort.h" 37 37 #include "util/Convert.h" 38 #include "util/Exception.h" 38 39 39 40 #include "objects/Scene.h" … … 48 49 const Vector3 WorldEntity::UP = Vector3::UNIT_Y; 49 50 50 WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator)51 WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator), Synchronisable(creator) 51 52 { 52 53 RegisterObject(WorldEntity); 53 54 54 assert(this->getScene());55 assert(this->getScene()->getRootSceneNode());55 if (!this->getScene() || !this->getScene()->getRootSceneNode()) 56 ThrowException(AbortLoading, "Can't create WorldEntity, no scene or no root-scenenode given."); 56 57 57 58 this->node_ = this->getScene()->getRootSceneNode()->createChildSceneNode(); 58 59 59 60 this->parent_ = 0; 60 this->parentID_ = (unsigned int)-1;61 this->parentID_ = OBJECTID_UNKNOWN; 61 62 62 63 this->node_->setPosition(Vector3::ZERO); … … 95 96 void WorldEntity::registerVariables() 96 97 { 97 REGISTERDATA(this->bActive_, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));98 REGISTERDATA(this->bVisible_, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));98 REGISTERDATA(this->bActive_, direction::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity)); 99 REGISTERDATA(this->bVisible_, direction::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility)); 99 100 100 REGISTERDATA(this->getScale3D().x, network::direction::toclient);101 REGISTERDATA(this->getScale3D().y, network::direction::toclient);102 REGISTERDATA(this->getScale3D().z, network::direction::toclient);101 REGISTERDATA(this->getScale3D().x, direction::toclient); 102 REGISTERDATA(this->getScale3D().y, direction::toclient); 103 REGISTERDATA(this->getScale3D().z, direction::toclient); 103 104 104 REGISTERDATA(this->parentID_, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::updateParent));105 REGISTERDATA(this->parentID_, direction::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::updateParent)); 105 106 } 106 107 107 108 void WorldEntity::updateParent() 108 109 { 109 WorldEntity* parent = dynamic_cast<WorldEntity*>(Synchronisable::getSynchronisable(this->parentID_)); 110 if (parent) 111 this->attachToParent(parent); 110 if (this->parentID_ != OBJECTID_UNKNOWN) 111 { 112 WorldEntity* parent = dynamic_cast<WorldEntity*>(Synchronisable::getSynchronisable(this->parentID_)); 113 if (parent) 114 this->attachToParent(parent); 115 } 112 116 } 113 117 … … 134 138 this->children_.erase(object); 135 139 object->parent_ = 0; 136 object->parentID_ = (unsigned int)-1;140 object->parentID_ = OBJECTID_UNKNOWN; 137 141 138 142 // this->getScene()->getRootSceneNode()->addChild(object->node_); -
code/trunk/src/orxonox/objects/worldentities/WorldEntity.h
r2087 r2171 42 42 namespace orxonox 43 43 { 44 class _OrxonoxExport WorldEntity : public BaseObject, public network::Synchronisable44 class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable 45 45 { 46 46 public: -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2106 r2171 80 80 void Pawn::registerVariables() 81 81 { 82 REGISTERDATA(this->bAlive_, network::direction::toclient);83 REGISTERDATA(this->health_, network::direction::toclient);82 REGISTERDATA(this->bAlive_, direction::toclient); 83 REGISTERDATA(this->health_, direction::toclient); 84 84 } 85 85 -
code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
r2087 r2171 82 82 void SpaceShip::registerVariables() 83 83 { 84 REGISTERDATA(this->maxSpeed_, network::direction::toclient);85 REGISTERDATA(this->maxSecondarySpeed_, network::direction::toclient);86 REGISTERDATA(this->maxRotation_, network::direction::toclient);87 REGISTERDATA(this->translationAcceleration_, network::direction::toclient);88 REGISTERDATA(this->rotationAcceleration_, network::direction::toclient);89 REGISTERDATA(this->translationDamping_, network::direction::toclient);84 REGISTERDATA(this->maxSpeed_, direction::toclient); 85 REGISTERDATA(this->maxSecondarySpeed_, direction::toclient); 86 REGISTERDATA(this->maxRotation_, direction::toclient); 87 REGISTERDATA(this->translationAcceleration_, direction::toclient); 88 REGISTERDATA(this->rotationAcceleration_, direction::toclient); 89 REGISTERDATA(this->translationDamping_, direction::toclient); 90 90 } 91 91 -
code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc
r2087 r2171 62 62 this->greetingFlare_ = new BillboardSet(); 63 63 this->greetingFlare_->setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 20, 0), 1); 64 this->getNode()->attachObject(this->greetingFlare_->getBillboardSet()); 64 if (this->greetingFlare_->getBillboardSet()) 65 this->getNode()->attachObject(this->greetingFlare_->getBillboardSet()); 65 66 this->greetingFlare_->setVisible(false); 66 67 this->bGreetingFlareVisible_ = false; … … 76 77 if (this->greetingFlare_) 77 78 { 78 this->getNode()->detachObject(this->greetingFlare_->getBillboardSet()); 79 if (this->greetingFlare_->getBillboardSet()) 80 this->getNode()->detachObject(this->greetingFlare_->getBillboardSet()); 79 81 delete this->greetingFlare_; 80 82 } … … 84 86 void Spectator::registerVariables() 85 87 { 86 REGISTERDATA(this->bGreetingFlareVisible_, network::direction::toclient, new network::NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility));87 REGISTERDATA(this->bGreeting_, network::direction::toserver, new network::NetworkCallback<Spectator>(this, &Spectator::changedGreeting));88 REGISTERDATA(this->hudmode_, network::direction::toclient);88 REGISTERDATA(this->bGreetingFlareVisible_, direction::toclient, new NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility)); 89 REGISTERDATA(this->bGreeting_, direction::toserver, new NetworkCallback<Spectator>(this, &Spectator::changedGreeting)); 90 REGISTERDATA(this->hudmode_, direction::toclient); 89 91 } 90 92 … … 129 131 ControllableEntity::setPlayer(player); 130 132 131 // this->setObjectMode( network::direction::toclient);133 // this->setObjectMode(direction::toclient); 132 134 } 133 135 … … 203 205 { 204 206 if (this->getGametype()->isStartCountdownRunning()) 205 this->hudmode_ = 2 + 10* ceil(this->getGametype()->getStartCountdown());207 this->hudmode_ = 2 + 10*(int)ceil(this->getGametype()->getStartCountdown()); 206 208 else 207 209 this->hudmode_ = 3; -
code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc
- Property svn:mergeinfo changed
/code/branches/objecthierarchy/src/orxonox/objects/worldentities/triggers/Trigger.cc merged: 2161
r2103 r2171 69 69 this->debugBillboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1); 70 70 this->debugBillboard_.setVisible(false); 71 } 72 73 this->getNode()->attachObject(this->debugBillboard_.getBillboardSet()); 71 72 if (this->debugBillboard_.getBillboardSet()) 73 this->getNode()->attachObject(this->debugBillboard_.getBillboardSet()); 74 } 75 74 76 this->setObjectMode(0x0); 75 77 } … … 310 312 void Trigger::setBillboardColour(const ColourValue& colour) 311 313 { 312 this->debugBillboard_. getBillboardSet()->getBillboard(0)->setColour(colour);314 this->debugBillboard_.setColour(colour); 313 315 } 314 316 - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
r2087 r2171 40 40 #include <OgrePanelOverlayElement.h> 41 41 #include "util/Convert.h" 42 #include "util/Exception.h" 42 43 #include "util/String.h" 44 #include "core/Core.h" 43 45 #include "core/CoreIncludes.h" 44 46 #include "core/XMLPort.h" … … 58 60 { 59 61 RegisterObject(OrxonoxOverlay); 62 63 if (!Core::showsGraphics()) 64 ThrowException(NoGraphics, "Can't create OrxonoxOverlay, graphics engine not initialized"); 60 65 61 66 // add this overlay to the static map of OrxonoxOverlays -
code/trunk/src/orxonox/overlays/hud/ChatOverlay.cc
r2087 r2171 38 38 #include "network/ClientInformation.h" 39 39 40 #include " LevelManager.h"40 #include "PlayerManager.h" 41 41 #include "objects/infos/PlayerInfo.h" 42 42 #include "overlays/console/InGameConsole.h" … … 72 72 std::string text; 73 73 74 if (senderID != network::CLIENTID_UNKNOWN)74 if (senderID != CLIENTID_UNKNOWN) 75 75 { 76 76 std::string name = "unknown"; 77 77 78 PlayerInfo* player = LevelManager::getInstance().getClient(senderID);78 PlayerInfo* player = PlayerManager::getInstance().getClient(senderID); 79 79 if (player) 80 80 name = player->getName(); -
code/trunk/src/orxonox/overlays/hud/ChatOverlay.h
r2087 r2171 39 39 namespace orxonox 40 40 { 41 class _OrxonoxExport ChatOverlay : public OverlayText, public network::ChatListener41 class _OrxonoxExport ChatOverlay : public OverlayText, public ChatListener 42 42 { 43 43 public: -
code/trunk/src/orxonox/tools/BillboardSet.cc
r2087 r2171 36 36 #include <OgreBillboard.h> 37 37 38 #include "core/Core.h" 38 39 #include "util/Convert.h" 39 40 #include "util/String.h" … … 70 71 try 71 72 { 72 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count); 73 this->billboardSet_->createBillboard(position); 74 this->billboardSet_->setMaterialName(file); 73 if (Core::showsGraphics()) 74 { 75 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count); 76 this->billboardSet_->createBillboard(position); 77 this->billboardSet_->setMaterialName(file); 78 } 75 79 } 76 80 catch (...) 77 81 { 78 82 COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl; 83 this->billboardSet_ = 0; 79 84 } 80 85 … … 89 94 try 90 95 { 91 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count); 92 this->billboardSet_->createBillboard(position, colour); 93 this->billboardSet_->setMaterialName(file); 96 if (Core::showsGraphics()) 97 { 98 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count); 99 this->billboardSet_->createBillboard(position, colour); 100 this->billboardSet_->setMaterialName(file); 101 } 94 102 } 95 103 catch (...) 96 104 { 97 105 COUT(1) << "Error: Couln't load billboard \"" << file << "\"" << std::endl; 106 this->billboardSet_ = 0; 98 107 } 99 108 … … 105 114 if (this->billboardSet_ && this->scenemanager_) 106 115 this->scenemanager_->destroyBillboardSet(this->billboardSet_); 116 this->billboardSet_ = 0; 107 117 } 108 118 -
code/trunk/src/orxonox/tools/Mesh.cc
r2087 r2171 73 73 { 74 74 COUT(1) << "Error: Couln't load mesh \"" << meshsource << "\"" << std::endl; 75 this->entity_ = 0; 75 76 } 76 77 } -
code/trunk/src/orxonox/tools/ParticleInterface.cc
r2087 r2171 28 28 29 29 /** 30 * @file ParticleInterface.cc30 * @file 31 31 * @brief class to control praticle effects 32 32 */ … … 41 41 42 42 #include "GraphicsEngine.h" 43 #include "core/Core.h" 43 44 #include "core/CoreIncludes.h" 44 45 #include "util/Convert.h" … … 57 58 this->scenemanager_ = scenemanager; 58 59 this->sceneNode_ = 0; 60 this->particleSystem_ = 0; 59 61 60 62 this->bEnabled_ = true; … … 62 64 this->bAllowedByLOD_ = true; 63 65 64 this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 65 this->particleSystem_->setSpeedFactor(1.0f); 66 //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor()); 66 if (Core::showsGraphics()) 67 { 68 try 69 { 70 this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 71 this->particleSystem_->setSpeedFactor(1.0f); 72 // this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor()); 73 } 74 catch (...) 75 { 76 COUT(1) << "Error: Couln't load particle system \"" << templateName << "\"" << std::endl; 77 this->particleSystem_ = 0; 78 } 79 } 67 80 68 81 this->setDetailLevel((unsigned int)detaillevel); … … 71 84 ParticleInterface::~ParticleInterface() 72 85 { 73 this->particleSystem_->removeAllEmitters(); 74 this->detachFromSceneNode(); 75 this->scenemanager_->destroyParticleSystem(particleSystem_); 86 if (this->particleSystem_) 87 { 88 this->particleSystem_->removeAllEmitters(); 89 this->detachFromSceneNode(); 90 this->scenemanager_->destroyParticleSystem(this->particleSystem_); 91 } 76 92 } 77 93 … … 81 97 this->detachFromSceneNode(); 82 98 83 this->sceneNode_ = sceneNode; 84 this->sceneNode_->attachObject(this->particleSystem_); 99 if (this->particleSystem_) 100 { 101 this->sceneNode_ = sceneNode; 102 this->sceneNode_->attachObject(this->particleSystem_); 103 } 85 104 } 86 105 … … 89 108 if (this->sceneNode_) 90 109 { 91 this->sceneNode_->detachObject(this->particleSystem_); 110 if (this->particleSystem_) 111 this->sceneNode_->detachObject(this->particleSystem_); 92 112 this->sceneNode_ = 0; 93 113 } … … 96 116 Ogre::ParticleEmitter* ParticleInterface::createNewEmitter() 97 117 { 98 if (this->particleSystem_ ->getNumEmitters() > 0)118 if (this->particleSystem_ && this->particleSystem_->getNumEmitters() > 0) 99 119 { 100 120 Ogre::ParticleEmitter* newemitter = this->particleSystem_->addEmitter(this->particleSystem_->getEmitter(0)->getType()); … … 107 127 Ogre::ParticleEmitter* ParticleInterface::getEmitter(unsigned int emitterNr) const 108 128 { 109 if ( emitterNr < this->particleSystem_->getNumEmitters())129 if (this->particleSystem_ && (emitterNr < this->particleSystem_->getNumEmitters())) 110 130 return this->particleSystem_->getEmitter(emitterNr); 111 131 else … … 114 134 void ParticleInterface::removeEmitter(unsigned int emitterNr) 115 135 { 116 if ( emitterNr < this->particleSystem_->getNumEmitters())136 if (this->particleSystem_ && (emitterNr < this->particleSystem_->getNumEmitters())) 117 137 this->particleSystem_->removeEmitter(emitterNr); 118 138 } 119 139 void ParticleInterface::removeAllEmitters() 120 140 { 121 this->particleSystem_->removeAllEmitters(); 141 if (this->particleSystem_) 142 this->particleSystem_->removeAllEmitters(); 122 143 } 123 144 unsigned int ParticleInterface::getNumEmitters() const 124 145 { 125 return this->particleSystem_->getNumEmitters(); 146 if (this->particleSystem_) 147 return this->particleSystem_->getNumEmitters(); 148 else 149 return 0; 126 150 } 127 151 128 152 Ogre::ParticleAffector* ParticleInterface::addAffector(const std::string& name) 129 153 { 130 return this->particleSystem_->addAffector(name); 154 if (this->particleSystem_) 155 return this->particleSystem_->addAffector(name); 156 else 157 return 0; 131 158 } 132 159 Ogre::ParticleAffector* ParticleInterface::getAffector(unsigned int affectorNr) const 133 160 { 134 if ( affectorNr < this->particleSystem_->getNumAffectors())161 if (this->particleSystem_ && (affectorNr < this->particleSystem_->getNumAffectors())) 135 162 return this->particleSystem_->getAffector(affectorNr); 136 163 else … … 139 166 void ParticleInterface::removeAffector(unsigned int affectorNr) 140 167 { 141 if ( affectorNr < this->particleSystem_->getNumAffectors())168 if (this->particleSystem_ && (affectorNr < this->particleSystem_->getNumAffectors())) 142 169 this->particleSystem_->removeAffector(affectorNr); 143 170 } 144 171 void ParticleInterface::removeAllAffectors() 145 172 { 146 this->particleSystem_->removeAllAffectors(); 173 if (this->particleSystem_) 174 this->particleSystem_->removeAllAffectors(); 147 175 } 148 176 unsigned int ParticleInterface::getNumAffectors() const 149 177 { 150 return this->particleSystem_->getNumAffectors(); 178 if (this->particleSystem_) 179 return this->particleSystem_->getNumAffectors(); 180 else 181 return 0; 151 182 } 152 183 … … 155 186 this->bEnabled_ = enable; 156 187 157 for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++) 158 this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bAllowedByLOD_); 188 if (this->particleSystem_) 189 for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++) 190 this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bAllowedByLOD_); 159 191 } 160 192 … … 163 195 this->bVisible_ = visible; 164 196 165 this->particleSystem_->setVisible(this->bVisible_ && this->bAllowedByLOD_); 197 if (this->particleSystem_) 198 this->particleSystem_->setVisible(this->bVisible_ && this->bAllowedByLOD_); 166 199 } 167 200 … … 169 202 { 170 203 this->detaillevel_ = level; 171 this->detailLevelChanged(GraphicsEngine::getInstance().getDetailLevelParticle()); 204 if (GraphicsEngine::getInstancePtr()) 205 this->detailLevelChanged(GraphicsEngine::getInstance().getDetailLevelParticle()); 172 206 } 173 207 … … 190 224 void ParticleInterface::setSpeedFactor(float factor) 191 225 { 192 //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor); 193 this->particleSystem_->setSpeedFactor(1.0f * factor); 226 if (this->particleSystem_) 227 { 228 // this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor); 229 this->particleSystem_->setSpeedFactor(1.0f * factor); 230 } 194 231 } 195 232 float ParticleInterface::getSpeedFactor() const 196 233 { 197 //return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor()); 198 return (this->particleSystem_->getSpeedFactor() / 1.0f); 234 if (this->particleSystem_) 235 { 236 // return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor()); 237 return (this->particleSystem_->getSpeedFactor() / 1.0f); 238 } 239 else 240 return 1.0f; 199 241 } 200 242 201 243 bool ParticleInterface::getKeepParticlesInLocalSpace() const 202 244 { 203 return this->particleSystem_->getKeepParticlesInLocalSpace(); 245 if (this->particleSystem_) 246 return this->particleSystem_->getKeepParticlesInLocalSpace(); 247 else 248 return false; 204 249 } 205 250 void ParticleInterface::setKeepParticlesInLocalSpace(bool keep) 206 251 { 207 this->particleSystem_->setKeepParticlesInLocalSpace(keep); 252 if (this->particleSystem_) 253 this->particleSystem_->setKeepParticlesInLocalSpace(keep); 208 254 } 209 255 } -
code/trunk/src/orxonox/tools/Timer.h
r2087 r2171 28 28 29 29 /*! 30 @file Timer.h30 @file 31 31 @brief Definition and Implementation of the Timer class. 32 32
Note: See TracChangeset
for help on using the changeset viewer.