Skip to content

Commit

Permalink
Internal: Fixed a linux compilation error and some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlikely4r committed Jan 14, 2025
1 parent b544cae commit 9069e42
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 34 deletions.
2 changes: 2 additions & 0 deletions playerbot/ChatHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,8 @@ std::string ChatHelper::formatChat(ChatMsg chat)
return "whisper";
case CHAT_MSG_RAID:
return "raid";
default:
return "unknown";
}

return "unknown";
Expand Down
2 changes: 1 addition & 1 deletion playerbot/PlayerbotMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
12 changes: 6 additions & 6 deletions playerbot/RandomItemMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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...");
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
}
}
}
Expand All @@ -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());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion playerbot/RandomPlayerbotFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
49 changes: 25 additions & 24 deletions playerbot/RandomPlayerbotMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,8 @@ std::vector<std::pair<uint32, uint32>> RandomPlayerbotMgr::RpgLocationsNear(Worl
{
std::vector<std::pair<uint32, uint32>> 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++)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<uint32, int> alliance, horde;
Expand Down Expand Up @@ -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);
Expand All @@ -3508,56 +3509,56 @@ 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)
{
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)
{
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:");
Expand All @@ -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()); }
}

Expand Down
2 changes: 1 addition & 1 deletion playerbot/strategy/actions/GenericSpellActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion playerbot/strategy/values/ItemUsageValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ std::vector<uint32> ItemUsageValue::GetAllReagentItemIdsForCraftingSkillsVector(

std::vector<std::pair<uint32, uint32>> 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 {};
Expand Down

0 comments on commit 9069e42

Please sign in to comment.