From 9069e4232fa1b8ad1391450a745f0e1c61f4e67d Mon Sep 17 00:00:00 2001 From: mostlikely4r Date: Tue, 14 Jan 2025 09:12:54 +0100 Subject: [PATCH] Internal: Fixed a linux compilation error and some warnings --- playerbot/ChatHelper.cpp | 2 + playerbot/PlayerbotMgr.cpp | 2 +- playerbot/RandomItemMgr.cpp | 12 ++--- playerbot/RandomPlayerbotFactory.cpp | 2 +- playerbot/RandomPlayerbotMgr.cpp | 49 ++++++++++--------- .../strategy/actions/GenericSpellActions.h | 2 +- playerbot/strategy/values/ItemUsageValue.cpp | 2 +- 7 files changed, 37 insertions(+), 34 deletions(-) diff --git a/playerbot/ChatHelper.cpp b/playerbot/ChatHelper.cpp index 833a33a5..18d830e1 100644 --- a/playerbot/ChatHelper.cpp +++ b/playerbot/ChatHelper.cpp @@ -706,6 +706,8 @@ std::string ChatHelper::formatChat(ChatMsg chat) return "whisper"; case CHAT_MSG_RAID: return "raid"; + default: + return "unknown"; } return "unknown"; diff --git a/playerbot/PlayerbotMgr.cpp b/playerbot/PlayerbotMgr.cpp index 651bf5d8..f21a76a2 100644 --- a/playerbot/PlayerbotMgr.cpp +++ b/playerbot/PlayerbotMgr.cpp @@ -1428,7 +1428,7 @@ void PlayerbotMgr::CheckTellErrors(uint32 elapsed) } out << "|cfff00000: " << text; - ChatHandler(master->GetSession()).PSendSysMessage(out.str().c_str()); + ChatHandler(master->GetSession()).PSendSysMessage("%s", out.str().c_str()); } errors.clear(); } diff --git a/playerbot/RandomItemMgr.cpp b/playerbot/RandomItemMgr.cpp index edc52cd0..0db0d6cc 100644 --- a/playerbot/RandomItemMgr.cpp +++ b/playerbot/RandomItemMgr.cpp @@ -924,9 +924,9 @@ void RandomItemMgr::BuildItemInfoCache() #endif } while (result->NextRow()); } - sLog.outString("Loaded %d vendor items...", vendorItems.size()); - sLog.outString("Loaded %d alliance only vendor items...", allianceItems.size()); - sLog.outString("Loaded %d horde only vendor items...", hordeItems.size()); + sLog.outString("Loaded %d vendor items...", (uint32)vendorItems.size()); + sLog.outString("Loaded %d alliance only vendor items...", (uint32)allianceItems.size()); + sLog.outString("Loaded %d horde only vendor items...", (uint32)hordeItems.size()); // calculate drop source sLog.outString("Loading loot templates..."); @@ -956,7 +956,7 @@ void RandomItemMgr::BuildItemInfoCache() dropMap->insert(std::make_pair(lItem.itemid, -sEntry)); } - sLog.outString("Loaded %d loot templates...", dropMap->size()); + sLog.outString("Loaded %d loot templates...", (uint32)dropMap->size()); sLog.outString("Calculating stat weights for %d items...", sItemStorage.GetMaxEntry()); BarGoLink bar(sItemStorage.GetMaxEntry()); @@ -1219,7 +1219,7 @@ void RandomItemMgr::BuildItemInfoCache() else { cacheInfo->source = ITEM_SOURCE_DROP; - sLog.outDetail("Item: %d, source: creatures drop, number: %d", proto->ItemId, creatures.size()); + sLog.outDetail("Item: %d, source: creatures drop, number: %d", proto->ItemId, (uint32)creatures.size()); } } } @@ -1238,7 +1238,7 @@ void RandomItemMgr::BuildItemInfoCache() else { cacheInfo->source = ITEM_SOURCE_DROP; - sLog.outDetail("Item: %d, source: gameobjects, number: %d", proto->ItemId, gameobjects.size()); + sLog.outDetail("Item: %d, source: gameobjects, number: %d", proto->ItemId, (uint32)gameobjects.size()); } } } diff --git a/playerbot/RandomPlayerbotFactory.cpp b/playerbot/RandomPlayerbotFactory.cpp index 9cac7447..0a6c2fc5 100644 --- a/playerbot/RandomPlayerbotFactory.cpp +++ b/playerbot/RandomPlayerbotFactory.cpp @@ -846,7 +846,7 @@ void RandomPlayerbotFactory::CreateRandomGuilds() } if (newGuilds) - sLog.outString("Total Random Guilds: %d", sPlayerbotAIConfig.randomBotGuilds.size()); + sLog.outString("Total Random Guilds: %d", (uint32)sPlayerbotAIConfig.randomBotGuilds.size()); } std::string RandomPlayerbotFactory::CreateRandomGuildName() diff --git a/playerbot/RandomPlayerbotMgr.cpp b/playerbot/RandomPlayerbotMgr.cpp index d178e394..6a8dae95 100644 --- a/playerbot/RandomPlayerbotMgr.cpp +++ b/playerbot/RandomPlayerbotMgr.cpp @@ -2366,7 +2366,8 @@ std::vector> RandomPlayerbotMgr::RpgLocationsNear(Worl { std::vector> results; float minDist = FLT_MAX; - std::string_view hasZone = "-", wantZone = WorldPosition(pos).getAreaName(true, true); + WorldPosition areaPos(pos); + std::string_view hasZone = "-", wantZone = areaPos.getAreaName(true, true); for (uint32 level = 1; level < sPlayerbotAIConfig.randomBotMaxLevel + 1; level++) { for (uint32 r = 1; r < MAX_RACES; r++) @@ -3100,7 +3101,7 @@ bool RandomPlayerbotMgr::HandlePlayerbotConsoleCommand(ChatHandler* handler, cha ss << "char db ping: " << sRandomPlayerbotMgr.GetDatabaseDelay("CharacterDatabase") << "\n"; ss << "Sessions online: " << sWorld.GetActiveSessionCount(); - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); Player* requester = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (requester) @@ -3365,7 +3366,7 @@ void RandomPlayerbotMgr::PrintStats(uint32 requesterGuid) { Player* requester = GetPlayer(requesterGuid); std::stringstream ss; ss << GetPlayerbotsAmount() << " Random Bots online"; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } std::map alliance, horde; @@ -3494,7 +3495,7 @@ void RandomPlayerbotMgr::PrintStats(uint32 requesterGuid) }); ss.str(""); ss << "Bots level:"; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } uint32 maxLevel = sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); @@ -3508,12 +3509,12 @@ void RandomPlayerbotMgr::PrintStats(uint32 requesterGuid) if (!from) from = 1; ss.str(""); ss << " " << from << ".." << to << ": " << alliance[i] << " alliance, " << horde[i] << " horde"; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } } ss.str(""); ss << "Bots race:"; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } for (uint8 race = RACE_HUMAN; race < MAX_RACES; ++race) @@ -3521,13 +3522,13 @@ void RandomPlayerbotMgr::PrintStats(uint32 requesterGuid) if (perRace[race]) { ss.str(""); ss << " " << ChatHelper::formatRace(race) << ": " << perRace[race]; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } } } ss.str(""); ss << "Bots class:"; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } for (uint8 cls = CLASS_WARRIOR; cls < MAX_CLASSES; ++cls) @@ -3535,29 +3536,29 @@ void RandomPlayerbotMgr::PrintStats(uint32 requesterGuid) if (perClass[cls]) { ss.str(""); ss << " " << ChatHelper::formatClass(cls) << ": " << perClass[cls]; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } } } ss.str(""); ss << "Bots role:"; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " tank: " << tank << ", heal: " << heal << ", dps: " << dps; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << "Bots status:"; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " Active: " << active; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " Moving: " << moving; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } //sLog.outString("Bots to:"); @@ -3568,43 +3569,43 @@ void RandomPlayerbotMgr::PrintStats(uint32 requesterGuid) //sLog.outString(" revive: %d", revive); ss.str(""); ss << " On taxi: " << taxi; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " On mount: " << mounted; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " In combat: " << combat; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " Dead: " << dead; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " AFK: " << afk; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << "Bots questing:"; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " Picking quests: " << stateCount[(uint8)TravelState::TRAVEL_STATE_TRAVEL_PICK_UP_QUEST] + stateCount[(uint8)TravelState::TRAVEL_STATE_WORK_PICK_UP_QUEST]; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " Doing quests: " << stateCount[(uint8)TravelState::TRAVEL_STATE_TRAVEL_DO_QUEST] + stateCount[(uint8)TravelState::TRAVEL_STATE_WORK_DO_QUEST]; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " Completing quests: " << stateCount[(uint8)TravelState::TRAVEL_STATE_TRAVEL_HAND_IN_QUEST] + stateCount[(uint8)TravelState::TRAVEL_STATE_WORK_HAND_IN_QUEST]; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } ss.str(""); ss << " Idling: " << stateCount[(uint8)TravelState::TRAVEL_STATE_IDLE]; - sLog.outString("s%", ss.str().c_str()); + sLog.outString("%s", ss.str().c_str()); if (requester) { requester->SendMessageToPlayer(ss.str()); } } diff --git a/playerbot/strategy/actions/GenericSpellActions.h b/playerbot/strategy/actions/GenericSpellActions.h index 402c3045..beaddffc 100644 --- a/playerbot/strategy/actions/GenericSpellActions.h +++ b/playerbot/strategy/actions/GenericSpellActions.h @@ -436,7 +436,7 @@ namespace ai virtual std::string GetReachActionName() override { return "reach spell"; } virtual std::string GetTargetName() override { return "cc target"; } virtual std::string GetTargetQualifier() override { return GetSpellName(); } - virtual ActionThreatType getThreatType() { return ActionThreatType::ACTION_THREAT_NONE; } + virtual ActionThreatType getThreatType() override { return ActionThreatType::ACTION_THREAT_NONE; } }; class CastProtectSpellAction : public CastSpellAction diff --git a/playerbot/strategy/values/ItemUsageValue.cpp b/playerbot/strategy/values/ItemUsageValue.cpp index 4e261874..7ac6ef9d 100644 --- a/playerbot/strategy/values/ItemUsageValue.cpp +++ b/playerbot/strategy/values/ItemUsageValue.cpp @@ -1158,7 +1158,7 @@ std::vector ItemUsageValue::GetAllReagentItemIdsForCraftingSkillsVector( std::vector> ItemUsageValue::GetAllReagentItemIdsForCraftingItem(ItemPrototype const* proto) { - auto& items = m_craftingReagentItemIdsForCraftableItem.find(proto->ItemId); + auto items = m_craftingReagentItemIdsForCraftableItem.find(proto->ItemId); if (items == m_craftingReagentItemIdsForCraftableItem.end()) return {};