code fixes

This commit is contained in:
Ulf Gebhardt 2017-07-27 13:50:16 +02:00
parent 453b37fcc0
commit 8d144ab8f4
14 changed files with 44 additions and 43 deletions

View File

@ -522,7 +522,7 @@ DefReturnResult DefScriptPackage::SCGetEntry(CmdSet& Set)
}
else
{
logerror("SCGetEntry: Object "I64FMT" not known",guid);
logerror("SCGetEntry: Object %016I64X not known",guid);
}
return r;
}
@ -544,7 +544,7 @@ DefReturnResult DefScriptPackage::SCGetObjectType(CmdSet& Set)
}
else
{
logerror("SCGetObjectType: Object "I64FMT" not known",guid);
logerror("SCGetObjectType: Object %016I64X not known",guid);
}
return r;
}
@ -855,7 +855,7 @@ DefReturnResult DefScriptPackage::SCGetObjectValue(CmdSet &Set)
uint32 v = (uint32)DefScriptTools::toUint64(Set.arg[0]);
if(v > o->GetValuesCount())
{
logerror("SCGetObjectValue ["I64FMTD", type %u]: invalid value index: %u",guid,o->GetTypeId(),v);
logerror("SCGetObjectValue [%llu, type %u]: invalid value index: %u",guid,o->GetTypeId(),v);
return "";
}
else

View File

@ -8,6 +8,7 @@
#include <memory.h>
#include <stdlib.h> // free, malloc and realloc
#include <string.h>
#include <algorithm>
namespace irrklang
{

View File

@ -18,7 +18,7 @@ void DrawObjMgr::Clear(void)
DEBUG( logdebug("DrawObjMgr::Clear(), deleting %u DrawObjects...", _storage.size() ) );
for(DrawObjStorage::iterator i = _storage.begin(); i != _storage.end(); i++)
{
DEBUG( logdebug("del for guid "I64FMT, i->first) );
DEBUG( logdebug("del for guid %016I64X", i->first) );
delete i->second; // this can be done safely, since the object ptrs are not accessed
}
_storage.clear();
@ -65,7 +65,7 @@ void DrawObjMgr::Update(void)
while(_add.size())
{
std::pair<uint64,DrawObject*> p = _add.next();
DEBUG(logdebug("DrawObjMgr: adding DrawObj 0x%X guid "I64FMT" to main storage",p.second,p.first));
DEBUG(logdebug("DrawObjMgr: adding DrawObj 0x%X guid %016I64X to main storage",p.second,p.first));
_storage[p.first] = p.second;
}
@ -77,13 +77,13 @@ void DrawObjMgr::Update(void)
{
DrawObject *o = _storage[guid];
DEBUG(logdebug("DrawObjMgr: removing DrawObj 0x%X guid "I64FMT" from main storage",o,guid));
DEBUG(logdebug("DrawObjMgr: removing DrawObj 0x%X guid %016I64X from main storage",o,guid));
_storage.erase(guid);
delete o;
}
else
{
DEBUG(logdebug("DrawObjMgr: ERROR: removable DrawObject "I64FMT" not exising",guid));
DEBUG(logdebug("DrawObjMgr: ERROR: removable DrawObject %016I64X not exising",guid));
}
}

View File

@ -186,7 +186,7 @@ void DrawObject::_Init(void)
}
}
logdebug("initialize DrawObject 0x%X obj: 0x%X "I64FMT,this,_obj,_obj->GetGUID());
logdebug("initialize DrawObject 0x%X obj: 0x%X %016I64X",this,_obj,_obj->GetGUID());
_initialized = true;
}

View File

@ -119,7 +119,7 @@ bool PseuInstance::Init(void)
_scpdir="./scripts/";
srand((unsigned)time(NULL));
RAND_set_rand_method(RAND_SSLeay()); // init openssl randomizer
RAND_set_rand_method(RAND_OpenSSL()); // init openssl randomizer
_scp=new DefScriptPackage();
_scp->SetParentMethod((void*)this);

View File

@ -662,7 +662,7 @@ void RealmSession::_HandleTransferInit(ByteBuffer& pkt)
pkt.read(type_str,type_size);
pkt >> _file_size;
pkt.read(_file_md5,MD5_DIGEST_LENGTH);
logcustom(0,GREEN,"TransferInit [%s]: File size: "I64FMTD" KB (MD5: %s)", (char*)type_str, _file_size / 1024L, toHexDump(&_file_md5[0],MD5_DIGEST_LENGTH,false).c_str());
logcustom(0,GREEN,"TransferInit [%s]: File size: %llu KB (MD5: %s)", (char*)type_str, _file_size / 1024L, toHexDump(&_file_md5[0],MD5_DIGEST_LENGTH,false).c_str());
if(PseuGUI *gui = GetInstance()->GetGUI())
gui->SetSceneData(ISCENE_LOGIN_CONN_STATUS,DSCENE_LOGIN_FILE_TRANSFER);
delete [] type_str;

View File

@ -85,7 +85,7 @@ void WorldSession::SendSetSelection(uint64 guid)
if(guid==GetMyChar()->GetTarget())
return; // no need to select already selected target
GetMyChar()->SetTarget(guid);
logdebug("SetSelection GUID="I64FMT,guid);
logdebug("SetSelection GUID=%016I64X",guid);
WorldPacket packet;
packet << guid;
packet.SetOpcode(CMSG_SET_SELECTION);
@ -145,7 +145,7 @@ void WorldSession::SendCastSpell(uint32 spellid, bool nocheck)
// cast it
packet.SetOpcode(CMSG_CAST_SPELL);
SendWorldPacket(packet);
logdetail("Casting spell %u on target "I64FMT,spellid,my->GetTarget());
logdetail("Casting spell %u on target %016I64X",spellid,my->GetTarget());
if(!known)
logcustom(1,LRED," - WARNING: spell is NOT known!");
}

View File

@ -265,7 +265,7 @@ void Channel::HandleListRequest(WorldPacket& recvPacket)
while(pname.length() < MAX_PLAYERNAME_LENGTH)
pname += " "; // for better formatting
logcustom(0,WHITE,"%s ["I64FMT"] %s %s",pname.c_str(),i->first,muted?"(muted)":"",mod?"(moderator)":"");
logcustom(0,WHITE,"%s [%016I64X] %s %s",pname.c_str(),i->first,muted?"(muted)":"",mod?"(moderator)":"");
// DefScript binding
l->push_back(DefScriptTools::toString(guid));

View File

@ -53,7 +53,7 @@ void ObjMgr::Remove(uint64 guid, bool del)
{
o->_SetDepleted();
if(!del)
logdebug("ObjMgr: "I64FMT" '%s' -> depleted.",guid,o->GetName().c_str());
logdebug("ObjMgr: %016I64X '%s' -> depleted.",guid,o->GetName().c_str());
PseuGUI *gui = _instance->GetGUI();
if(gui)
gui->NotifyObjectDeletion(guid); // we have a gui, which must delete linked DrawObject
@ -67,7 +67,7 @@ void ObjMgr::Remove(uint64 guid, bool del)
{
_obj.erase(guid); // we can safely erase an object that does not exist
// - if we reach this point there was a bug anyway
logcustom(2,LRED,"ObjMgr::Remove("I64FMT") - not existing",guid);
logcustom(2,LRED,"ObjMgr::Remove(%016I64X) - not existing",guid);
}
}

View File

@ -15,7 +15,7 @@ Object::Object()
Object::~Object()
{
ASSERT(_valuescount > 0);
DEBUG(logdebug("~Object() GUID="I64FMT,GetGUID()));
DEBUG(logdebug("~Object() GUID=%016I64X",GetGUID()));
if(_uint32values)
delete [] _uint32values;
}
@ -113,7 +113,7 @@ void WorldSession::_HandleDestroyObjectOpcode(WorldPacket& recvPacket)
recvPacket >> guid;
if(GetInstance()->GetConf()->client > CLIENT_TBC)
recvPacket >> dummy;
logdebug("Destroy Object "I64FMT,guid);
logdebug("Destroy Object %016I64X",guid);
// call script just before object removal
if(GetInstance()->GetScripts()->ScriptExists("_onobjectdelete"))

View File

@ -29,7 +29,7 @@ MyCharacter::MyCharacter() : Player()
MyCharacter::~MyCharacter()
{
DEBUG(logdebug("~MyCharacter() destructor, this=0x%X guid="I64FMT,this,GetGUID())); // this _could_ crash if Player::Create(guid) wasnt called before!
DEBUG(logdebug("~MyCharacter() destructor, this=0x%X guid=%016I64X",this,GetGUID())); // this _could_ crash if Player::Create(guid) wasnt called before!
}
void MyCharacter::SetActionButtons(WorldPacket &data)

View File

@ -67,7 +67,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
else // sometimes objects get deleted BEFORE a last update packet arrives, this must be handled also
{
tyid = GetTypeIdByGuid(uguid);
logerror("Got UpdateObject_Movement for unknown object "I64FMT". Using typeid %u",uguid,(uint32)tyid);
logerror("Got UpdateObject_Movement for unknown object %016I64X. Using typeid %u",uguid,(uint32)tyid);
}
if(obj)
@ -81,7 +81,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
uguid = recvPacket.readPackGUID();
uint8 objtypeid;
recvPacket >> objtypeid;
logdebug("Create Object type %u with guid "I64FMT,objtypeid,uguid);
logdebug("Create Object type %u with guid %016I64X",objtypeid,uguid);
// dont create objects if already present in memory.
// recreate every object except ourself!
if(objmgr.GetObj(uguid))
@ -113,7 +113,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
Item *item = new Item();
item->Create(uguid);
objmgr.Add(item);
logdebug("Created Item with guid "I64FMT,uguid);
logdebug("Created Item with guid %016I64X",uguid);
break;
}
case TYPEID_CONTAINER:
@ -121,7 +121,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
Bag *bag = new Bag();
bag->Create(uguid);
objmgr.Add(bag);
logdebug("Created Bag with guid "I64FMT,uguid);
logdebug("Created Bag with guid %016I64X",uguid);
break;
}
case TYPEID_UNIT:
@ -129,7 +129,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
Unit *unit = new Unit();
unit->Create(uguid);
objmgr.Add(unit);
logdebug("Created Unit with guid "I64FMT,uguid);
logdebug("Created Unit with guid %016I64X",uguid);
break;
}
case TYPEID_PLAYER:
@ -139,7 +139,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
Player *player = new Player();
player->Create(uguid);
objmgr.Add(player);
logdebug("Created Player with guid "I64FMT,uguid);
logdebug("Created Player with guid %016I64X",uguid);
break;
}
case TYPEID_GAMEOBJECT:
@ -147,7 +147,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
GameObject *go = new GameObject();
go->Create(uguid);
objmgr.Add(go);
logdebug("Created GO with guid "I64FMT,uguid);
logdebug("Created GO with guid %016I64X",uguid);
break;
}
case TYPEID_CORPSE:
@ -155,7 +155,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
Corpse *corpse = new Corpse();
corpse->Create(uguid);
objmgr.Add(corpse);
logdebug("Created Corpse with guid "I64FMT,uguid);
logdebug("Created Corpse with guid %016I64X",uguid);
break;
}
case TYPEID_DYNAMICOBJECT:
@ -163,14 +163,14 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
DynamicObject *dobj = new DynamicObject();
dobj->Create(uguid);
objmgr.Add(dobj);
logdebug("Created DynObj with guid "I64FMT,uguid);
logdebug("Created DynObj with guid %016I64X",uguid);
break;
}
}
}
else
{
logdebug("Obj "I64FMT" not created, already exists",uguid);
logdebug("Obj %016I64X not created, already exists",uguid);
}
// ...regardless if it was freshly created or already present, update its values and stuff now...
this->_MovementUpdate(objtypeid, uguid, recvPacket);
@ -201,7 +201,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket)
for(uint32 i=0;i<usize;i++)
{
uguid = recvPacket.readPackGUID(); // not 100% sure if this is correct
logdebug("GUID "I64FMT" out of range",uguid);
logdebug("GUID %016I64X out of range",uguid);
// // call script just before object removal
// if(GetInstance()->GetScripts()->ScriptExists("_onobjectdelete"))
@ -260,11 +260,11 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
if(obj->IsUnit())
u = (Unit*)obj; // only use for Unit:: functions!!
else
logdev("MovementUpdate: object "I64FMT" is not Unit (typeId=%u)",obj->GetGUID(),obj->GetTypeId());
logdev("MovementUpdate: object %016I64X is not Unit (typeId=%u)",obj->GetGUID(),obj->GetTypeId());
}
else
{
logerror("MovementUpdate for unknown object "I64FMT" typeid=%u",uguid,objtypeid);
logerror("MovementUpdate for unknown object %016I64X typeid=%u",uguid,objtypeid);
}
if(client > CLIENT_TBC)
@ -279,14 +279,14 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
{
recvPacket >> mi;
logdev("MovementUpdate: TypeID=%u GUID="I64FMT" pObj=%X flags=%x mi.flags=%x",objtypeid,uguid,obj,flags,mi.flags);
logdev("MovementUpdate: TypeID=%u GUID=%016I64X pObj=%X flags=%x mi.flags=%x",objtypeid,uguid,obj,flags,mi.flags);
logdev("FLOATS: x=%f y=%f z=%f o=%f",mi.pos.x, mi.pos.y, mi.pos.z ,mi.pos.o);
if(obj && obj->IsWorldObject())
((WorldObject*)obj)->SetPosition(mi.pos.x, mi.pos.y, mi.pos.z, mi.pos.o);
if(mi.flags & MOVEMENTFLAG_ONTRANSPORT)
{
logdev("TRANSPORT @ mi.flags: guid="I64FMT" x=%f y=%f z=%f o=%f", mi.t_guid, mi.t_pos.x, mi.t_pos.y, mi.t_pos.z, mi.t_pos.o);
logdev("TRANSPORT @ mi.flags: guid=%016I64X x=%f y=%f z=%f o=%f", mi.t_guid, mi.t_pos.x, mi.t_pos.y, mi.t_pos.z, mi.t_pos.o);
}
if((mi.flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (mi.flags2 & MOVEMENTFLAG2_ALLOW_PITCHING))
@ -410,7 +410,7 @@ void WorldSession::_MovementUpdate(uint8 objtypeid, uint64 uguid, WorldPacket& r
if(flags & UPDATEFLAG_HAS_TARGET)
{
uint64 unkguid = recvPacket.readPackGUID(); // MaNGOS sends uint8(0) always, but its probably be a packed guid
logdev("MovementUpdate: UPDATEFLAG_FULLGUID is set, got "I64FMT, unkguid);
logdev("MovementUpdate: UPDATEFLAG_FULLGUID is set, got %016I64X", unkguid);
}
if(flags & UPDATEFLAG_TRANSPORT)
@ -449,7 +449,7 @@ void WorldSession::_ValuesUpdate(uint64 uguid, WorldPacket& recvPacket)
}
else
{
logcustom(1,LRED,"Got UpdateObject_Values for unknown object "I64FMT,uguid);
logcustom(1,LRED, "Got UpdateObject_Values for unknown object %016I64X",uguid);
tyid = GetTypeIdByGuid(uguid); // can cause problems with TYPEID_CONTAINER!!
valuesCount = GetValuesCountByTypeId(tyid);
}
@ -463,7 +463,7 @@ void WorldSession::_ValuesUpdate(uint64 uguid, WorldPacket& recvPacket)
recvPacket.read((uint8*)updateMask, masksize);
umask.SetMask(updateMask);
//delete [] updateMask; // will be deleted at ~UpdateMask() !!!!
logdev("ValuesUpdate TypeId=%u GUID="I64FMT" pObj=%X Blocks=%u Masksize=%u",tyid,uguid,obj,blockcount,masksize);
logdev("ValuesUpdate TypeId=%u GUID=%016I64X pObj=%X Blocks=%u Masksize=%u",tyid,uguid,obj,blockcount,masksize);
// just in case the object does not exist, and we have really a container instead of an item, and a value in
// the container fields is set, THEN we have a problem. this should never be the case; it can be fixed in a
// more correct way if there is the need.
@ -503,7 +503,7 @@ void WorldSession::_QueryObjectInfo(uint64 guid)
}
else
{
logdebug("Found unknown item: GUID="I64FMT" entry=%u",obj->GetGUID(),obj->GetEntry());
logdebug("Found unknown item: GUID=%016I64X entry=%u",obj->GetGUID(),obj->GetEntry());
SendQueryItem(obj->GetEntry(),guid); // not sure if sending GUID is correct
}
break;

View File

@ -504,7 +504,7 @@ std::string WorldSession::GetOrRequestPlayerName(uint64 guid)
{
if(!guid || GUID_HIPART(guid) != HIGHGUID_PLAYER)
{
logerror("WorldSession::GetOrRequestObjectName: "I64FMT" is not player",guid);
logerror("WorldSession::GetOrRequestObjectName: %016I64X is not player",guid);
return "<ERR: OBJECT>"; // TODO: temporary, to find bugs with this, if there are any
}
std::string name = plrNameCache.GetName(guid);
@ -881,7 +881,7 @@ void WorldSession::_HandleMessageChatOpcode(WorldPacket& recvPacket) //TODO: REW
{
recvPacket >> listener_name_len; // always 1 (\0)
recvPacket >> listener_name; // always \0
logdebug("CHAT: Listener: '%s' (guid="I64FMT" len=%u type=%u)", listener_name.c_str(), listener_guid, listener_name_len, type);
logdebug("CHAT: Listener: '%s' (guid=%016I64X len=%u type=%u)", listener_name.c_str(), listener_guid, listener_name_len, type);
}
break;
@ -916,7 +916,7 @@ void WorldSession::_HandleMessageChatOpcode(WorldPacket& recvPacket) //TODO: REW
GetInstance()->GetScripts()->variables.Set("@thismsg",DefScriptTools::toString(source_guid));
DEBUG(logdebug("Chat packet recieved, type=%u lang=%u src="I64FMT" dst="I64FMT" chn='%s' len=%u",
DEBUG(logdebug("Chat packet recieved, type=%u lang=%u src=%016I64X dst=%016I64X chn='%s' len=%u",
type,lang,source_guid,source_guid,channel.c_str(),msglen));
if (type == CHAT_MSG_SYSTEM)
@ -1261,7 +1261,7 @@ void WorldSession::_HandleTelePortAckOpcode(WorldPacket& recvPacket)
guid = recvPacket.readPackGUID();
recvPacket >> unk32 >> mi;
logdetail("Got teleported, data: x: %f, y: %f, z: %f, o: %f, guid: "I64FMT, mi.pos.x, mi.pos.y, mi.pos.z, mi.pos.o, guid);
logdetail("Got teleported, data: x: %f, y: %f, z: %f, o: %f, guid: %016I64X", mi.pos.x, mi.pos.y, mi.pos.z, mi.pos.o, guid);
_world->UpdatePos(mi.pos.x,mi.pos.y);
_world->Update();
@ -1384,7 +1384,7 @@ void WorldSession::_HandleCastSuccessOpcode(WorldPacket& recvPacket)
if(caster)
logdetail("%s casted spell %u", caster->GetName().c_str(), spellId);
else
logerror("Caster of spell %u (GUID "I64FMT") is unknown object!",spellId,casterGuid);
logerror("Caster of spell %u (GUID %016I64X) is unknown object!",spellId,casterGuid);
}
}

View File

@ -96,7 +96,7 @@ int main(int argc, char* argv[])
logcustom(0,LGREEN,"| http://www.mangosclient.org |");
logcustom(0,LGREEN,"+----------------------------------+");
logcustom(0,GREEN,"Platform: %s",PLATFORM_NAME);
logcustom(0,GREEN,"Compiler: %s ("COMPILER_VERSION_OUT")",COMPILER_NAME,COMPILER_VERSION);
logcustom(0,GREEN,"Compiler: %s (%u)",COMPILER_NAME,COMPILER_VERSION);
logcustom(0,GREEN,"Compiled: %s %s",__DATE__,__TIME__);
_HookSignals();