diff --git a/Source/Client/Mode/GameModeNotices.cpp b/Source/Client/Mode/GameModeNotices.cpp index 480f8166b..bc90ea41a 100644 --- a/Source/Client/Mode/GameModeNotices.cpp +++ b/Source/Client/Mode/GameModeNotices.cpp @@ -1313,14 +1313,14 @@ struct AchievementStatePacket { // FUNCTION: fn_21601 __declspec(noinline) void ReceiveShortcutPage(int position, const ShortcutPagePayload* payload, std::int16_t bank) { int base = 0; - if (bank == 0) { + if (0 == bank) { g_session.ClearShortcutSlots(); memcpy_s(g_session.m_shortcutSlots, sizeof(g_session.m_shortcutSlots), payload, sizeof(payload->slots)); g_session.ClearSlots06EB(); g_session.quickSlot = payload->slot06EB; g_session.alternateQuickSlot = payload->slot06F2; base = g_session.mainShortcutRow; - } else if (bank == 1) { + } else if (1 == bank) { g_session.ClearSecondaryShortcutSlots(); memcpy_s(g_session.m_secondaryShortcutSlots, sizeof(g_session.m_secondaryShortcutSlots), payload, sizeof(payload->slots)); base = g_session.alternateShortcutRow; @@ -1671,12 +1671,13 @@ void CGameMode::ReceiveLapineBoxResult(std::uint16_t result) { // FUNCTION: fn_22072 void CGameMode::ReceiveRouletteInfo(const unsigned char* packet) { const auto* info = reinterpret_cast(packet); - for (int i = 0; i < 42; ++i) { + const RouletteInfoSlot* s = info->slots; + for (int i = 0; i < 42; ++i, ++s) { RouletteSlot slot; - slot.row = info->slots[i].row; - slot.column = info->slots[i].column; - slot.itemId = info->slots[i].itemId; - slot.count = info->slots[i].count; + slot.row = s->row; + slot.column = s->column; + slot.itemId = s->itemId; + slot.count = s->count; g_rouletteMgr->AddItem(slot); } diff --git a/Source/Client/Session.cpp b/Source/Client/Session.cpp index f5d36327a..db65c039e 100644 --- a/Source/Client/Session.cpp +++ b/Source/Client/Session.cpp @@ -692,7 +692,7 @@ bool CSession::IsNumberWithCommas(char* text) { // FUNCTION: fn_23361 int CSession::FindUnknown0708(int key) const { auto found = this->skillEffectIds.find(key); - if (found != this->skillEffectIds.end()) { + if (this->skillEffectIds.end() != found) { return found->second; } @@ -703,7 +703,7 @@ int CSession::FindUnknown0708(int key) const { // FUNCTION: fn_23362 int CSession::FindUnknown0700(int key) const { auto found = this->skillFollowEffects.find(key); - if (found != this->skillFollowEffects.end()) { + if (this->skillFollowEffects.end() != found) { return found->second; } diff --git a/Source/Contents/Actors/RenderObject.cpp b/Source/Contents/Actors/RenderObject.cpp index b769745d1..fac670b47 100644 --- a/Source/Contents/Actors/RenderObject.cpp +++ b/Source/Contents/Actors/RenderObject.cpp @@ -1922,8 +1922,8 @@ void CRenderObject::DrawPulseOutline( left -= spread; right += spread; } - outline.left = left; outline.right = right; + outline.left = left; outline.bottomRhw = bottomRhw - 0.00005f; outline.topRhw = topRhw - 0.00005f; outline.image = image; diff --git a/Source/Contents/Ground/TerrainHeight.cpp b/Source/Contents/Ground/TerrainHeight.cpp index 2b4de0066..4a08b4f33 100644 --- a/Source/Contents/Ground/TerrainHeight.cpp +++ b/Source/Contents/Ground/TerrainHeight.cpp @@ -68,7 +68,7 @@ void C3dAttr::HeightBounds(const int* rectangle, float& minimum, float& maximum) if (cell) { for (int index = 0; index < 4; ++index) { - if (cell->heights[index] > maximum) { + if (maximum < cell->heights[index]) { maximum = cell->heights[index]; } } diff --git a/Source/Contents/Items/ItemInfo.cpp b/Source/Contents/Items/ItemInfo.cpp index e1dbc0dbf..5460c7768 100644 --- a/Source/Contents/Items/ItemInfo.cpp +++ b/Source/Contents/Items/ItemInfo.cpp @@ -693,13 +693,13 @@ int ReadItemArray(ITEM_INFO* items, int offset, int size, const std::vectormerchantMyShopItems.begin(); it != this->merchantMyShopItems.end(); ++it) { if (it->identity[1] == item.identity[1]) { - if (type == 0) { + if (type != 0) { + this->merchantMyShopItems.erase(it); + } else { it->quantity -= item.quantity; if (it->quantity <= 0) { this->merchantMyShopItems.erase(it); } - } else { - this->merchantMyShopItems.erase(it); } if (refresh == 1) { diff --git a/Source/Contents/RouletteMgr.cpp b/Source/Contents/RouletteMgr.cpp index 11880e3ca..a4768a6f5 100644 --- a/Source/Contents/RouletteMgr.cpp +++ b/Source/Contents/RouletteMgr.cpp @@ -205,7 +205,7 @@ void RouletteMgr::Update() { } if (this->m_cycle > 6) { - if (this->m_frame >= 8 - this->m_stage - this->m_index) { + if (8 - this->m_stage - this->m_index <= this->m_frame) { this->m_resultShown = 1; const int originY = static_cast(g_renderer->viewport.height * 0.5 - 240.0); const int originX = static_cast(g_renderer->viewport.width * 0.5 - 320.0); @@ -216,15 +216,15 @@ void RouletteMgr::Update() { return; } - if (timeGetTime() - this->m_lastTick < this->m_interval) { + if (this->m_interval > timeGetTime() - this->m_lastTick) { return; } } else { - if (timeGetTime() - this->m_lastTick < this->m_interval) { + if (this->m_interval > timeGetTime() - this->m_lastTick) { return; } - if (this->m_frame >= 8 - this->m_stage) { + if (8 - this->m_stage <= this->m_frame) { for (int i = 0; i < 6; ++i) { this->m_quads.current.vertices[i] = this->m_quads.start.vertices[i]; } diff --git a/Source/Contents/SimpleStringMgr.cpp b/Source/Contents/SimpleStringMgr.cpp index 6609ca6a1..154e05336 100644 --- a/Source/Contents/SimpleStringMgr.cpp +++ b/Source/Contents/SimpleStringMgr.cpp @@ -51,12 +51,12 @@ const char* CSimpleStringMgr::GetString(const char* key) { } auto table = this->m_tables.find(type); - if (table == this->m_tables.end()) { + if (this->m_tables.end() == table) { return nullptr; } auto entry = table->second.find(std::string(key)); - if (entry == table->second.end()) { + if (table->second.end() == entry) { return nullptr; } diff --git a/Source/Contents/World/WorldSpatialTree.cpp b/Source/Contents/World/WorldSpatialTree.cpp index 7f10fd1aa..e4579c337 100644 --- a/Source/Contents/World/WorldSpatialTree.cpp +++ b/Source/Contents/World/WorldSpatialTree.cpp @@ -237,7 +237,7 @@ void WorldSpatialTree::RefreshBounds(int depth) { node->minimum[1] = this->minimum[1]; } - if (this->maximum[1] > node->maximum[1]) { + if (node->maximum[1] < this->maximum[1]) { node->maximum[1] = this->maximum[1]; }