Changeset 2012 for code/branches/objecthierarchy
- Timestamp:
- Oct 25, 2008, 8:19:40 PM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/orxonox
- Files:
-
- 3 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/CMakeLists.txt
r1993 r2012 69 69 70 70 objects/infos/Info.cc 71 objects/infos/Level Info.cc71 objects/infos/Level.cc 72 72 objects/infos/PlayerInfo.cc 73 73 -
code/branches/objecthierarchy/src/orxonox/OrxonoxPrereqs.h
r1993 r2012 98 98 99 99 class Info; 100 class Level Info;100 class Level; 101 101 class PlayerInfo; 102 102 -
code/branches/objecthierarchy/src/orxonox/objects/infos/Level.cc
r2010 r2012 28 28 29 29 #include "OrxonoxStableHeaders.h" 30 #include "Level Info.h"30 #include "Level.h" 31 31 32 32 #include <OgreSceneManager.h> … … 49 49 namespace orxonox 50 50 { 51 SetConsoleCommand(Level Info, listPlayers, true);52 53 CreateFactory(Level Info);54 55 Level Info::LevelInfo()56 { 57 RegisterObject(Level Info);51 SetConsoleCommand(Level, listPlayers, true); 52 53 CreateFactory(Level); 54 55 Level::Level() 56 { 57 RegisterObject(Level); 58 58 59 59 this->rootGametype_ = 0; … … 71 71 // test test test 72 72 73 COUT(0) << "created Level Info" << std::endl;74 } 75 76 Level Info* LevelInfo::getActiveLevelInfo()77 { 78 for (ObjectList<Level Info>::iterator it = ObjectList<LevelInfo>::begin(); it != ObjectList<LevelInfo>::end(); ++it)73 COUT(0) << "created Level" << std::endl; 74 } 75 76 Level* Level::getActiveLevel() 77 { 78 for (ObjectList<Level>::iterator it = ObjectList<Level>::begin(); it != ObjectList<Level>::end(); ++it) 79 79 if (it->isActive()) 80 80 return (*it); … … 83 83 } 84 84 85 PlayerInfo* Level Info::getClient(unsigned int clientID)86 { 87 Level Info* levelinfo = LevelInfo::getActiveLevelInfo();88 89 if (level info)90 { 91 std::map<unsigned int, PlayerInfo*>::const_iterator it = level info->clients_.find(clientID);92 if (it != level info->clients_.end())85 PlayerInfo* Level::getClient(unsigned int clientID) 86 { 87 Level* level = Level::getActiveLevel(); 88 89 if (level) 90 { 91 std::map<unsigned int, PlayerInfo*>::const_iterator it = level->clients_.find(clientID); 92 if (it != level->clients_.end()) 93 93 return it->second; 94 94 } … … 102 102 } 103 103 104 void Level Info::listPlayers()105 { 106 Level Info* levelinfo = LevelInfo::getActiveLevelInfo();107 108 if (level info->getGametype())109 { 110 for (std::set<PlayerInfo*>::const_iterator it = level info->getGametype()->getPlayers().begin(); it != levelinfo->getGametype()->getPlayers().end(); ++it)104 void Level::listPlayers() 105 { 106 Level* level = Level::getActiveLevel(); 107 108 if (level->getGametype()) 109 { 110 for (std::set<PlayerInfo*>::const_iterator it = level->getGametype()->getPlayers().begin(); it != level->getGametype()->getPlayers().end(); ++it) 111 111 COUT(0) << "ID: " << (*it)->getClientID() << ", Name: " << (*it)->getName() << std::endl; 112 112 } … … 118 118 } 119 119 120 void Level Info::clientConnected(unsigned int clientID)120 void Level::clientConnected(unsigned int clientID) 121 121 { 122 122 COUT(0) << "client connected" << std::endl; … … 132 132 } 133 133 134 void Level Info::clientDisconnected(unsigned int clientID)134 void Level::clientDisconnected(unsigned int clientID) 135 135 { 136 136 COUT(0) << "client disconnected" << std::endl; … … 144 144 } 145 145 146 void Level Info::XMLPort(Element& xmlelement, XMLPort::Mode mode)147 { 148 SUPER(Level Info, XMLPort, xmlelement, mode);149 150 XMLPortParam(Level Info, "description", setDescription, getDescription, xmlelement, mode);151 XMLPortParam(Level Info, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");152 XMLPortParam(Level Info, "skybox", setSkybox, getSkybox, xmlelement, mode);153 XMLPortParam(Level Info, "ambientlight", setAmbientLight, getAmbientLight, xmlelement, mode).defaultValues(ColourValue(0.2, 0.2, 0.2, 1));146 void Level::XMLPort(Element& xmlelement, XMLPort::Mode mode) 147 { 148 SUPER(Level, XMLPort, xmlelement, mode); 149 150 XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode); 151 XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype"); 152 XMLPortParam(Level, "skybox", setSkybox, getSkybox, xmlelement, mode); 153 XMLPortParam(Level, "ambientlight", setAmbientLight, getAmbientLight, xmlelement, mode).defaultValues(ColourValue(0.2, 0.2, 0.2, 1)); 154 154 155 155 this->xmlfile_ = this->getFilename(); 156 156 } 157 157 158 void Level Info::registerVariables()159 { 160 REGISTERSTRING(this->xmlfile_, network::direction::toclient, new network::NetworkCallback<Level Info>(this, &LevelInfo::applyXMLFile));161 REGISTERSTRING(this->name_, network::direction::toclient, new network::NetworkCallback<Level Info>(this, &LevelInfo::changedName));158 void Level::registerVariables() 159 { 160 REGISTERSTRING(this->xmlfile_, network::direction::toclient, new network::NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile)); 161 REGISTERSTRING(this->name_, network::direction::toclient, new network::NetworkCallback<Level>(this, &Level::changedName)); 162 162 REGISTERSTRING(this->description_, network::direction::toclient); 163 REGISTERSTRING(this->skybox_, network::direction::toclient, new network::NetworkCallback<Level Info>(this, &LevelInfo::applySkybox));164 REGISTERDATA(this->ambientLight_, network::direction::toclient, new network::NetworkCallback<Level Info>(this, &LevelInfo::applyAmbientLight));165 } 166 167 void Level Info::applyXMLFile()163 REGISTERSTRING(this->skybox_, network::direction::toclient, new network::NetworkCallback<Level>(this, &Level::networkcallback_applySkybox)); 164 REGISTERDATA(this->ambientLight_, network::direction::toclient, new network::NetworkCallback<Level>(this, &Level::networkcallback_applyAmbientLight)); 165 } 166 167 void Level::networkcallback_applyXMLFile() 168 168 { 169 169 COUT(0) << "Loading level \"" << this->xmlfile_ << "\"..." << std::endl; … … 178 178 } 179 179 180 void Level Info::setSkybox(const std::string& skybox)180 void Level::setSkybox(const std::string& skybox) 181 181 { 182 182 if (Core::showsGraphics()) … … 187 187 } 188 188 189 void Level Info::setAmbientLight(const ColourValue& colour)189 void Level::setAmbientLight(const ColourValue& colour) 190 190 { 191 191 if (Core::showsGraphics()) … … 195 195 } 196 196 197 void Level Info::setGametypeString(const std::string& gametype)197 void Level::setGametypeString(const std::string& gametype) 198 198 { 199 199 Identifier* identifier = ClassByString(gametype); -
code/branches/objecthierarchy/src/orxonox/objects/infos/Level.h
r2010 r2012 27 27 */ 28 28 29 #ifndef _Level Info_H__30 #define _Level Info_H__29 #ifndef _Level_H__ 30 #define _Level_H__ 31 31 32 32 #include "OrxonoxPrereqs.h" … … 41 41 namespace orxonox 42 42 { 43 class _OrxonoxExport Level Info: public Info, public network::ClientConnectionListener43 class _OrxonoxExport Level : public Info, public network::ClientConnectionListener 44 44 { 45 45 public: 46 Level Info();47 virtual ~Level Info() {}46 Level(); 47 virtual ~Level() {} 48 48 49 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); … … 72 72 { return this->rootGametype_; } 73 73 74 static Level Info* getActiveLevelInfo();74 static Level* getActiveLevel(); 75 75 static void listPlayers(); 76 76 static PlayerInfo* getClient(unsigned int clientID); … … 80 80 virtual void clientDisconnected(unsigned int clientID); 81 81 82 void applyXMLFile();82 void networkcallback_applyXMLFile(); 83 83 84 void applySkybox()84 void networkcallback_applySkybox() 85 85 { this->setSkybox(this->skybox_); } 86 void applyAmbientLight()86 void networkcallback_applyAmbientLight() 87 87 { this->setAmbientLight(this->ambientLight_); } 88 88 … … 98 98 } 99 99 100 #endif /* _Level Info_H__ */100 #endif /* _Level_H__ */ -
code/branches/objecthierarchy/src/orxonox/overlays/hud/ChatOverlay.cc
r2006 r2012 39 39 40 40 #include "GraphicsEngine.h" 41 #include "objects/infos/Level Info.h"41 #include "objects/infos/Level.h" 42 42 #include "objects/infos/PlayerInfo.h" 43 43 #include "overlays/console/InGameConsole.h" … … 76 76 std::string name = "unknown"; 77 77 78 PlayerInfo* player = Level Info::getClient(senderID);78 PlayerInfo* player = Level::getClient(senderID); 79 79 if (player) 80 80 name = player->getName();
Note: See TracChangeset
for help on using the changeset viewer.