Fixed avatars in network (non-public) games.
This commit is contained in:
@@ -845,6 +845,7 @@ void mainWindowImpl::callCreateNetworkGameDialog() {
|
|||||||
myServerGuiInterface.reset(new ServerGuiWrapper(myConfig, mySession->getGui(), mySession->getGui(), mySession->getGui()));
|
myServerGuiInterface.reset(new ServerGuiWrapper(myConfig, mySession->getGui(), mySession->getGui(), mySession->getGui()));
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Session> session(new Session(myServerGuiInterface.get(), myConfig));
|
boost::shared_ptr<Session> session(new Session(myServerGuiInterface.get(), myConfig));
|
||||||
|
session->init(mySession->getAvatarManager());
|
||||||
myServerGuiInterface->setSession(session);
|
myServerGuiInterface->setSession(session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1151,9 +1152,9 @@ void mainWindowImpl::initGui(int speed)
|
|||||||
|
|
||||||
void mainWindowImpl::showClientDialog()
|
void mainWindowImpl::showClientDialog()
|
||||||
{
|
{
|
||||||
if (mySession->GetGameType() == Session::GAME_TYPE_NETWORK)
|
if (mySession->getGameType() == Session::GAME_TYPE_NETWORK)
|
||||||
showNetworkStartDialog();
|
showNetworkStartDialog();
|
||||||
else if (mySession->GetGameType() == Session::GAME_TYPE_INTERNET)
|
else if (mySession->getGameType() == Session::GAME_TYPE_INTERNET)
|
||||||
showLobbyDialog();
|
showLobbyDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-2
@@ -42,7 +42,6 @@ Session::Session(GuiInterface *g, ConfigFile *c)
|
|||||||
: currentGameID(0), myNetClient(NULL), myNetServer(NULL), myIrcThread(NULL),
|
: currentGameID(0), myNetClient(NULL), myNetServer(NULL), myIrcThread(NULL),
|
||||||
myGui(g), myConfig(c), myGameType(GAME_TYPE_NONE)
|
myGui(g), myConfig(c), myGameType(GAME_TYPE_NONE)
|
||||||
{
|
{
|
||||||
myAvatarManager.reset(new AvatarManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,9 +55,15 @@ Session::~Session()
|
|||||||
|
|
||||||
bool Session::init()
|
bool Session::init()
|
||||||
{
|
{
|
||||||
|
myAvatarManager.reset(new AvatarManager);
|
||||||
return myAvatarManager->Init(myConfig->readConfigString("AppDataDir"), myConfig->readConfigString("CacheDir"));
|
return myAvatarManager->Init(myConfig->readConfigString("AppDataDir"), myConfig->readConfigString("CacheDir"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Session::init(boost::shared_ptr<AvatarManager> manager)
|
||||||
|
{
|
||||||
|
myAvatarManager = manager;
|
||||||
|
}
|
||||||
|
|
||||||
void Session::startLocalGame(const GameData &gameData, const StartData &startData) {
|
void Session::startLocalGame(const GameData &gameData, const StartData &startData) {
|
||||||
|
|
||||||
myGameType = GAME_TYPE_LOCAL;
|
myGameType = GAME_TYPE_LOCAL;
|
||||||
@@ -117,11 +122,16 @@ GuiInterface *Session::getGui()
|
|||||||
return myGui;
|
return myGui;
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::GameType Session::GetGameType()
|
Session::GameType Session::getGameType()
|
||||||
{
|
{
|
||||||
return myGameType;
|
return myGameType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<AvatarManager> Session::getAvatarManager()
|
||||||
|
{
|
||||||
|
return myAvatarManager;
|
||||||
|
}
|
||||||
|
|
||||||
void Session::startInternetClient()
|
void Session::startInternetClient()
|
||||||
{
|
{
|
||||||
if (myNetClient || myIrcThread || !myGui)
|
if (myNetClient || myIrcThread || !myGui)
|
||||||
|
|||||||
+4
-2
@@ -42,16 +42,18 @@ public:
|
|||||||
|
|
||||||
enum GameType { GAME_TYPE_NONE, GAME_TYPE_LOCAL, GAME_TYPE_NETWORK, GAME_TYPE_INTERNET };
|
enum GameType { GAME_TYPE_NONE, GAME_TYPE_LOCAL, GAME_TYPE_NETWORK, GAME_TYPE_INTERNET };
|
||||||
|
|
||||||
|
// Only one of the two inits should be called.
|
||||||
bool init();
|
bool init();
|
||||||
|
void init(boost::shared_ptr<AvatarManager> manager);
|
||||||
|
|
||||||
void startLocalGame(const GameData &gameData, const StartData &startData);
|
void startLocalGame(const GameData &gameData, const StartData &startData);
|
||||||
void startClientGame(boost::shared_ptr<Game> game);
|
void startClientGame(boost::shared_ptr<Game> game);
|
||||||
|
|
||||||
Game *getCurrentGame();
|
Game *getCurrentGame();
|
||||||
|
|
||||||
GuiInterface *getGui();
|
GuiInterface *getGui();
|
||||||
|
GameType getGameType();
|
||||||
|
|
||||||
GameType GetGameType();
|
boost::shared_ptr<AvatarManager> getAvatarManager();
|
||||||
|
|
||||||
void startInternetClient();
|
void startInternetClient();
|
||||||
void startNetworkClient(const std::string &serverAddress, unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd);
|
void startNetworkClient(const std::string &serverAddress, unsigned serverPort, bool ipv6, bool sctp, const std::string &pwd);
|
||||||
|
|||||||
Reference in New Issue
Block a user