Two step initialization for engine. First step: Create and initialize objects (constructor). Second step: Start the engine, update the UI.

This commit is contained in:
lotodore
2007-05-12 22:00:59 +00:00
parent 7c6337d810
commit 6fbef0af20
15 changed files with 79 additions and 74 deletions
+17 -2
View File
@@ -24,7 +24,7 @@
#include <net/sendercallback.h>
#include <net/receiverhelper.h>
#include <net/socket_msg.h>
#include <gamedata.h>
#include <game.h>
#include <boost/lambda/lambda.hpp>
@@ -32,6 +32,7 @@
using namespace std;
class ServerSenderCallback : public SenderCallback
{
public:
@@ -141,7 +142,7 @@ ServerRecvThread::NotificationLoop()
switch(notification.message)
{
case NOTIFY_GAME_START:
SetState(SERVER_START_GAME_STATE::Instance());
InternalStartGame();
break;
case NOTIFY_WAIT_FOR_CLIENT_ACTION:
break;
@@ -243,6 +244,13 @@ ServerRecvThread::CleanupSessionMap()
m_sessionMap.clear();
}
void
ServerRecvThread::InternalStartGame()
{
// m_game.reset(...);
SetState(SERVER_START_GAME_STATE::Instance());
}
boost::shared_ptr<SessionData>
ServerRecvThread::GetSession(SOCKET sock)
{
@@ -468,6 +476,13 @@ ServerRecvThread::GetReceiver()
return *m_receiver;
}
Game &
ServerRecvThread::GetGame()
{
assert(m_game.get());
return *m_game;
}
const GameData &
ServerRecvThread::GetGameData() const
{