mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[6892] Some small code clean ups and optimisations.
Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
parent
9f8e51ff41
commit
2e2055c469
5 changed files with 19 additions and 70 deletions
|
|
@ -904,23 +904,8 @@ void WorldSession::HandleChangePlayerNameOpcode(WorldPacket& recv_data)
|
|||
recv_data >> guid;
|
||||
recv_data >> newname;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT at_login FROM characters WHERE guid ='%u'", GUID_LOPART(guid));
|
||||
if (result)
|
||||
{
|
||||
uint32 at_loginFlags;
|
||||
Field *fields = result->Fetch();
|
||||
at_loginFlags = fields[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
if (!(at_loginFlags & AT_LOGIN_RENAME))
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1);
|
||||
data << (uint8)CHAR_CREATE_ERROR;
|
||||
SendPacket( &data );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT at_login, name FROM characters WHERE guid ='%u'", GUID_LOPART(guid));
|
||||
if (!result)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1);
|
||||
data << (uint8)CHAR_CREATE_ERROR;
|
||||
|
|
@ -928,10 +913,16 @@ void WorldSession::HandleChangePlayerNameOpcode(WorldPacket& recv_data)
|
|||
return;
|
||||
}
|
||||
|
||||
if(!objmgr.GetPlayerNameByGUID(guid, oldname)) // character not exist, because we have no name for this guid
|
||||
uint32 at_loginFlags;
|
||||
Field *fields = result->Fetch();
|
||||
at_loginFlags = fields[0].GetUInt32();
|
||||
oldname = fields[1].GetCppString();
|
||||
delete result;
|
||||
|
||||
if (!(at_loginFlags & AT_LOGIN_RENAME))
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1);
|
||||
data << (uint8)CHAR_LOGIN_NO_CHARACTER;
|
||||
data << (uint8)CHAR_CREATE_ERROR;
|
||||
SendPacket( &data );
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue