From 94ca0c44d1f6fa392c35aed4c78cf74b9701e795 Mon Sep 17 00:00:00 2001 From: brainiac Date: Sun, 28 Dec 2025 02:12:41 -0800 Subject: [PATCH] Warning fixes --- common/content/world_content_service.cpp | 4 ++-- common/crc32.cpp | 2 +- common/events/player_event_logs.cpp | 4 ++-- common/inventory_profile.cpp | 2 +- common/item_instance.cpp | 1 + common/net/websocket_server.h | 4 ++-- common/patches/rof2.cpp | 4 ++-- libs/luabind/src/inheritance.cpp | 2 +- world/shared_task_manager.cpp | 6 +++--- zone/bot.cpp | 6 +++--- zone/bot_command.cpp | 4 +--- zone/bot_command.h | 20 ++++++++------------ zone/bot_commands/bot_bot.cpp | 4 +--- zone/bot_commands/bot_pickpocket.cpp | 4 ++-- zone/bot_database.cpp | 4 +--- zone/bot_database.h | 2 +- zone/client_bot.cpp | 2 +- zone/client_packet.cpp | 4 ++-- zone/effects.cpp | 2 +- zone/gm_commands/door_manipulation.cpp | 18 +++++++++--------- zone/guild.cpp | 4 ++-- zone/lua_bit.cpp | 2 +- zone/lua_bit.h | 4 +++- zone/questmgr.cpp | 13 +------------ zone/tradeskills.cpp | 4 ++-- 25 files changed, 54 insertions(+), 72 deletions(-) diff --git a/common/content/world_content_service.cpp b/common/content/world_content_service.cpp index 1b650b82d..3bc28a7a2 100644 --- a/common/content/world_content_service.cpp +++ b/common/content/world_content_service.cpp @@ -132,7 +132,7 @@ void WorldContentService::SetContentFlags(const std::vector> 8) ^ CRC32Table[(byte) ^ ((crc32var) & 0x000000FF)]; } diff --git a/common/events/player_event_logs.cpp b/common/events/player_event_logs.cpp index fd756f37a..421e9d926 100644 --- a/common/events/player_event_logs.cpp +++ b/common/events/player_event_logs.cpp @@ -56,12 +56,12 @@ void PlayerEventLogs::Init() auto s = PlayerEventLogSettingsRepository::All(*m_database); std::vector db{}; db.reserve(s.size()); - for (auto &e: s) { + for (auto& e: s) { if (e.id >= PlayerEvent::MAX) { continue; } m_settings[e.id] = e; - db.emplace_back(e.id); + db.emplace_back(static_cast(e.id)); } std::vector settings_to_insert{}; diff --git a/common/inventory_profile.cpp b/common/inventory_profile.cpp index e8cb95d84..2ec3d6a08 100644 --- a/common/inventory_profile.cpp +++ b/common/inventory_profile.cpp @@ -349,7 +349,7 @@ bool EQ::InventoryProfile::SwapItem( fail_state = swapLevel; return false; } - if (source_item_instance->IsEvolving() > 0) { + if (source_item_instance->IsEvolving()) { source_item_instance->SetEvolveEquipped(true); } } diff --git a/common/item_instance.cpp b/common/item_instance.cpp index 4862d103c..39271ba8e 100644 --- a/common/item_instance.cpp +++ b/common/item_instance.cpp @@ -320,6 +320,7 @@ bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augment_type, uint8 slot) co } return ( + slot < invaug::SOCKET_COUNT && ( augment_type == -1 || ( diff --git a/common/net/websocket_server.h b/common/net/websocket_server.h index d69399a8f..9d0eee91b 100644 --- a/common/net/websocket_server.h +++ b/common/net/websocket_server.h @@ -49,9 +49,9 @@ namespace EQ WebsocketException(const std::string &msg) : _msg(msg.empty() ? "Unknown Error" : msg) { } - ~WebsocketException() throw() {} + ~WebsocketException() noexcept {} - virtual char const *what() const throw() { + virtual char const *what() const noexcept override { return _msg.c_str(); } private: diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 32eff3fd2..992f0c538 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -4120,8 +4120,8 @@ namespace RoF2 std::begin(emu->items), std::end(emu->items), std::begin(eq->items), - [&](const uint32 x) { - return x; + [&](uint64 x) { + return static_cast(x); } ); std::copy_n( diff --git a/libs/luabind/src/inheritance.cpp b/libs/luabind/src/inheritance.cpp index 2e2ec902a..b70db95e3 100644 --- a/libs/luabind/src/inheritance.cpp +++ b/libs/luabind/src/inheritance.cpp @@ -94,7 +94,7 @@ namespace { m_cache.insert(std::make_pair( key_type(src, target, dynamic_id, object_offset) - , cache_entry(offset, distance) + , cache_entry(offset, static_cast(distance)) )); } diff --git a/world/shared_task_manager.cpp b/world/shared_task_manager.cpp index d3a9bd2b9..b9692d222 100644 --- a/world/shared_task_manager.cpp +++ b/world/shared_task_manager.cpp @@ -319,14 +319,14 @@ void SharedTaskManager::LoadSharedTaskState() // load character data for member names std::vector shared_task_character_data; if (!shared_task_members_data.empty()) { - std::vector character_ids; - for (const auto &m: shared_task_members_data) { + std::vector character_ids; + for (const BaseSharedTaskMembersRepository::SharedTaskMembers& m: shared_task_members_data) { character_ids.emplace_back(m.character_id); } shared_task_character_data = CharacterDataRepository::GetWhere( *m_database, - fmt::format("id IN ({})", Strings::Join(character_ids, ",")) + fmt::format("id IN ({})", fmt::join(character_ids, ",")) ); } diff --git a/zone/bot.cpp b/zone/bot.cpp index b543ea246..8c3f668a4 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10580,12 +10580,12 @@ void Bot::LoadDefaultBotSettings() { m_bot_spell_settings.push_back(t); LogBotSettingsDetail("{} says, 'Setting defaults for {} ({}) [#{}] - [{} [#{}] stance]'", GetCleanName(), t.name, t.short_name, t.spell_type, Stance::GetName(bot_stance), bot_stance); - LogBotSettingsDetail("{} says, 'Hold = [{}] | Delay = [{}ms] | MinThreshold = [{}\%] | MaxThreshold = [{}\%]'", GetCleanName(), + LogBotSettingsDetail("{} says, 'Hold = [{}] | Delay = [{}ms] | MinThreshold = [{}%] | MaxThreshold = [{}%]'", GetCleanName(), GetDefaultSpellTypeHold(i, bot_stance), GetDefaultSpellTypeDelay(i, bot_stance), GetDefaultSpellTypeMinThreshold(i, bot_stance), GetDefaultSpellTypeMaxThreshold(i, bot_stance)); - LogBotSettingsDetail("{} says, 'AggroCheck = [{}] | MinManaPCT = [{}\%] | MaxManaPCT = [{}\%] | MinHPPCT = [{}\% | MaxHPPCT = [{}\%]'", GetCleanName(), GetDefaultSpellTypeAggroCheck(i, bot_stance), GetDefaultSpellTypeMinManaLimit(i, bot_stance), GetDefaultSpellTypeMaxManaLimit(i, bot_stance), GetDefaultSpellTypeMinHPLimit(i, bot_stance), GetDefaultSpellTypeMaxHPLimit(i, bot_stance)); + LogBotSettingsDetail("{} says, 'AggroCheck = [{}] | MinManaPCT = [{}%] | MaxManaPCT = [{}%] | MinHPPCT = [{}% | MaxHPPCT = [{}%]'", GetCleanName(), GetDefaultSpellTypeAggroCheck(i, bot_stance), GetDefaultSpellTypeMinManaLimit(i, bot_stance), GetDefaultSpellTypeMaxManaLimit(i, bot_stance), GetDefaultSpellTypeMinHPLimit(i, bot_stance), GetDefaultSpellTypeMaxHPLimit(i, bot_stance)); LogBotSettingsDetail("{} says, 'IdlePriority = [{}] | EngagedPriority = [{}] | PursuePriority = [{}]'", GetCleanName(), GetDefaultSpellTypeIdlePriority(i, GetClass(), bot_stance), GetDefaultSpellTypeEngagedPriority(i, GetClass(), bot_stance), GetDefaultSpellTypePursuePriority(i, GetClass(), bot_stance)); LogBotSettingsDetail("{} says, 'TargetCount = [{}] | AnnounceCast = [{}]'", GetCleanName(), GetDefaultSpellTypeAEOrGroupTargetCount(i, bot_stance), GetDefaultSpellTypeAnnounceCast(i, bot_stance)); } @@ -10636,7 +10636,7 @@ void Bot::SetBotSpellRecastTimer(uint16 spell_type, Mob* tar, bool precast) { BotSpell Bot::GetSpellByHealType(uint16 spell_type, Mob* tar) { if (!TargetValidation(tar)) { - BotSpell result; + BotSpell result{}; return result; } diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index decd84e07..594d28b47 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -458,9 +458,7 @@ uint32 helper_bot_create(Client *bot_owner, std::string bot_name, uint8 bot_clas return bot_id; } - bool available_flag = false; - - !database.botdb.QueryNameAvailability(bot_name, available_flag); + bool available_flag = database.botdb.QueryNameAvailability(bot_name); if (!available_flag) { bot_owner->Message( diff --git a/zone/bot_command.h b/zone/bot_command.h index 382d39794..6f3de0544 100644 --- a/zone/bot_command.h +++ b/zone/bot_command.h @@ -24,26 +24,22 @@ class Client; class Seperator; - -namespace -{ #define HP_RATIO_DELTA 5.0f - enum { EffectIDFirst = 1, EffectIDLast = 12 }; +enum { EffectIDFirst = 1, EffectIDLast = 12 }; #define VALIDATECLASSID(x) ((x >= Class::Warrior && x <= Class::Berserker) ? (x) : (0)) - // ActionableTarget action_type +// ActionableTarget action_type #define FRIENDLY true #define ENEMY false - enum { - AFT_None = 0, - AFT_Value, - AFT_GenderRace, - AFT_Race - }; -} +enum { + AFT_None = 0, + AFT_Value, + AFT_GenderRace, + AFT_Race +}; namespace MyBots { diff --git a/zone/bot_commands/bot_bot.cpp b/zone/bot_commands/bot_bot.cpp index e1f881bdf..32e99bbcd 100644 --- a/zone/bot_commands/bot_bot.cpp +++ b/zone/bot_commands/bot_bot.cpp @@ -145,9 +145,7 @@ void bot_command_clone(Client *c, const Seperator *sep) return; } - bool available_flag = false; - - !database.botdb.QueryNameAvailability(bot_name, available_flag); + bool available_flag = database.botdb.QueryNameAvailability(bot_name); if (!available_flag) { c->Message( diff --git a/zone/bot_commands/bot_pickpocket.cpp b/zone/bot_commands/bot_pickpocket.cpp index 216d9d078..a58aaa333 100644 --- a/zone/bot_commands/bot_pickpocket.cpp +++ b/zone/bot_commands/bot_pickpocket.cpp @@ -82,8 +82,8 @@ void bot_command_pickpocket(Client *c, const Seperator *sep) } // Setup variables for calcs - bool steal_skill = my_bot->GetSkill(EQ::skills::SkillPickPockets); - bool steal_chance = steal_skill * 100 / (5 * over_level + 5); + uint16 steal_skill = my_bot->GetSkill(EQ::skills::SkillPickPockets); + int steal_chance = steal_skill * 100 / (5 * over_level + 5); // Determine whether to steal money or an item. uint32 money[6] = { diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 5982fc0a7..a8f1952cb 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -228,7 +228,7 @@ bool BotDatabase::LoadBotSpellCastingChances() return true; } -bool BotDatabase::QueryNameAvailability(const std::string& bot_name, bool& available_flag) +bool BotDatabase::QueryNameAvailability(const std::string& bot_name) { if ( bot_name.empty() || @@ -239,8 +239,6 @@ bool BotDatabase::QueryNameAvailability(const std::string& bot_name, bool& avail return false; } - available_flag = true; - return true; } diff --git a/zone/bot_database.h b/zone/bot_database.h index 31ad3368d..8fb2aa1d2 100644 --- a/zone/bot_database.h +++ b/zone/bot_database.h @@ -45,7 +45,7 @@ public: /* Bot functions */ - bool QueryNameAvailability(const std::string& bot_name, bool& available_flag); + bool QueryNameAvailability(const std::string& bot_name); bool QueryBotCount(const uint32 owner_id, int class_id, uint32& bot_count, uint32& bot_class_count); bool LoadBotsList(const uint32 owner_id, std::list& bots_list, bool by_account = false); diff --git a/zone/client_bot.cpp b/zone/client_bot.cpp index 0e914c145..eebb63556 100644 --- a/zone/client_bot.cpp +++ b/zone/client_bot.cpp @@ -252,7 +252,7 @@ void Client::LoadDefaultBotSettings() { m_bot_spell_settings.push_back(t); LogBotSettingsDetail("{} says, 'Setting defaults for {} ({}) [#{}]'", GetCleanName(), t.name, t.short_name, t.spell_type); - LogBotSettingsDetail("{} says, 'Delay = [{}ms] | MinThreshold = [{}\%] | MaxThreshold = [{}\%]'", GetCleanName(), + LogBotSettingsDetail("{} says, 'Delay = [{}ms] | MinThreshold = [{}%] | MaxThreshold = [{}%]'", GetCleanName(), GetDefaultSpellTypeDelay(i), GetDefaultSpellTypeMinThreshold(i), GetDefaultSpellTypeMaxThreshold(i)); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 87a4a4009..7fc5174f6 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3239,10 +3239,10 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) } if ( - ((tobe_auged->IsAugmentSlotAvailable(new_aug->GetAugmentType(), in_augment->augment_index)) != -1) && + tobe_auged->IsAugmentSlotAvailable(new_aug->GetAugmentType(), static_cast(in_augment->augment_index)) && tobe_auged->AvailableWearSlot(new_aug->GetItem()->Slots) ) { - old_aug = tobe_auged->RemoveAugment(in_augment->augment_index); + old_aug = tobe_auged->RemoveAugment(static_cast(in_augment->augment_index)); if (old_aug) { // An old augment was removed in order to be replaced with the new one (augment_action 2) CalcBonuses(); diff --git a/zone/effects.cpp b/zone/effects.cpp index 06c18a41e..0d0b1ce34 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -1108,7 +1108,7 @@ void EntityList::AESpell( max_targets_allowed = RuleI(Spells, TargetedAOEMaxTargets); } else if ( IsPBAESpell(spell_id) && - IsDetrimentalSpell && + is_detrimental_spell && !is_npc ) { max_targets_allowed = RuleI(Spells, PointBlankAOEMaxTargets); diff --git a/zone/gm_commands/door_manipulation.cpp b/zone/gm_commands/door_manipulation.cpp index 91472865c..b518a8c06 100644 --- a/zone/gm_commands/door_manipulation.cpp +++ b/zone/gm_commands/door_manipulation.cpp @@ -447,15 +447,15 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep) if (arg1 == "setinclineinc") { std::map incline_values = { - {.01, "Upright"}, - {63.75, "45 Degrees",}, - {130, "90 Degrees"}, - {192.5, "135 Degrees"}, - {255, "180 Degrees"}, - {321.25, "225 Degrees"}, - {385, "270 Degrees"}, - {448.75, "315 Degrees"}, - {512.5, "360 Degrees"} + {.01f, "Upright"}, + {63.75f, "45 Degrees",}, + {130.f, "90 Degrees"}, + {192.5f, "135 Degrees"}, + {255.f, "180 Degrees"}, + {321.25f, "225 Degrees"}, + {385.f, "270 Degrees"}, + {448.75f, "315 Degrees"}, + {512.5f, "360 Degrees"} }; std::vector incline_normal_options; diff --git a/zone/guild.cpp b/zone/guild.cpp index 54775c62a..5ab0a6681 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -624,7 +624,7 @@ void Client::SendGuildMemberRankAltBanker(uint32 guild_id, uint32 rank, std::str out->guild_id = guild_id; out->rank_ = rank; - out->alt_banker = (alt << 1) | banker; + out->alt_banker = (alt ? 2 : 0) | (banker ? 1 : 0); strn0cpy(out->player_name, player_name.c_str(), sizeof(out->player_name)); QueuePacket(outapp); @@ -792,7 +792,7 @@ void EntityList::SendGuildMemberRankAltBanker(uint32 guild_id, uint32 rank_, std out->guild_id = guild_id; out->rank_ = rank_; - out->alt_banker = (alt << 1) | banker; + out->alt_banker = (alt ? 2 : 0) | (banker ? 1 : 0); strn0cpy(out->player_name, player_name.c_str(), sizeof(out->player_name)); c.second->QueuePacket(outapp); diff --git a/zone/lua_bit.cpp b/zone/lua_bit.cpp index 5c8af6fcc..c0712529b 100644 --- a/zone/lua_bit.cpp +++ b/zone/lua_bit.cpp @@ -151,7 +151,7 @@ static const struct luaL_Reg bit_funcs[] = { */ #define BAD_SAR (bsar(-8, 2) != (SBits)-2) -int luaopen_bit(lua_State *L) +int luaopen_bit_embed(lua_State *L) { UBits b; lua_pushnumber(L, (lua_Number)1437217655L); diff --git a/zone/lua_bit.h b/zone/lua_bit.h index 10dfdb06c..e3f163cbc 100644 --- a/zone/lua_bit.h +++ b/zone/lua_bit.h @@ -17,4 +17,6 @@ */ #pragma once -int luaopen_bit(lua_State *L); +struct lua_State; + +int luaopen_bit_embed(lua_State *L); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 73990d562..92de69567 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2779,18 +2779,7 @@ bool QuestManager::createBot(const char *name, const char *lastname, uint8 level } std::string test_name = name; - bool available_flag = false; - if (!database.botdb.QueryNameAvailability(test_name, available_flag)) { - initiator->Message( - Chat::White, - fmt::format( - "Failed to query name availability for '{}'.", - test_name - ).c_str() - ); - return false; - } - + bool available_flag = database.botdb.QueryNameAvailability(test_name); if (!available_flag) { initiator->Message( Chat::White, diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 049bcf590..14efb1762 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -621,7 +621,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac } if (spec.tradeskill == EQ::skills::SkillAlchemy) { - if (!user->GetClass() == Class::Shaman) { + if (user->GetClass() != Class::Shaman) { user->Message(Chat::Red, "This tradeskill can only be performed by a shaman."); auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); user->QueuePacket(outapp); @@ -646,7 +646,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac } } else if (spec.tradeskill == EQ::skills::SkillMakePoison) { - if (!user->GetClass() == Class::Rogue) { + if (user->GetClass() != Class::Rogue) { user->Message(Chat::Red, "Only rogues can mix poisons."); auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); user->QueuePacket(outapp);