Fixing "game does not start automatically" issue.
This commit is contained in:
@@ -696,14 +696,16 @@ ServerGame::ResetComputerPlayerList()
|
|||||||
void
|
void
|
||||||
ServerGame::GracefulRemoveSession(SessionWrapper session, int reason)
|
ServerGame::GracefulRemoveSession(SessionWrapper session, int reason)
|
||||||
{
|
{
|
||||||
if (!session.sessionData.get())
|
if (!session.sessionData)
|
||||||
throw ServerException(__FILE__, __LINE__, ERR_NET_INVALID_SESSION, 0);
|
throw ServerException(__FILE__, __LINE__, ERR_NET_INVALID_SESSION, 0);
|
||||||
GetSessionManager().RemoveSession(session.sessionData->GetId());
|
|
||||||
|
|
||||||
boost::shared_ptr<PlayerData> tmpPlayerData = session.playerData;
|
if (GetSessionManager().RemoveSession(session.sessionData->GetId()))
|
||||||
if (tmpPlayerData.get() && !tmpPlayerData->GetName().empty())
|
|
||||||
{
|
{
|
||||||
RemovePlayerData(tmpPlayerData, reason);
|
boost::shared_ptr<PlayerData> tmpPlayerData = session.playerData;
|
||||||
|
if (tmpPlayerData && !tmpPlayerData->GetName().empty())
|
||||||
|
{
|
||||||
|
RemovePlayerData(tmpPlayerData, reason);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,11 +73,11 @@ SessionManager::SetSessionPlayerData(SessionId session, boost::shared_ptr<Player
|
|||||||
pos->second.playerData = playerData;
|
pos->second.playerData = playerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
SessionManager::RemoveSession(SessionId session)
|
SessionManager::RemoveSession(SessionId session)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
|
boost::recursive_mutex::scoped_lock lock(m_sessionMapMutex);
|
||||||
m_sessionMap.erase(session);
|
return m_sessionMap.erase(session) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionWrapper
|
SessionWrapper
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
void AddSession(boost::shared_ptr<SessionData> sessionData); // new Sessions without player data
|
void AddSession(boost::shared_ptr<SessionData> sessionData); // new Sessions without player data
|
||||||
void AddSession(SessionWrapper session);
|
void AddSession(SessionWrapper session);
|
||||||
void SetSessionPlayerData(SessionId session, boost::shared_ptr<PlayerData> playerData);
|
void SetSessionPlayerData(SessionId session, boost::shared_ptr<PlayerData> playerData);
|
||||||
void RemoveSession(SessionId session);
|
bool RemoveSession(SessionId session);
|
||||||
|
|
||||||
SessionWrapper GetSessionById(SessionId id) const;
|
SessionWrapper GetSessionById(SessionId id) const;
|
||||||
SessionWrapper GetSessionByPlayerName(const std::string playerName) const;
|
SessionWrapper GetSessionByPlayerName(const std::string playerName) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user