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)
{
for (auto &f: GetContentFlags()) {
if (f.flag_name == content_flag && f.enabled == true) {
if (f.flag_name == content_flag && f.enabled == 1) {
return true;
}
}
@ -147,7 +147,7 @@ bool WorldContentService::IsContentFlagEnabled(const std::string &content_flag)
bool WorldContentService::IsContentFlagDisabled(const std::string &content_flag)
{
for (auto &f: GetContentFlags()) {
if (f.flag_name == content_flag && f.enabled == false) {
if (f.flag_name == content_flag && f.enabled == 0) {
return true;
}
}

View File

@ -125,6 +125,6 @@ uint32 CRC32::Update(const uint8* buf, uint32 bufsize, uint32 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)];
}

View File

@ -56,12 +56,12 @@ void PlayerEventLogs::Init()
auto s = PlayerEventLogSettingsRepository::All(*m_database);
std::vector<int> 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<int>(e.id));
}
std::vector<PlayerEventLogSettingsRepository::PlayerEventLogSettings> settings_to_insert{};

View File

@ -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);
}
}

View File

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

View File

@ -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:

View File

@ -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<uint32>(x);
}
);
std::copy_n(

View File

@ -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<int>(distance))
));
}

View File

@ -319,14 +319,14 @@ void SharedTaskManager::LoadSharedTaskState()
// load character data for member names
std::vector<CharacterDataRepository::CharacterData> shared_task_character_data;
if (!shared_task_members_data.empty()) {
std::vector<uint32_t> character_ids;
for (const auto &m: shared_task_members_data) {
std::vector<int64_t> 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, ","))
);
}

View File

@ -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;
}

View File

@ -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(

View File

@ -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
{

View File

@ -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(

View File

@ -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] = {

View File

@ -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;
}

View File

@ -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<BotsAvailableList>& bots_list, bool by_account = false);

View File

@ -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));
}

View File

@ -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<uint8>(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<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)
CalcBonuses();

View File

@ -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);

View File

@ -447,15 +447,15 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
if (arg1 == "setinclineinc") {
std::map<float, std::string> 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<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->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);

View File

@ -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);

View File

@ -17,4 +17,6 @@
*/
#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;
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,

View File

@ -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);