Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
beats-dh committed Mar 31, 2024
1 parent 68c1f40 commit 312188a
Show file tree
Hide file tree
Showing 23 changed files with 42 additions and 45 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ endif()


# === IPO ===
option(OPTIONS_ENABLE_IPO "Check and Enable interprocedural optimization (IPO/LTO)" ON)
if(OPTIONS_ENABLE_IPO)
log_option_enabled("IPO/LTO")
if(MSVC)
log_option_enabled("IPO/LTO")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /GL")
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /LTCG")
set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /LTCG")
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /LTCG")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /LTCG")
else()
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR CMAKE_BUILD_TYPE STREQUAL "Release")
log_option_enabled("IPO/LTO")
include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT output)
if(result)
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/BaseConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ if (MSVC)

add_compile_options(/MP /FS /Zf /EHsc)
else()
add_compile_options(-Wno-unused-parameter -Wno-sign-compare)
add_compile_options(-Wno-unused-parameter -Wno-sign-compare -Wno-switch -Wno-implicit-fallthrough -Wno-extra)
endif()

## Link compilation files to build/bin folder, else link to the main dir
Expand Down
3 changes: 2 additions & 1 deletion src/canary_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ void CanaryServer::loadModules() {
// If "USE_ANY_DATAPACK_FOLDER" is set to true then you can choose any datapack folder for your server
const auto useAnyDatapack = g_configManager().getBoolean(USE_ANY_DATAPACK_FOLDER, __FUNCTION__);
auto datapackName = g_configManager().getString(DATA_DIRECTORY, __FUNCTION__);
if (!useAnyDatapack && (datapackName != "data-canary" && datapackName != "data-otservbr-global" || datapackName != "data-otservbr-global" && datapackName != "data-canary")) {
if (!useAnyDatapack && ((datapackName != "data-canary" && datapackName != "data-otservbr-global") || (datapackName != "data-otservbr-global" && datapackName != "data-canary")))
{
throw FailedToInitializeCanary(fmt::format(
"The datapack folder name '{}' is wrong, please select valid "
"datapack name 'data-canary' or 'data-otservbr-global "
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ void Creature::onDeath() {
}
}

bool killedByPlayer = mostDamageCreature && mostDamageCreature->getPlayer() || mostDamageCreatureMaster && mostDamageCreatureMaster->getPlayer();
bool killedByPlayer = (mostDamageCreature && mostDamageCreature->getPlayer()) || (mostDamageCreatureMaster && mostDamageCreatureMaster->getPlayer());
if (getPlayer()) {
g_metrics().addCounter(
"player_death",
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7804,7 +7804,7 @@ bool Player::setAccount(uint32_t accountId) {
}

uint8_t Player::getAccountType() const {
return account ? account->getAccountType() : AccountType::ACCOUNT_TYPE_NORMAL;
return static_cast<uint8_t>(account ? account->getAccountType() : AccountType::ACCOUNT_TYPE_NORMAL);
}

uint32_t Player::getAccountId() const {
Expand Down
10 changes: 5 additions & 5 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5379,7 +5379,7 @@ void Game::playerSetManagedContainer(uint32_t playerId, ObjectCategory_t categor

std::shared_ptr<Container> container = thing->getContainer();
auto allowConfig = g_configManager().getBoolean(TOGGLE_GOLD_POUCH_ALLOW_ANYTHING, __FUNCTION__) || g_configManager().getBoolean(TOGGLE_GOLD_POUCH_QUICKLOOT_ONLY, __FUNCTION__);
if (!container || (container->getID() == ITEM_GOLD_POUCH && category != OBJECTCATEGORY_GOLD) && !allowConfig) {
if (!container || ((container->getID() == ITEM_GOLD_POUCH && category != OBJECTCATEGORY_GOLD) && !allowConfig)) {
player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
return;
}
Expand Down Expand Up @@ -8076,7 +8076,7 @@ void Game::playerLeaveParty(uint32_t playerId) {
}

std::shared_ptr<Party> party = player->getParty();
if (!party || player->hasCondition(CONDITION_INFIGHT) && !player->getZoneType() == ZONE_PROTECTION) {
if (!party || (player->hasCondition(CONDITION_INFIGHT) && !player->getZoneType() == ZONE_PROTECTION)) {
player->sendTextMessage(TextMessage(MESSAGE_FAILURE, "You cannot leave party, contact the administrator."));
return;
}
Expand Down Expand Up @@ -8749,7 +8749,7 @@ bool checkCanInitCreateMarketOffer(std::shared_ptr<Player> player, uint8_t type,
return false;
}

if (amount == 0 || !it.stackable && amount > 2000 || it.stackable && amount > 64000) {
if (amount == 0 || (!it.stackable && amount > 2000) || (it.stackable && amount > 64000)) {
offerStatus << "Failed to load amount " << amount << " for player " << player->getName();
return false;
}
Expand Down Expand Up @@ -8968,7 +8968,7 @@ void Game::playerAcceptMarketOffer(uint32_t playerId, uint32_t timestamp, uint16
return;
}

if (amount == 0 || !it.stackable && amount > 2000 || it.stackable && amount > 64000 || amount > offer.amount) {
if (amount == 0 || (!it.stackable && amount > 2000) || (it.stackable && amount > 64000) || amount > offer.amount) {
offerStatus << "Invalid offer amount " << amount << " for player " << player->getName();
return;
}
Expand Down Expand Up @@ -9539,7 +9539,7 @@ void Game::playerRotatePodium(uint32_t playerId, const Position &pos, uint8_t st
bool isPodiumOfRenown = itemId == ITEM_PODIUM_OF_RENOWN1 || itemId == ITEM_PODIUM_OF_RENOWN2;
if (!isPodiumOfRenown) {
auto lookTypeExAttribute = item->getCustomAttribute("LookTypeEx");
if (!isMonsterVisible || podiumRaceId == 0 || lookTypeExAttribute && lookTypeExAttribute->getInteger() == 39003) {
if (!isMonsterVisible || podiumRaceId == 0 || (lookTypeExAttribute && lookTypeExAttribute->getInteger() == 39003)) {
player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/game/scheduling/events_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ bool EventsScheduler::loadScheduleEventFromXml() {
int daysMath = ((timePtr->tm_year + 1900) * 365) + ((timePtr->tm_mon + 1) * 30) + (timePtr->tm_mday);

// Keep track of loaded scripts to check for duplicates
int count = 0;
phmap::flat_hash_set<std::string_view> loadedScripts;
std::map<std::string, EventRates> eventsOnSameDay;
for (const auto &eventNode : doc.child("events").children()) {
Expand Down
2 changes: 1 addition & 1 deletion src/io/functions/iologindata_save_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ bool IOLoginDataSave::savePlayerBosstiary(std::shared_ptr<Player> player) {

// Bosstiary tracker
PropWriteStream stream;
for (const auto monsterType : player->getCyclopediaMonsterTrackerSet(true)) {
for (const auto &monsterType : player->getCyclopediaMonsterTrackerSet(true)) {
if (!monsterType) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/io/iologindata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ uint8_t IOLoginData::getAccountType(uint32_t accountId) {

void IOLoginData::updateOnlineStatus(uint32_t guid, bool login) {
static phmap::flat_hash_map<uint32_t, bool> updateOnline;
if (login && updateOnline.find(guid) != updateOnline.end() || guid <= 0) {
if ((login && updateOnline.find(guid) != updateOnline.end()) || guid <= 0) {
return;
}

Expand Down
7 changes: 0 additions & 7 deletions src/io/iomap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ void IOMap::parseTileArea(FileStream &stream, Map &map, const Position &pos) {
const uint16_t base_y = stream.getU16();
const uint8_t base_z = stream.getU8();

bool tileIsStatic = false;

while (stream.startNode()) {
const uint8_t tileType = stream.getU8();
Expand Down Expand Up @@ -166,9 +165,6 @@ void IOMap::parseTileArea(FileStream &stream, Map &map, const Position &pos) {
const auto &iType = Item::items[id];

if (!tile->isHouse() || (!iType.isBed() && !iType.isTrashHolder())) {
if (iType.blockSolid) {
tileIsStatic = true;
}

const auto item = std::make_shared<BasicItem>();
item->id = id;
Expand All @@ -194,9 +190,6 @@ void IOMap::parseTileArea(FileStream &stream, Map &map, const Position &pos) {

const auto &iType = Item::items[id];

if (iType.blockSolid) {
tileIsStatic = true;
}

const auto item = std::make_shared<BasicItem>();
item->id = id;
Expand Down
2 changes: 1 addition & 1 deletion src/items/containers/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ bool Container::isInsideContainerWithId(const uint16_t id) {
}

bool Container::isAnyKindOfRewardChest() {
return getID() == ITEM_REWARD_CHEST || getID() == ITEM_REWARD_CONTAINER && getParent() && getParent()->getContainer() && getParent()->getContainer()->getID() == ITEM_REWARD_CHEST || isBrowseFieldAndHoldsRewardChest();
return getID() == ITEM_REWARD_CHEST || (getID() == ITEM_REWARD_CONTAINER && getParent() && getParent()->getContainer() && getParent()->getContainer()->getID() == ITEM_REWARD_CHEST) || isBrowseFieldAndHoldsRewardChest();
}

bool Container::isAnyKindOfRewardContainer() {
Expand Down
2 changes: 1 addition & 1 deletion src/items/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3218,7 +3218,7 @@ std::shared_ptr<Item> Item::transform(uint16_t itemId, uint16_t itemCount /*= -1
}

std::shared_ptr<Item> newItem;
if (itemCount == -1) {
if (itemCount == 0) {
newItem = Item::CreateItem(itemId, 1);
} else {
newItem = Item::CreateItem(itemId, itemCount);
Expand Down
4 changes: 2 additions & 2 deletions src/items/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ ReturnValue Tile::queryAdd(int32_t, const std::shared_ptr<Thing> &thing, uint32_
if (ground) {
const ItemType &iiType = Item::items[ground->getID()];
if (iiType.blockSolid) {
if (!iiType.pickupable && iiType.type != ITEM_TYPE_TRASHHOLDER || item->isMagicField() || item->isBlocking()) {
if ((!iiType.pickupable && iiType.type != ITEM_TYPE_TRASHHOLDER) || item->isMagicField() || item->isBlocking()) {
if (!item->isPickupable() && !item->isCarpet()) {
return RETURNVALUE_NOTENOUGHROOM;
}
Expand Down Expand Up @@ -1575,7 +1575,7 @@ void Tile::internalAddThing(uint32_t, std::shared_ptr<Thing> thing) {
if (!thing) {
return;
}
for (const auto zone : getZones()) {
for (const auto &zone : getZones()) {
zone->thingAdded(thing);
}

Expand Down
2 changes: 0 additions & 2 deletions src/lua/creature/movement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ void MoveEvents::clear(bool isFromXML /*= false*/) {
for (int moveEventType = 0; moveEventType < MOVE_EVENT_LAST; ++moveEventType) {
auto &eventList = moveEventList.moveEvent[moveEventType];

int originalSize = eventList.size();

eventList.remove_if([&](const std::shared_ptr<MoveEvent> &moveEvent) {
bool removed = moveEvent && moveEvent->isFromXML();
if (removed) {
Expand Down
2 changes: 1 addition & 1 deletion src/lua/creature/movement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class MoveEvent final : public Script, public SharedObject {
}
void addVocEquipMap(std::string vocName) {
uint16_t vocationId = g_vocations().getVocationId(vocName);
if (vocationId != -1) {
if (vocationId != 65535) {
vocEquipMap[vocationId] = true;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/lua/functions/core/game/config_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ void ConfigFunctions::init(lua_State* L) {

#define registerMagicEnumIn(L, tableName, enumValue) \
do { \
auto number = magic_enum::enum_integer(enumValue); \
auto name = magic_enum::enum_name(enumValue).data(); \
registerVariable(L, tableName, name, value); \
} while (0)
Expand Down
2 changes: 1 addition & 1 deletion src/lua/functions/core/game/game_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ int GameFunctions::luaGameGetMonsterTypes(lua_State* L) {
const auto type = g_monsters().monsters;
lua_createtable(L, type.size(), 0);

for (const auto [typeName, mType] : type) {
for (const auto &[typeName, mType] : type) {
pushUserdata<MonsterType>(L, mType);
setMetatable(L, -1, "MonsterType");
lua_setfield(L, -2, typeName.c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/lua/functions/creatures/creature_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int CreatureFunctions::luaCreatureGetEvents(lua_State* L) {
lua_createtable(L, static_cast<int>(eventList.size()), 0);

int index = 0;
for (const auto eventPtr : eventList) {
for (const auto &eventPtr : eventList) {
pushString(L, eventPtr->getName());
lua_rawseti(L, -2, ++index);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lua/functions/creatures/monster/charm_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int CharmFunctions::luaCharmCreate(lua_State* L) {
if (isNumber(L, 2)) {
charmRune_t charmid = getNumber<charmRune_t>(L, 2);
const auto charmList = g_game().getCharmList();
for (const auto charm : charmList) {
for (const auto &charm : charmList) {
if (charm->id == charmid) {
pushUserdata<Charm>(L, charm);
setMetatable(L, -1, "Charm");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ int MonsterSpellFunctions::luaMonsterSpellSetConditionType(lua_State* L) {
const auto spell = getUserdataShared<MonsterSpell>(L, 1);
if (spell) {
auto conditionType = getNumber<uint8_t>(L, 2);
if (conditionType == -1) {
if (conditionType == 254) {
g_logger().error("[{}] trying to register condition type none for monster: {}", __FUNCTION__, spell->name);
reportErrorFunc(fmt::format("trying to register condition type none for monster: {}", spell->name));
pushBoolean(L, false);
Expand Down
2 changes: 1 addition & 1 deletion src/map/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ bool Map::getPathMatching(const std::shared_ptr<Creature> &creature, const Posit
const bool withoutCreature = creature == nullptr;
const auto &tile = neighborNode || withoutCreature ? getTile(pos.x, pos.y, pos.z) : canWalkTo(creature, pos);

if (!tile || !neighborNode && withoutCreature && tile->hasFlag(TILESTATE_BLOCKSOLID)) {
if (!tile || (!neighborNode && withoutCreature && tile->hasFlag(TILESTATE_BLOCKSOLID))) {
continue;
}

Expand Down
13 changes: 10 additions & 3 deletions src/map/spectators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ bool Spectators::checkCache(const SpectatorsCache::FloorData &specData, bool onl
if (checkDistance) {
SpectatorList spectators;
spectators.reserve(creatures.size());
for (const auto creature : *list) {
for (const auto &creature : *list) {
const auto &specPos = creature->getPosition();
if (centerPos.x - specPos.x >= minRangeX
&& centerPos.y - specPos.y >= minRangeY
Expand Down Expand Up @@ -184,7 +184,7 @@ Spectators Spectators::find(const Position &centerPos, bool multifloor, bool onl
for (uint_fast16_t nx = startx1; nx <= endx2; nx += FLOOR_SIZE) {
if (leafE) {
const auto &node_list = (onlyPlayers ? leafE->player_list : leafE->creature_list);
for (const auto creature : node_list) {
for (const auto &creature : node_list) {
const auto &cpos = creature->getPosition();
if (minRangeZ > cpos.z || maxRangeZ < cpos.z) {
continue;
Expand All @@ -211,7 +211,14 @@ Spectators Spectators::find(const Position &centerPos, bool multifloor, bool onl
}

// It is necessary to create the cache even if no spectators is found, so that there is no future query.
auto &cache = cacheFound ? it->second : spectatorsCache.emplace(centerPos, SpectatorsCache { .minRangeX = minRangeX, .maxRangeX = maxRangeX, .minRangeY = minRangeY, .maxRangeY = maxRangeY }).first->second;
auto &cache = cacheFound ? it->second : spectatorsCache.emplace(centerPos, SpectatorsCache{
.minRangeX = minRangeX,
.maxRangeX = maxRangeX,
.minRangeY = minRangeY,
.maxRangeY = maxRangeY,
.creatures = {},
.players= {}
}).first->second;
auto &creaturesCache = onlyPlayers ? cache.players : cache.creatures;
auto &creatureList = (multifloor ? creaturesCache.multiFloor : creaturesCache.floor);
if (creatureList) {
Expand Down
16 changes: 8 additions & 8 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4532,7 +4532,7 @@ void ProtocolGame::sendSaleItemList(const std::vector<ShopBlock> &shopVector, co
msg.addByte(0xEE);
msg.addByte(0x00);
msg.add<uint64_t>(player->getBankBalance());
uint16_t currency = player->getShopOwner() ? player->getShopOwner()->getCurrency() : ITEM_GOLD_COIN;
uint16_t currency = player->getShopOwner() ? player->getShopOwner()->getCurrency() : static_cast<uint16_t>(ITEM_GOLD_COIN);
msg.addByte(0xEE);
if (currency == ITEM_GOLD_COIN) {
msg.addByte(0x01);
Expand Down Expand Up @@ -6638,7 +6638,7 @@ void ProtocolGame::sendOutfitWindow() {
}

std::vector<std::shared_ptr<Mount>> mounts;
for (const auto mount : g_game().mounts.getMounts()) {
for (const auto &mount : g_game().mounts.getMounts()) {
if (player->hasMount(mount)) {
mounts.push_back(mount);
}
Expand Down Expand Up @@ -7256,7 +7256,7 @@ void ProtocolGame::AddCreature(NetworkMessage &msg, std::shared_ptr<Creature> cr
}

auto bubble = creature->getSpeechBubble();
msg.addByte(oldProtocol && bubble == SPEECHBUBBLE_HIRELING ? SPEECHBUBBLE_NONE : bubble);
msg.addByte(oldProtocol && bubble == SPEECHBUBBLE_HIRELING ? static_cast<uint8_t>(SPEECHBUBBLE_NONE) : bubble);
msg.addByte(0xFF); // MARK_UNMARKED
if (!oldProtocol) {
msg.addByte(0x00); // inspection type
Expand Down Expand Up @@ -7539,7 +7539,7 @@ void ProtocolGame::updatePartyTrackerAnalyzer(const std::shared_ptr<Party> party
msg.addByte(static_cast<uint8_t>(party->priceType));

msg.addByte(static_cast<uint8_t>(party->membersData.size()));
for (const std::shared_ptr<PartyAnalyzer> analyzer : party->membersData) {
for (const std::shared_ptr<PartyAnalyzer> &analyzer : party->membersData) {
msg.add<uint32_t>(analyzer->id);
if (std::shared_ptr<Player> member = g_game().getPlayerByID(analyzer->id);
!member || !member->getParty() || member->getParty() != party) {
Expand All @@ -7558,7 +7558,7 @@ void ProtocolGame::updatePartyTrackerAnalyzer(const std::shared_ptr<Party> party
msg.addByte(showNames ? 0x01 : 0x00);
if (showNames) {
msg.addByte(static_cast<uint8_t>(party->membersData.size()));
for (const std::shared_ptr<PartyAnalyzer> analyzer : party->membersData) {
for (const std::shared_ptr<PartyAnalyzer> &analyzer : party->membersData) {
msg.add<uint32_t>(analyzer->id);
msg.addString(analyzer->name, "ProtocolGame::updatePartyTrackerAnalyzer - analyzer->name");
}
Expand Down Expand Up @@ -8397,23 +8397,23 @@ void ProtocolGame::parseSendBosstiarySlots() {
std::string boostedBossName = g_ioBosstiary().getBoostedBossName();
const auto mTypeBoosted = g_monsters().getMonsterType(boostedBossName);
auto boostedBossRace = mTypeBoosted ? mTypeBoosted->info.bosstiaryRace : BosstiaryRarity_t::BOSS_INVALID;
auto isValidBoostedBoss = boostedBossId == 0 || boostedBossRace >= BosstiaryRarity_t::RARITY_BANE && boostedBossRace <= BosstiaryRarity_t::RARITY_NEMESIS;
auto isValidBoostedBoss = boostedBossId == 0 || (boostedBossRace >= BosstiaryRarity_t::RARITY_BANE && boostedBossRace <= BosstiaryRarity_t::RARITY_NEMESIS);
if (!isValidBoostedBoss) {
g_logger().error("[{}] The boosted boss '{}' has an invalid race", __FUNCTION__, boostedBossName);
return;
}

const auto mTypeSlotOne = g_ioBosstiary().getMonsterTypeByBossRaceId((uint16_t)bossIdSlotOne);
auto bossRaceSlotOne = mTypeSlotOne ? mTypeSlotOne->info.bosstiaryRace : BosstiaryRarity_t::BOSS_INVALID;
auto isValidBossSlotOne = bossIdSlotOne == 0 || bossRaceSlotOne >= BosstiaryRarity_t::RARITY_BANE && bossRaceSlotOne <= BosstiaryRarity_t::RARITY_NEMESIS;
auto isValidBossSlotOne = bossIdSlotOne == 0 || (bossRaceSlotOne >= BosstiaryRarity_t::RARITY_BANE && bossRaceSlotOne <= BosstiaryRarity_t::RARITY_NEMESIS);
if (!isValidBossSlotOne) {
g_logger().error("[{}] boss slot1 with race id '{}' has an invalid race", __FUNCTION__, bossIdSlotOne);
return;
}

const auto mTypeSlotTwo = g_ioBosstiary().getMonsterTypeByBossRaceId((uint16_t)bossIdSlotTwo);
auto bossRaceSlotTwo = mTypeSlotTwo ? mTypeSlotTwo->info.bosstiaryRace : BosstiaryRarity_t::BOSS_INVALID;
auto isValidBossSlotTwo = bossIdSlotTwo == 0 || bossRaceSlotTwo >= BosstiaryRarity_t::RARITY_BANE && bossRaceSlotTwo <= BosstiaryRarity_t::RARITY_NEMESIS;
auto isValidBossSlotTwo = bossIdSlotTwo == 0 || (bossRaceSlotTwo >= BosstiaryRarity_t::RARITY_BANE && bossRaceSlotTwo <= BosstiaryRarity_t::RARITY_NEMESIS);
if (!isValidBossSlotTwo) {
g_logger().error("[{}] boss slot1 with race id '{}' has an invalid race", __FUNCTION__, bossIdSlotTwo);
return;
Expand Down

0 comments on commit 312188a

Please sign in to comment.