Changeset 5972 in orxonox.OLD
- Timestamp:
- Dec 7, 2005, 4:59:24 PM (19 years ago)
- Location:
- branches/network/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/orxonox.cc
r5971 r5972 83 83 84 84 /* this way, there is no network enabled: */ 85 this-> clientName = NULL;85 this->serverName = NULL; 86 86 this->port = -1; 87 87 … … 190 190 this->argv = argv; 191 191 192 this-> clientName = name;192 this->serverName = name; 193 193 this->port = port; 194 194 … … 278 278 PRINT(3)("> Initializing networking\n"); 279 279 280 if( this-> clientName != NULL) // we are a client281 NetworkManager::getInstance()->establishConnection(this-> clientName, port);280 if( this->serverName != NULL) // we are a client 281 NetworkManager::getInstance()->establishConnection(this->serverName, port); 282 282 else if( this->port > 0) // we are a server 283 283 NetworkManager::getInstance()->createServer(port); … … 351 351 352 352 this->gameLoader = GameLoader::getInstance(); 353 this->gameLoader->loadCampaign("worlds/DefaultCampaign.oxc"); 353 354 if( this->port == -1 || this->serverName != NULL) 355 this->gameLoader->loadNetworkCampaign("worlds/DefaultNetworkCampaign.oxc"); 356 else 357 this->gameLoader->loadCampaign("worlds/DefaultCampaign.oxc"); 358 354 359 // this->gameLoader->loadDebugCampaign(DEBUG_CAMPAIGN_0); 355 360 this->gameLoader->init(); -
branches/network/src/orxonox.h
r5829 r5972 53 53 char** argv; //!< Values of th Arguments of orxonox. 54 54 55 const char* clientName; //!< Name of the Orxonox client if == NULL -> server55 const char* serverName; //!< Name of the Orxonox client if == NULL -> server 56 56 int port; //!< number of the network port of the server/client if == -1 no network 57 57 }; -
branches/network/src/util/loading/game_loader.cc
r5819 r5972 46 46 /** 47 47 * simple constructor 48 */48 */ 49 49 GameLoader::GameLoader () 50 50 { … … 55 55 56 56 57 57 58 /** 58 59 * simple deconstructor 59 */60 */ 60 61 GameLoader::~GameLoader () 61 62 { … … 66 67 67 68 68 /**69 * this class is a singleton class70 * @returns an instance of itself71 72 if you are unsure about singleton classes, check the theory out on the internet :)73 */74 GameLoader* GameLoader::getInstance()75 {76 if(singletonRef == NULL)77 singletonRef = new GameLoader();78 return singletonRef;79 }80 69 81 70 /** 82 71 * initializes the GameLoader 83 */72 */ 84 73 ErrorMessage GameLoader::init() 85 74 { … … 96 85 97 86 87 98 88 /** 99 89 * reads a campaign definition file into a campaign class 100 90 * @param fileName to be loaded 101 91 * @returns the loaded campaign 102 103 104 */92 * 93 * this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns 94 */ 105 95 ErrorMessage GameLoader::loadCampaign(const char* fileName) 106 96 { … … 117 107 } 118 108 109 110 111 /** 112 * reads a campaign definition file into a campaign class 113 * @param fileName to be loaded 114 * @returns the loaded campaign 115 * 116 * this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns 117 */ 118 ErrorMessage loadNetworkCampaign(const char* name) 119 {} 120 121 122 119 123 /** 120 124 * loads a debug campaign for test purposes only. 121 125 * @param campaignID the identifier of the campaign. 122 126 * @returns error message if not able to do so. 123 */127 */ 124 128 ErrorMessage GameLoader::loadDebugCampaign(Uint32 campaignID) 125 129 { … … 156 160 157 161 /** 158 159 160 */162 * starts the current entity 163 * @returns error code if this action has caused a error 164 */ 161 165 ErrorMessage GameLoader::start() 162 166 { … … 167 171 168 172 /** 169 170 171 172 173 174 175 176 hehehe, have ya seen it... :)177 */173 * stops the current entity 174 * @returns error code if this action has caused a error 175 * 176 * ATTENTION: this function shouldn't call other functions, or if so, they must return 177 * after finishing. If you ignore or forget to do so, the current entity is not able to 178 * terminate and it will run in the background or the ressources can't be freed or even 179 * worse: are freed and the program will end in a segmentation fault! 180 * hehehe, have dja seen it... :) 181 */ 178 182 void GameLoader::stop() 179 183 { … … 184 188 185 189 /** 186 187 188 189 190 */190 * pause the current entity 191 * @returns error code if this action has caused a error 192 * 193 * this pauses the current entity or passes this call forth to the running entity. 194 */ 191 195 ErrorMessage GameLoader::pause() 192 196 { … … 198 202 199 203 /** 200 201 202 203 204 */204 * resumes a pause 205 * @returns error code if this action has caused a error 206 * 207 * this resumess the current entity or passes this call forth to the running entity. 208 */ 205 209 ErrorMessage GameLoader::resume() 206 210 { … … 224 228 * @param fileName to be loaded 225 229 * @returns the loaded campaign 226 227 228 */230 * 231 * this will interprete the map/campaign files and recursivly load a tree of worlds/campaigns 232 */ 229 233 Campaign* GameLoader::fileToCampaign(const char* fileName) 230 234 { … … 312 316 313 317 /** 314 \briefthis changes to the next level315 */318 * this changes to the next level 319 */ 316 320 void GameLoader::nextLevel() 317 321 { … … 322 326 323 327 /** 324 \briefchange to the previous level - not implemented325 326 this propably useless327 */328 * change to the previous level - not implemented 329 * 330 * this propably useless 331 */ 328 332 void GameLoader::previousLevel() 329 333 { … … 335 339 * load a StoryEntity 336 340 * @param element a XMLElement containing all the needed info 337 */341 */ 338 342 BaseObject* GameLoader::fabricate(const TiXmlElement* element) 339 343 { -
branches/network/src/util/loading/game_loader.h
r5819 r5972 40 40 { 41 41 42 42 43 public: 43 44 ~GameLoader (); 44 45 45 static GameLoader* getInstance(); 46 /** this class is a singleton class @returns an instance of itself */ 47 static GameLoader* getInstance() { if(singletonRef == NULL) singletonRef = new GameLoader(); return singletonRef; } 46 48 47 49 ErrorMessage init(); 48 ErrorMessage loadCampaign(const char* name);49 50 ErrorMessage start(); 50 51 void stop(); … … 56 57 void previousLevel(); 57 58 58 /** \brief a world command to send to the GameLoader @param cmd the command */59 bool worldCommand(Command* cmd);60 59 ErrorMessage loadDebugCampaign(Uint32 campaignID); 60 ErrorMessage loadCampaign(const char* name); 61 ErrorMessage loadNetworkCampaign(const char* name); 62 61 63 62 64 void registerFactory( Factory* factory ); … … 65 67 void process(const Event &event); 66 68 69 67 70 private: 68 71 GameLoader (); … … 70 73 Campaign* fileToCampaign(const char* name); 71 74 75 72 76 private: 73 77 static GameLoader* singletonRef; //!< The singleton-reference to this object
Note: See TracChangeset
for help on using the changeset viewer.