[8829] some more places where we call redundant SaveToDB

i also added now my assert with which i've found them..
maybe someone want's to look at other cases too :)
This commit is contained in:
balrok 2009-11-18 18:53:47 +01:00
parent 37ba6623bb
commit 7a2764e0fe
6 changed files with 13 additions and 8 deletions

View file

@ -3511,7 +3511,6 @@ bool ChatHandler::HandleReviveCommand(const char* args)
{ {
target->ResurrectPlayer(0.5f); target->ResurrectPlayer(0.5f);
target->SpawnCorpseBones(); target->SpawnCorpseBones();
target->SaveToDB();
} }
else else
// will resurrected at login without corpse // will resurrected at login without corpse
@ -6394,4 +6393,4 @@ bool ChatHandler::HandleModifyGenderCommand(const char *args)
ChatHandler(player).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, GetNameLink().c_str()); ChatHandler(player).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, GetNameLink().c_str());
return true; return true;
} }

View file

@ -669,8 +669,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
if(!GetPlayer()->isRessurectRequestedBy(guid)) if(!GetPlayer()->isRessurectRequestedBy(guid))
return; return;
GetPlayer()->ResurectUsingRequestData(); GetPlayer()->ResurectUsingRequestData(); // will call spawncorpsebones
GetPlayer()->SaveToDB();
} }
void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)

View file

@ -4319,7 +4319,8 @@ void Player::CreateCorpse()
void Player::SpawnCorpseBones() void Player::SpawnCorpseBones()
{ {
if(sObjectAccessor.ConvertCorpseForPlayer(GetGUID())) if(sObjectAccessor.ConvertCorpseForPlayer(GetGUID()))
SaveToDB(); // prevent loading as ghost without corpse if (!GetSession()->PlayerLogoutWithSave()) // at logout we will already store the player
SaveToDB(); // prevent loading as ghost without corpse
} }
Corpse* Player::GetCorpse() const Corpse* Player::GetCorpse() const
@ -15619,6 +15620,7 @@ bool Player::_LoadHomeBind(QueryResult *result)
void Player::SaveToDB() void Player::SaveToDB()
{ {
// we should assure this: assert((m_nextSave != sWorld.getConfig(CONFIG_INTERVAL_SAVE)));
// delay auto save at any saves (manual, in code, or autosave) // delay auto save at any saves (manual, in code, or autosave)
m_nextSave = sWorld.getConfig(CONFIG_INTERVAL_SAVE); m_nextSave = sWorld.getConfig(CONFIG_INTERVAL_SAVE);
@ -20766,4 +20768,4 @@ void Player::SendDuelCountdown(uint32 counter)
WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); WorldPacket data(SMSG_DUEL_COUNTDOWN, 4);
data << uint32(counter); // seconds data << uint32(counter); // seconds
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
} }

View file

@ -42,7 +42,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8
LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time), LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time),
_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion), _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion),
m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(sObjectMgr.GetIndexForLocale(locale)), m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(sObjectMgr.GetIndexForLocale(locale)),
_logoutTime(0), m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), _logoutTime(0), m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_playerSave(false),
m_latency(0), m_TutorialsChanged(false) m_latency(0), m_TutorialsChanged(false)
{ {
if (sock) if (sock)
@ -292,6 +292,7 @@ void WorldSession::LogoutPlayer(bool Save)
HandleMoveWorldportAckOpcode(); HandleMoveWorldportAckOpcode();
m_playerLogout = true; m_playerLogout = true;
m_playerSave = Save;
if (_player) if (_player)
{ {
@ -454,6 +455,7 @@ void WorldSession::LogoutPlayer(bool Save)
} }
m_playerLogout = false; m_playerLogout = false;
m_playerSave = false;
m_playerRecentlyLogout = true; m_playerRecentlyLogout = true;
LogoutRequest(0); LogoutRequest(0);
} }

View file

@ -113,6 +113,8 @@ class MANGOS_DLL_SPEC WorldSession
bool PlayerLoading() const { return m_playerLoading; } bool PlayerLoading() const { return m_playerLoading; }
bool PlayerLogout() const { return m_playerLogout; } bool PlayerLogout() const { return m_playerLogout; }
bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
void SizeError(WorldPacket const& packet, uint32 size) const; void SizeError(WorldPacket const& packet, uint32 size) const;
@ -748,6 +750,7 @@ class MANGOS_DLL_SPEC WorldSession
bool m_playerLoading; // code processed in LoginPlayer bool m_playerLoading; // code processed in LoginPlayer
bool m_playerLogout; // code processed in LogoutPlayer bool m_playerLogout; // code processed in LogoutPlayer
bool m_playerRecentlyLogout; bool m_playerRecentlyLogout;
bool m_playerSave;
LocaleConstant m_sessionDbcLocale; LocaleConstant m_sessionDbcLocale;
int m_sessionDbLocaleIndex; int m_sessionDbLocaleIndex;
uint32 m_latency; uint32 m_latency;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8828" #define REVISION_NR "8829"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__