- Timestamp:
- Apr 8, 2009, 12:36:08 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/orxonox/gamestates/GSDedicated.cc
r2662 r2907 30 30 #include "GSDedicated.h" 31 31 32 #include "core/Clock.h" 32 33 #include "core/CommandLine.h" 33 #include "core/Core.h" 34 #include "core/Game.h" 35 #include "core/GameMode.h" 34 36 #include "core/Iterator.h" 35 37 #include "network/Server.h" … … 39 41 namespace orxonox 40 42 { 41 GSDedicated::GSDedicated() 42 : GameState<GSRoot>("dedicated") 43 AddGameState(GSDedicated, "dedicated"); 44 45 GSDedicated::GSDedicated(const std::string& name) 46 : GameState(name) 43 47 , server_(0) 44 48 , timeSinceLastUpdate_(0) … … 50 54 } 51 55 52 void GSDedicated:: enter()56 void GSDedicated::activate() 53 57 { 54 Core::setHasServer(true);58 GameMode::setHasServer(true); 55 59 56 60 this->server_ = new Server(CommandLine::getValue("port")); 57 61 COUT(0) << "Loading scene in server mode" << std::endl; 58 62 59 GSLevel::enter(0);60 61 63 server_->open(); 62 64 } 63 65 64 void GSDedicated:: leave()66 void GSDedicated::deactivate() 65 67 { 66 GSLevel::leave();67 68 68 this->server_->close(); 69 69 delete this->server_; 70 70 71 Core::setHasServer(false);71 GameMode::setHasServer(false); 72 72 } 73 73 74 void GSDedicated:: ticked(const Clock& time)74 void GSDedicated::update(const Clock& time) 75 75 { 76 76 // static float startTime = time.getSecondsPrecise(); … … 82 82 // COUT(0) << "estimated ticks/sec: " << nrOfTicks/(time.getSecondsPrecise()-startTime) << endl; 83 83 timeSinceLastUpdate_ -= static_cast<unsigned int>(timeSinceLastUpdate_ / NETWORK_PERIOD) * NETWORK_PERIOD; 84 GSLevel::ticked(time); 85 server_->tick(time.getDeltaTime()); 86 this->tickChild(time); 84 server_->update(time); 87 85 } 88 86 else
Note: See TracChangeset
for help on using the changeset viewer.