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:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user