From 4d085e78c5bcd73358c1737c7ea9ed763e5a69c3 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 3 Nov 2008 01:45:54 +0300 Subject: [PATCH] More fixes for wrong format arg/value pairs. --- src/game/Level2.cpp | 2 +- src/game/Object.h | 5 ++--- src/game/ObjectMgr.cpp | 12 ++++++++---- src/game/Pet.cpp | 3 ++- src/game/PetitionsHandler.cpp | 5 +++-- src/game/Player.cpp | 14 +++++--------- src/game/QueryHandler.cpp | 6 ++++-- src/game/QuestHandler.cpp | 5 +++-- src/game/SpellAuras.cpp | 4 ++-- src/game/SpellEffects.cpp | 15 ++++++++++----- src/game/SpellHandler.cpp | 2 +- src/game/Transports.cpp | 3 ++- src/game/WaypointManager.cpp | 8 ++++++-- src/game/World.cpp | 6 ++++-- 14 files changed, 53 insertions(+), 37 deletions(-) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 86ef6a1..9a4d6a1 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1800,7 +1800,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args) else { // 0 - QueryResult *result = CharacterDatabase.PQuery("SELECT totaltime FROM characters WHERE guid = '%u'", targetGUID); + QueryResult *result = CharacterDatabase.PQuery("SELECT totaltime FROM characters WHERE guid = '%u'", GUID_LOPART(targetGUID)); if (!result) { SendSysMessage(LANG_PLAYER_NOT_FOUND); diff --git a/src/game/Object.h b/src/game/Object.h index 1272054..0d0ecc7 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -30,9 +30,8 @@ #include #define CONTACT_DISTANCE 0.5f -#define INTERACTION_DISTANCE 5 -#define ATTACK_DISTANCE 5 -#define DETECT_DISTANCE 20 // max distance to successful detect stealthed unit +#define INTERACTION_DISTANCE 5.0f +#define ATTACK_DISTANCE 5.0f #define MAX_VISIBILITY_DISTANCE (5*SIZE_OF_GRID_CELL/2.0f) // max distance for visible object show, limited by active zone for player based at cell size (active zone = 5x5 cells) #define DEFAULT_VISIBILITY_DISTANCE (SIZE_OF_GRID_CELL) // default visible distance diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 8a1117e..724880f 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -3802,19 +3802,22 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) if(float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE) { - sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",tablename,tmp.datalong2,tmp.id); + sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", + tablename,tmp.datalong2,tmp.id); continue; } if(tmp.datalong2 && float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE) { - sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %u or 0 for disable distance check",tablename,tmp.datalong2,tmp.id,uint32(DEFAULT_VISIBILITY_DISTANCE)); + sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check", + tablename,tmp.datalong2,tmp.id,DEFAULT_VISIBILITY_DISTANCE); continue; } if(tmp.datalong2 && float(tmp.datalong2) < INTERACTION_DISTANCE) { - sLog.outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %u or 0 for disable distance check",tablename,tmp.datalong2,tmp.id,uint32(INTERACTION_DISTANCE)); + sLog.outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check", + tablename,tmp.datalong2,tmp.id,INTERACTION_DISTANCE); continue; } @@ -3826,7 +3829,8 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) { if(!sSpellStore.LookupEntry(tmp.datalong)) { - sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",tablename,tmp.datalong,tmp.id); + sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u", + tablename,tmp.datalong,tmp.id); continue; } break; diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index ae190fb..7c40ff3 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -932,7 +932,8 @@ bool Pet::CreateBaseAtCreature(Creature* creature) if(!IsPositionValid()) { - sLog.outError("ERROR: Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %d Y: ^%d)", GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); + sLog.outError("ERROR: Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", + GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); return false; } diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index d53e7ab..1064bd2 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -833,8 +833,9 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) for(uint8 i = 0; i < signs; ++i) { Field* fields = result->Fetch(); - sLog.outDebug("PetitionsHandler: adding arena member %u", fields[0].GetUInt64()); - at->AddMember(fields[0].GetUInt64()); + uint64 memberGUID = fields[0].GetUInt64(); + sLog.outDebug("PetitionsHandler: adding arena member %u", GUID_LOPART(memberGUID)); + at->AddMember(memberGUID); result->NextRow(); } } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 74a7174..df3d925 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3946,24 +3946,20 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g uint32 LostDurability = maxDurability - curDurability; if(LostDurability>0) { - ItemPrototype const *ditemProto = sItemStorage.LookupEntry(item->GetEntry()); - if(!ditemProto) - { - sLog.outError("ERROR: RepairDurability: Unknown item id %u", ditemProto); - return TotalCost; - } + ItemPrototype const *ditemProto = item->GetProto(); DurabilityCostsEntry const *dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if(!dcost) { - sLog.outError("ERROR: RepairDurability: Wrong item lvl %u", dcost); + sLog.outError("ERROR: RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); return TotalCost; } - DurabilityQualityEntry const *dQualitymodEntry = sDurabilityQualityStore.LookupEntry((ditemProto->Quality+1)*2); + uint32 dQualitymodEntryId = (ditemProto->Quality+1)*2; + DurabilityQualityEntry const *dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if(!dQualitymodEntry) { - sLog.outError("ERROR: RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntry); + sLog.outError("ERROR: RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); return TotalCost; } diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 0c3ad1f..2c912a9 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -200,7 +200,8 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) uint64 guid; recv_data >> guid; - sLog.outDebug( "WORLD: CMSG_CREATURE_QUERY - (%u) NO CREATURE INFO! (GUID: %u, ENTRY: %u)", uint32(GUID_LOPART(guid)), guid, entry ); + sLog.outDebug("WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", + GUID_LOPART(guid), entry); WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4 ); data << uint32(entry | 0x80000000); SendPacket( &data ); @@ -259,7 +260,8 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) uint64 guid; recv_data >> guid; - sLog.outDebug( "WORLD: CMSG_GAMEOBJECT_QUERY - (%u) Missing gameobject info for (GUID: %u, ENTRY: %u)", uint32(GUID_LOPART(guid)), guid, entryID ); + sLog.outDebug( "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", + GUID_LOPART(guid), entryID ); WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 4 ); data << uint32(entryID | 0x80000000); SendPacket( &data ); diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 0334332..5b68829 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -85,12 +85,13 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data ) uint64 guid; recv_data >> guid; - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u",guid ); + sLog.outDebug ("WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid)); Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_NONE); if (!pCreature) { - sLog.outDebug( "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug ("WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", + GUID_LOPART(guid)); return; } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 3135413..0beaf61 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5622,7 +5622,7 @@ void Aura::PeriodicTick() pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist); sLog.outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", - GetCasterGUID(), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); + GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size data.append(m_target->GetPackGUID()); @@ -5743,7 +5743,7 @@ void Aura::PeriodicTick() pdamage = uint32(m_target->GetHealth()); sLog.outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", - GetCasterGUID(), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); + GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId(),absorb); pCaster->SendSpellNonMeleeDamageLog(m_target, GetId(), pdamage, GetSpellSchoolMask(GetSpellProto()), absorb, resist, false, 0); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 5077d87..0e08b9c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1870,7 +1870,8 @@ void Spell::EffectTriggerMissileSpell(uint32 effect_idx) if(!spellInfo) { - sLog.outError("EffectTriggerMissileSpell of spell %u: triggering unknown spell id %effect_idx", m_spellInfo->Id,triggered_spell_id); + sLog.outError("EffectTriggerMissileSpell of spell %u (eff: %u): triggering unknown spell id %u", + m_spellInfo->Id,effect_idx,triggered_spell_id); return; } @@ -3184,7 +3185,8 @@ void Spell::EffectSummon(uint32 i) if(!spawnCreature->IsPositionValid()) { - sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %d Y: ^%d)", spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); + sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", + spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); delete spawnCreature; return; } @@ -3614,7 +3616,8 @@ void Spell::EffectSummonGuardian(uint32 i) if(!spawnCreature->IsPositionValid()) { - sLog.outError("ERROR: Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %d Y: ^%d)", spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); + sLog.outError("ERROR: Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", + spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); delete spawnCreature; return; } @@ -4009,7 +4012,8 @@ void Spell::EffectSummonPet(uint32 i) if(!NewSummon->IsPositionValid()) { - sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %d Y: ^%d)", NewSummon->GetGUIDLow(), NewSummon->GetEntry(), NewSummon->GetPositionX(), NewSummon->GetPositionY()); + sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", + NewSummon->GetGUIDLow(), NewSummon->GetEntry(), NewSummon->GetPositionX(), NewSummon->GetPositionY()); delete NewSummon; return; } @@ -5603,7 +5607,8 @@ void Spell::EffectSummonCritter(uint32 i) if(!critter->IsPositionValid()) { - sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %d Y: ^%d)", critter->GetGUIDLow(), critter->GetEntry(), critter->GetPositionX(), critter->GetPositionY()); + sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", + critter->GetGUIDLow(), critter->GetEntry(), critter->GetPositionX(), critter->GetPositionY()); delete critter; return; } diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 7d43e79..3f4a6a8 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -267,7 +267,7 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) recv_data >> guid; - sLog.outDebug( "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", guid); + sLog.outDebug( "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); GameObject *obj = ObjectAccessor::GetGameObject(*_player, guid); if(!obj) diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 8bfd3c5..2cdf080 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -146,7 +146,8 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, if(!IsPositionValid()) { - sLog.outError("ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %d Y: ^%d)",guidlow,x,y); + sLog.outError("ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + guidlow,x,y); return false; } diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index f157234..b123fe4 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -89,8 +89,12 @@ void WaypointManager::Load() if(!MaNGOS::IsValidMapCoord(node.x, node.y, node.z, node.orientation)) { QueryResult *result1 = WorldDatabase.PQuery("SELECT id, map FROM creature WHERE guid = '%u'", id); - if(result1) sLog.outErrorDb("ERROR: Creature (guidlow %d, entry %d) have invalid coordinates in his waypoint %d (X: %d, Y: %d).", id, result1->Fetch()[0].GetUInt32(), point, node.x, node.y); - else sLog.outErrorDb("ERROR: Waypoint path %d, have invalid coordinates in his waypoint %d (X: %d, Y: %d).", id, point, node.x, node.y); + if(result1) + sLog.outErrorDb("ERROR: Creature (guidlow %d, entry %d) have invalid coordinates in his waypoint %d (X: %f, Y: %f).", + id, result1->Fetch()[0].GetUInt32(), point, node.x, node.y); + else + sLog.outErrorDb("ERROR: Waypoint path %d, have invalid coordinates in his waypoint %d (X: %f, Y: %f).", + id, point, node.x, node.y); MaNGOS::NormalizeMapCoord(node.x); MaNGOS::NormalizeMapCoord(node.y); diff --git a/src/game/World.cpp b/src/game/World.cpp index a8bc9a6..4f9dcb0 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -480,7 +480,8 @@ void World::LoadConfigSettings(bool reload) } else if(rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > ATTACK_DISTANCE) { - sLog.outError("TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",rate_values[RATE_TARGET_POS_RECALCULATION_RANGE],ATTACK_DISTANCE,ATTACK_DISTANCE); + sLog.outError("TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", + rate_values[RATE_TARGET_POS_RECALCULATION_RANGE],ATTACK_DISTANCE,ATTACK_DISTANCE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = ATTACK_DISTANCE; } @@ -1153,7 +1154,8 @@ void World::SetInitialWorldSettings() sprintf( isoDate, "%04d-%02d-%02d %02d:%02d:%02d", local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec); - WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', %ld, 0)", isoDate, m_startTime ); + WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', " I64FMTD ", 0)", + isoDate, uint64(m_startTime)); m_timers[WUPDATE_OBJECTS].SetInterval(0); m_timers[WUPDATE_SESSIONS].SetInterval(0); -- 2.11.4.GIT