[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->SpawnCorpseBones();
target->SaveToDB();
}
else
// 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());
return true;
}
}

View file

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

View file

@ -4319,7 +4319,8 @@ void Player::CreateCorpse()
void Player::SpawnCorpseBones()
{
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
@ -15619,6 +15620,7 @@ bool Player::_LoadHomeBind(QueryResult *result)
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)
m_nextSave = sWorld.getConfig(CONFIG_INTERVAL_SAVE);
@ -20766,4 +20768,4 @@ void Player::SendDuelCountdown(uint32 counter)
WorldPacket data(SMSG_DUEL_COUNTDOWN, 4);
data << uint32(counter); // seconds
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),
_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion),
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)
{
if (sock)
@ -292,6 +292,7 @@ void WorldSession::LogoutPlayer(bool Save)
HandleMoveWorldportAckOpcode();
m_playerLogout = true;
m_playerSave = Save;
if (_player)
{
@ -454,6 +455,7 @@ void WorldSession::LogoutPlayer(bool Save)
}
m_playerLogout = false;
m_playerSave = false;
m_playerRecentlyLogout = true;
LogoutRequest(0);
}

View file

@ -113,6 +113,8 @@ class MANGOS_DLL_SPEC WorldSession
bool PlayerLoading() const { return m_playerLoading; }
bool PlayerLogout() const { return m_playerLogout; }
bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
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_playerLogout; // code processed in LogoutPlayer
bool m_playerRecentlyLogout;
bool m_playerSave;
LocaleConstant m_sessionDbcLocale;
int m_sessionDbLocaleIndex;
uint32 m_latency;

View file

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