Trying to make rejoin work, still broken due to change of unique id during game.

This commit is contained in:
lotodore
2011-09-28 20:20:08 +00:00
parent 2488ea43cd
commit d6ab25d816
11 changed files with 74 additions and 31 deletions
+19 -5
View File
@@ -21,15 +21,15 @@
using namespace std;
PlayerData::PlayerData(unsigned uniqueId, int number, PlayerType type, PlayerRights rights, bool isGameAdmin)
: m_uniqueId(uniqueId), m_dbId(DB_ID_INVALID), m_number(number), m_type(type), m_rights(rights), m_isGameAdmin(isGameAdmin)
: m_uniqueId(uniqueId), m_dbId(DB_ID_INVALID), m_number(number), m_startCash(0), m_type(type), m_rights(rights), m_isGameAdmin(isGameAdmin)
{
}
PlayerData::PlayerData(const PlayerData &other)
: m_uniqueId(other.GetUniqueId()), m_dbId(other.GetDBId()), m_number(other.GetNumber()), m_guid(other.GetGuid()), m_name(other.GetName()),
m_password(), m_country(other.GetCountry()), m_avatarFile(other.GetAvatarFile()), m_avatarMD5(other.GetAvatarMD5()),
m_type(other.GetType()), m_rights(other.GetRights()), m_isGameAdmin(other.IsGameAdmin()),
m_netAvatarFile(), m_dataMutex()
: m_uniqueId(other.GetUniqueId()), m_dbId(other.GetDBId()), m_number(other.GetNumber()), m_startCash(other.GetStartCash()),
m_guid(other.GetGuid()), m_oldGuid(other.GetOldGuid()), m_name(other.GetName()), m_password(), m_country(other.GetCountry()),
m_avatarFile(other.GetAvatarFile()), m_avatarMD5(other.GetAvatarMD5()), m_type(other.GetType()), m_rights(other.GetRights()),
m_isGameAdmin(other.IsGameAdmin()), m_netAvatarFile(), m_dataMutex()
{
}
@@ -202,6 +202,20 @@ PlayerData::SetDBId(DB_id id)
m_dbId = id;
}
int
PlayerData::GetStartCash() const
{
boost::mutex::scoped_lock lock(m_dataMutex);
return m_startCash;
}
void
PlayerData::SetStartCash(int cash)
{
boost::mutex::scoped_lock lock(m_dataMutex);
m_startCash = cash;
}
bool
PlayerData::operator<(const PlayerData &other) const
{