[10363] More wide use ObjectGuid in way remove MAKE_NEW_GUID uses.

Also
* Fixed some amount wrong uses low guids as full player guids.
* Add private without body ObjectGuid(uint32 const&) for catch wrong assigns low guids to ObjectGuid.
  In some cases need assign "0" guid, then use ObjectGuid() instead.
* Fixed .pdump commands work.
This commit is contained in:
VladimirMangos 2010-08-17 02:16:15 +04:00
parent db7db6382a
commit 5f44c4da21
41 changed files with 369 additions and 323 deletions

View file

@ -862,7 +862,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
return false;
}
GameObject* target = m_session->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid,id,HIGHGUID_GAMEOBJECT));
GameObject* target = m_session->GetPlayer()->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, id, lowguid));
PSendSysMessage(LANG_GAMEOBJECT_DETAIL, lowguid, goI->name, lowguid, id, x, y, z, mapid, o);
@ -1799,8 +1799,8 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args)
if (!lowguid)
return false;
if (CreatureData const* cr_data = sObjectMgr.GetCreatureData(lowguid))
unit = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT));
if (CreatureData const* data = sObjectMgr.GetCreatureData(lowguid))
unit = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
}
else
unit = getSelectedCreature();
@ -2594,7 +2594,7 @@ void ChatHandler::ShowTicket(GMTicket const* ticket)
std::string lastupdated = TimeToTimestampStr(ticket->GetLastUpdate());
std::string name;
if (!sObjectMgr.GetPlayerNameByGUID(MAKE_NEW_GUID(ticket->GetPlayerLowGuid(), 0, HIGHGUID_PLAYER), name))
if (!sObjectMgr.GetPlayerNameByGUID(ObjectGuid(HIGHGUID_PLAYER, ticket->GetPlayerLowGuid()), name))
name = GetMangosString(LANG_UNKNOWN);
std::string nameLink = playerLink(name);
@ -2910,7 +2910,7 @@ bool ChatHandler::HandleWpAddCommand(char* args)
return false;
}
target = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT));
target = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
if (!target)
{
PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, lowguid);
@ -2944,7 +2944,7 @@ bool ChatHandler::HandleWpAddCommand(char* args)
return false;
}
target = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT));
target = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
if (!target || target->isPet())
{
PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid);
@ -3159,7 +3159,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
return false;
}
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
if (!npcCreature)
{
@ -3238,13 +3238,13 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
return false;
}
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
// wpCreature
Creature* wpCreature = NULL;
if (wpGuid != 0)
{
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid));
wpCreature->DeleteFromDB();
wpCreature->AddObjectToRemoveList();
}
@ -3298,7 +3298,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
return false;
}
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
// wpCreature
Creature* wpCreature = NULL;
@ -3307,7 +3307,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
// Respawn the owner of the waypoints
if (wpGuid != 0)
{
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid));
wpCreature->DeleteFromDB();
wpCreature->AddObjectToRemoveList();
// re-create
@ -3369,7 +3369,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
sWaypointMgr.SetNodeText(lowguid, point, show_str, arg_str);
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, data->id, HIGHGUID_UNIT));
Creature* npcCreature = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
if (npcCreature)
{
npcCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
@ -3469,7 +3469,7 @@ bool ChatHandler::HandleWpShowCommand(char* args)
return false;
}
target = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT));
target = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
if (!target)
{
@ -3528,7 +3528,7 @@ bool ChatHandler::HandleWpShowCommand(char* args)
do
{
Field *fields = result->Fetch();
uint32 creGUID = fields[0].GetUInt32();
uint32 wpGuid = fields[0].GetUInt32();
uint32 point = fields[1].GetUInt32();
int waittime = fields[2].GetUInt32();
uint32 emote = fields[3].GetUInt32();
@ -3540,9 +3540,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
uint32 model2 = fields[11].GetUInt32();
// Get the creature for which we read the waypoint
Creature* wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(creGUID,VISUAL_WAYPOINT,HIGHGUID_UNIT));
Creature* wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid));
PSendSysMessage(LANG_WAYPOINT_INFO_TITLE, point, (wpCreature ? wpCreature->GetName() : "<not found>"), creGUID);
PSendSysMessage(LANG_WAYPOINT_INFO_TITLE, point, (wpCreature ? wpCreature->GetName() : "<not found>"), wpGuid);
PSendSysMessage(LANG_WAYPOINT_INFO_WAITTIME, waittime);
PSendSysMessage(LANG_WAYPOINT_INFO_MODEL, 1, model1);
PSendSysMessage(LANG_WAYPOINT_INFO_MODEL, 2, model2);
@ -3576,14 +3576,14 @@ bool ChatHandler::HandleWpShowCommand(char* args)
do
{
Field *fields = result2->Fetch();
uint32 wpguid = fields[0].GetUInt32();
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpguid,VISUAL_WAYPOINT,HIGHGUID_UNIT));
uint32 wpGuid = fields[0].GetUInt32();
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid));
if (!pCreature)
{
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpguid);
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpGuid);
hasError = true;
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", wpguid);
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", wpGuid);
}
else
{
@ -3774,13 +3774,13 @@ bool ChatHandler::HandleWpShowCommand(char* args)
do
{
Field *fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid,VISUAL_WAYPOINT,HIGHGUID_UNIT));
uint32 wpGuid = fields[0].GetUInt32();
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, VISUAL_WAYPOINT, wpGuid));
if (!pCreature)
{
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);
PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpGuid);
hasError = true;
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", guid);
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", wpGuid);
}
else
{