Warning fixes

This commit is contained in:
brainiac 2025-12-28 02:12:41 -08:00
parent e12c52a66a
commit 94ca0c44d1
25 changed files with 54 additions and 72 deletions

View File

@ -132,7 +132,7 @@ void WorldContentService::SetContentFlags(const std::vector<ContentFlagsReposito
bool WorldContentService::IsContentFlagEnabled(const std::string &content_flag) bool WorldContentService::IsContentFlagEnabled(const std::string &content_flag)
{ {
for (auto &f: GetContentFlags()) { for (auto &f: GetContentFlags()) {
if (f.flag_name == content_flag && f.enabled == true) { if (f.flag_name == content_flag && f.enabled == 1) {
return true; return true;
} }
} }
@ -147,7 +147,7 @@ bool WorldContentService::IsContentFlagEnabled(const std::string &content_flag)
bool WorldContentService::IsContentFlagDisabled(const std::string &content_flag) bool WorldContentService::IsContentFlagDisabled(const std::string &content_flag)
{ {
for (auto &f: GetContentFlags()) { for (auto &f: GetContentFlags()) {
if (f.flag_name == content_flag && f.enabled == false) { if (f.flag_name == content_flag && f.enabled == 0) {
return true; return true;
} }
} }

View File

@ -125,6 +125,6 @@ uint32 CRC32::Update(const uint8* buf, uint32 bufsize, uint32 crc32var) {
return crc32var; return crc32var;
} }
inline void CRC32::Calc(const uint8 byte, uint32& crc32var) { void CRC32::Calc(const uint8 byte, uint32& crc32var) {
crc32var = ((crc32var) >> 8) ^ CRC32Table[(byte) ^ ((crc32var) & 0x000000FF)]; crc32var = ((crc32var) >> 8) ^ CRC32Table[(byte) ^ ((crc32var) & 0x000000FF)];
} }

View File

@ -56,12 +56,12 @@ void PlayerEventLogs::Init()
auto s = PlayerEventLogSettingsRepository::All(*m_database); auto s = PlayerEventLogSettingsRepository::All(*m_database);
std::vector<int> db{}; std::vector<int> db{};
db.reserve(s.size()); db.reserve(s.size());
for (auto &e: s) { for (auto& e: s) {
if (e.id >= PlayerEvent::MAX) { if (e.id >= PlayerEvent::MAX) {
continue; continue;
} }
m_settings[e.id] = e; m_settings[e.id] = e;
db.emplace_back(e.id); db.emplace_back(static_cast<int>(e.id));
} }
std::vector<PlayerEventLogSettingsRepository::PlayerEventLogSettings> settings_to_insert{}; std::vector<PlayerEventLogSettingsRepository::PlayerEventLogSettings> settings_to_insert{};

View File

@ -349,7 +349,7 @@ bool EQ::InventoryProfile::SwapItem(
fail_state = swapLevel; fail_state = swapLevel;
return false; return false;
} }
if (source_item_instance->IsEvolving() > 0) { if (source_item_instance->IsEvolving()) {
source_item_instance->SetEvolveEquipped(true); source_item_instance->SetEvolveEquipped(true);
} }
} }

View File

@ -320,6 +320,7 @@ bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augment_type, uint8 slot) co
} }
return ( return (
slot < invaug::SOCKET_COUNT &&
( (
augment_type == -1 || augment_type == -1 ||
( (

View File

@ -49,9 +49,9 @@ namespace EQ
WebsocketException(const std::string &msg) WebsocketException(const std::string &msg)
: _msg(msg.empty() ? "Unknown Error" : 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(); return _msg.c_str();
} }
private: private:

View File

@ -4120,8 +4120,8 @@ namespace RoF2
std::begin(emu->items), std::begin(emu->items),
std::end(emu->items), std::end(emu->items),
std::begin(eq->items), std::begin(eq->items),
[&](const uint32 x) { [&](uint64 x) {
return x; return static_cast<uint32>(x);
} }
); );
std::copy_n( std::copy_n(

View File

@ -94,7 +94,7 @@ namespace
{ {
m_cache.insert(std::make_pair( m_cache.insert(std::make_pair(
key_type(src, target, dynamic_id, object_offset) key_type(src, target, dynamic_id, object_offset)
, cache_entry(offset, distance) , cache_entry(offset, static_cast<int>(distance))
)); ));
} }

View File

@ -319,14 +319,14 @@ void SharedTaskManager::LoadSharedTaskState()
// load character data for member names // load character data for member names
std::vector<CharacterDataRepository::CharacterData> shared_task_character_data; std::vector<CharacterDataRepository::CharacterData> shared_task_character_data;
if (!shared_task_members_data.empty()) { if (!shared_task_members_data.empty()) {
std::vector<uint32_t> character_ids; std::vector<int64_t> character_ids;
for (const auto &m: shared_task_members_data) { for (const BaseSharedTaskMembersRepository::SharedTaskMembers& m: shared_task_members_data) {
character_ids.emplace_back(m.character_id); character_ids.emplace_back(m.character_id);
} }
shared_task_character_data = CharacterDataRepository::GetWhere( shared_task_character_data = CharacterDataRepository::GetWhere(
*m_database, *m_database,
fmt::format("id IN ({})", Strings::Join(character_ids, ",")) fmt::format("id IN ({})", fmt::join(character_ids, ","))
); );
} }

View File

@ -10580,12 +10580,12 @@ void Bot::LoadDefaultBotSettings() {
m_bot_spell_settings.push_back(t); 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, '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), GetDefaultSpellTypeHold(i, bot_stance),
GetDefaultSpellTypeDelay(i, bot_stance), GetDefaultSpellTypeDelay(i, bot_stance),
GetDefaultSpellTypeMinThreshold(i, bot_stance), GetDefaultSpellTypeMinThreshold(i, bot_stance),
GetDefaultSpellTypeMaxThreshold(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, '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)); 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) { BotSpell Bot::GetSpellByHealType(uint16 spell_type, Mob* tar) {
if (!TargetValidation(tar)) { if (!TargetValidation(tar)) {
BotSpell result; BotSpell result{};
return result; return result;
} }

View File

@ -458,9 +458,7 @@ uint32 helper_bot_create(Client *bot_owner, std::string bot_name, uint8 bot_clas
return bot_id; return bot_id;
} }
bool available_flag = false; bool available_flag = database.botdb.QueryNameAvailability(bot_name);
!database.botdb.QueryNameAvailability(bot_name, available_flag);
if (!available_flag) { if (!available_flag) {
bot_owner->Message( bot_owner->Message(

View File

@ -24,26 +24,22 @@
class Client; class Client;
class Seperator; class Seperator;
namespace
{
#define HP_RATIO_DELTA 5.0f #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)) #define VALIDATECLASSID(x) ((x >= Class::Warrior && x <= Class::Berserker) ? (x) : (0))
// ActionableTarget action_type // ActionableTarget action_type
#define FRIENDLY true #define FRIENDLY true
#define ENEMY false #define ENEMY false
enum { enum {
AFT_None = 0, AFT_None = 0,
AFT_Value, AFT_Value,
AFT_GenderRace, AFT_GenderRace,
AFT_Race AFT_Race
}; };
}
namespace MyBots namespace MyBots
{ {

View File

@ -145,9 +145,7 @@ void bot_command_clone(Client *c, const Seperator *sep)
return; return;
} }
bool available_flag = false; bool available_flag = database.botdb.QueryNameAvailability(bot_name);
!database.botdb.QueryNameAvailability(bot_name, available_flag);
if (!available_flag) { if (!available_flag) {
c->Message( c->Message(

View File

@ -82,8 +82,8 @@ void bot_command_pickpocket(Client *c, const Seperator *sep)
} }
// Setup variables for calcs // Setup variables for calcs
bool steal_skill = my_bot->GetSkill(EQ::skills::SkillPickPockets); uint16 steal_skill = my_bot->GetSkill(EQ::skills::SkillPickPockets);
bool steal_chance = steal_skill * 100 / (5 * over_level + 5); int steal_chance = steal_skill * 100 / (5 * over_level + 5);
// Determine whether to steal money or an item. // Determine whether to steal money or an item.
uint32 money[6] = { uint32 money[6] = {

View File

@ -228,7 +228,7 @@ bool BotDatabase::LoadBotSpellCastingChances()
return true; return true;
} }
bool BotDatabase::QueryNameAvailability(const std::string& bot_name, bool& available_flag) bool BotDatabase::QueryNameAvailability(const std::string& bot_name)
{ {
if ( if (
bot_name.empty() || bot_name.empty() ||
@ -239,8 +239,6 @@ bool BotDatabase::QueryNameAvailability(const std::string& bot_name, bool& avail
return false; return false;
} }
available_flag = true;
return true; return true;
} }

View File

@ -45,7 +45,7 @@ public:
/* Bot functions */ /* 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 QueryBotCount(const uint32 owner_id, int class_id, uint32& bot_count, uint32& bot_class_count);
bool LoadBotsList(const uint32 owner_id, std::list<BotsAvailableList>& bots_list, bool by_account = false); bool LoadBotsList(const uint32 owner_id, std::list<BotsAvailableList>& bots_list, bool by_account = false);

View File

@ -252,7 +252,7 @@ void Client::LoadDefaultBotSettings() {
m_bot_spell_settings.push_back(t); m_bot_spell_settings.push_back(t);
LogBotSettingsDetail("{} says, 'Setting defaults for {} ({}) [#{}]'", GetCleanName(), t.name, t.short_name, t.spell_type); 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), GetDefaultSpellTypeDelay(i),
GetDefaultSpellTypeMinThreshold(i), GetDefaultSpellTypeMaxThreshold(i)); GetDefaultSpellTypeMinThreshold(i), GetDefaultSpellTypeMaxThreshold(i));
} }

View File

@ -3239,10 +3239,10 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
} }
if ( if (
((tobe_auged->IsAugmentSlotAvailable(new_aug->GetAugmentType(), in_augment->augment_index)) != -1) && tobe_auged->IsAugmentSlotAvailable(new_aug->GetAugmentType(), static_cast<uint8>(in_augment->augment_index)) &&
tobe_auged->AvailableWearSlot(new_aug->GetItem()->Slots) tobe_auged->AvailableWearSlot(new_aug->GetItem()->Slots)
) { ) {
old_aug = tobe_auged->RemoveAugment(in_augment->augment_index); old_aug = tobe_auged->RemoveAugment(static_cast<uint8>(in_augment->augment_index));
if (old_aug) { // An old augment was removed in order to be replaced with the new one (augment_action 2) if (old_aug) { // An old augment was removed in order to be replaced with the new one (augment_action 2)
CalcBonuses(); CalcBonuses();

View File

@ -1108,7 +1108,7 @@ void EntityList::AESpell(
max_targets_allowed = RuleI(Spells, TargetedAOEMaxTargets); max_targets_allowed = RuleI(Spells, TargetedAOEMaxTargets);
} else if ( } else if (
IsPBAESpell(spell_id) && IsPBAESpell(spell_id) &&
IsDetrimentalSpell && is_detrimental_spell &&
!is_npc !is_npc
) { ) {
max_targets_allowed = RuleI(Spells, PointBlankAOEMaxTargets); max_targets_allowed = RuleI(Spells, PointBlankAOEMaxTargets);

View File

@ -447,15 +447,15 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
if (arg1 == "setinclineinc") { if (arg1 == "setinclineinc") {
std::map<float, std::string> incline_values = { std::map<float, std::string> incline_values = {
{.01, "Upright"}, {.01f, "Upright"},
{63.75, "45 Degrees",}, {63.75f, "45 Degrees",},
{130, "90 Degrees"}, {130.f, "90 Degrees"},
{192.5, "135 Degrees"}, {192.5f, "135 Degrees"},
{255, "180 Degrees"}, {255.f, "180 Degrees"},
{321.25, "225 Degrees"}, {321.25f, "225 Degrees"},
{385, "270 Degrees"}, {385.f, "270 Degrees"},
{448.75, "315 Degrees"}, {448.75f, "315 Degrees"},
{512.5, "360 Degrees"} {512.5f, "360 Degrees"}
}; };
std::vector<std::string> incline_normal_options; std::vector<std::string> incline_normal_options;

View File

@ -624,7 +624,7 @@ void Client::SendGuildMemberRankAltBanker(uint32 guild_id, uint32 rank, std::str
out->guild_id = guild_id; out->guild_id = guild_id;
out->rank_ = rank; 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)); strn0cpy(out->player_name, player_name.c_str(), sizeof(out->player_name));
QueuePacket(outapp); QueuePacket(outapp);
@ -792,7 +792,7 @@ void EntityList::SendGuildMemberRankAltBanker(uint32 guild_id, uint32 rank_, std
out->guild_id = guild_id; out->guild_id = guild_id;
out->rank_ = rank_; 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)); strn0cpy(out->player_name, player_name.c_str(), sizeof(out->player_name));
c.second->QueuePacket(outapp); c.second->QueuePacket(outapp);

View File

@ -151,7 +151,7 @@ static const struct luaL_Reg bit_funcs[] = {
*/ */
#define BAD_SAR (bsar(-8, 2) != (SBits)-2) #define BAD_SAR (bsar(-8, 2) != (SBits)-2)
int luaopen_bit(lua_State *L) int luaopen_bit_embed(lua_State *L)
{ {
UBits b; UBits b;
lua_pushnumber(L, (lua_Number)1437217655L); lua_pushnumber(L, (lua_Number)1437217655L);

View File

@ -17,4 +17,6 @@
*/ */
#pragma once #pragma once
int luaopen_bit(lua_State *L); struct lua_State;
int luaopen_bit_embed(lua_State *L);

View File

@ -2779,18 +2779,7 @@ bool QuestManager::createBot(const char *name, const char *lastname, uint8 level
} }
std::string test_name = name; std::string test_name = name;
bool available_flag = false; bool available_flag = database.botdb.QueryNameAvailability(test_name);
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;
}
if (!available_flag) { if (!available_flag) {
initiator->Message( initiator->Message(
Chat::White, Chat::White,

View File

@ -621,7 +621,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
} }
if (spec.tradeskill == EQ::skills::SkillAlchemy) { 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."); user->Message(Chat::Red, "This tradeskill can only be performed by a shaman.");
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
user->QueuePacket(outapp); user->QueuePacket(outapp);
@ -646,7 +646,7 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
} }
} }
else if (spec.tradeskill == EQ::skills::SkillMakePoison) { 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."); user->Message(Chat::Red, "Only rogues can mix poisons.");
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0); auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
user->QueuePacket(outapp); user->QueuePacket(outapp);