diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index 293b796d0..682c5af74 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -5298,8 +5298,10 @@ void WriteMyLog(const char* file, int line, const char* format, ...) { std::string CGameMode::HuntTargetText(const RenewQuestOngoingInfo& quest, int index) { std::string text; if (std::strlen(quest.m_huntName[index]) == 0) { - text = static_cast( - g_renewQuestMgr->GetMonsterConditionText(quest.m_huntConditionFlags[index], quest.m_huntMinLevel[index], quest.m_huntMaxLevel[index])); + const int maxLevel = quest.m_huntMaxLevel[index]; + const int minLevel = quest.m_huntMinLevel[index]; + CRenewQuestMgr* manager = g_renewQuestMgr; + text = static_cast(manager->GetMonsterConditionText(quest.m_huntConditionFlags[index], minLevel, maxLevel)); } else { text = static_cast(FormatOwnedString("%s", quest.m_huntName[index])); } diff --git a/Source/Client/Mode/GameModeNotices.cpp b/Source/Client/Mode/GameModeNotices.cpp index d1ef28fd1..104483332 100644 --- a/Source/Client/Mode/GameModeNotices.cpp +++ b/Source/Client/Mode/GameModeNotices.cpp @@ -2005,7 +2005,8 @@ void CGameMode::ReceiveRouletteOpen(const unsigned char* packet) { g_rouletteMgr->m_serial = open->serial; g_rouletteMgr->m_stage = open->stage; g_rouletteMgr->SetAdditionItem(open->additionItemId); - g_rouletteMgr->SetPoints(open->goldPoint, open->silverPoint, open->bronzePoint); + RouletteMgr* manager = g_rouletteMgr; + manager->SetPoints(open->goldPoint, open->silverPoint, open->bronzePoint); const unsigned char index = open->index; g_rouletteMgr->SetResult(index, index != 0xFF, 0); if (index != 0xFF) { diff --git a/Source/Contents/CashEmotion/CashEmotionMgr.cpp b/Source/Contents/CashEmotion/CashEmotionMgr.cpp index 45042ffc9..d354b97c4 100644 --- a/Source/Contents/CashEmotion/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotion/CashEmotionMgr.cpp @@ -1576,7 +1576,8 @@ int CCashEmotionMgr::InsertEmotionVarientListTable(lua_State* state) { const std::string actFile = FromUtf8(luaL_checkstring(state, 5), g_textCodePage); const std::string sprFile = FromUtf8(luaL_checkstring(state, 6), g_textCodePage); - g_cashEmotionMgr->InsertEmotion(packId, emotionId, actionIndex, frameIndex, actFile.c_str(), sprFile.c_str()); + CCashEmotionMgr* manager = g_cashEmotionMgr; + manager->InsertEmotion(packId, emotionId, actionIndex, frameIndex, actFile.c_str(), sprFile.c_str()); return 1; } diff --git a/Source/Contents/Effects/Skills/ClimaxEffect.cpp b/Source/Contents/Effects/Skills/ClimaxEffect.cpp index 9c9548687..c7ca478ea 100644 --- a/Source/Contents/Effects/Skills/ClimaxEffect.cpp +++ b/Source/Contents/Effects/Skills/ClimaxEffect.cpp @@ -105,8 +105,9 @@ void CClimaxEffect::OnProcess() { // FUNCTION: fn_07053 void CClimaxEffect::Render() { for (int index = 0; index < 2; ++index) { - if (this->particles[index]) { - static_cast(this->particles[index])->DrawScreen(static_cast(g_modeMgr.GetGameMode())->camera->frame.view); + CParticle* particle = this->particles[index]; + if (particle) { + static_cast(particle)->DrawScreen(static_cast(g_modeMgr.GetGameMode())->camera->frame.view); } } } diff --git a/Source/Contents/Events/SpecialPopupMgr.cpp b/Source/Contents/Events/SpecialPopupMgr.cpp index c04208e1f..3b07074b9 100644 --- a/Source/Contents/Events/SpecialPopupMgr.cpp +++ b/Source/Contents/Events/SpecialPopupMgr.cpp @@ -130,7 +130,8 @@ int CSpecialPopupMgr::LuaAddDesc(lua_State* state) { const int id = static_cast(lua_tonumber(state, -2)); std::string description = lua_tostring(state, -1); - g_specialPopupMgr->AddDescription(id, description); + CSpecialPopupMgr* manager = g_specialPopupMgr; + manager->AddDescription(id, description); lua_pushboolean(state, 1); lua_pushstring(state, FormatPopupString("good").c_str()); return 2; diff --git a/Source/Contents/Quest/RenewQuestMgr.cpp b/Source/Contents/Quest/RenewQuestMgr.cpp index ce6ad4fd5..6082ea268 100644 --- a/Source/Contents/Quest/RenewQuestMgr.cpp +++ b/Source/Contents/Quest/RenewQuestMgr.cpp @@ -630,7 +630,8 @@ int CRenewQuestMgr::L_AddQuestFilterInfo(lua_State* state) { int CRenewQuestMgr::L_AddQuestIconTooltip(lua_State* state) { const std::string icon = lua_tostring(state, -2); const std::string tooltip = lua_tostring(state, -1); - g_renewQuestMgr->AddIconTooltip(icon, tooltip); + CRenewQuestMgr* manager = g_renewQuestMgr; + manager->AddIconTooltip(icon, tooltip); return 0; } diff --git a/Source/Contents/Tables/TipBoxTitles.cpp b/Source/Contents/Tables/TipBoxTitles.cpp index dd2b876ba..5b84aa357 100644 --- a/Source/Contents/Tables/TipBoxTitles.cpp +++ b/Source/Contents/Tables/TipBoxTitles.cpp @@ -478,7 +478,8 @@ int AddTip(lua_State* state) { const char* title = lua_tostring(state, -3); const double flag = lua_tonumber(state, -2); const char* text = lua_tostring(state, -1); - g_itemTagOwner->AddTip(id, title, flag, text); + CTipBoxMgr* owner = g_itemTagOwner; + owner->AddTip(id, title, flag, text); lua_pushboolean(state, 1); lua_pushstring(state, "good"); return 2; diff --git a/Source/Script/LuaScript.cpp b/Source/Script/LuaScript.cpp index 41933e813..82c4fada8 100644 --- a/Source/Script/LuaScript.cpp +++ b/Source/Script/LuaScript.cpp @@ -581,13 +581,13 @@ int SetAnimatedEmitterInfo(lua_State* state) { int SetEZ2STRInfo(lua_State* state) { EffectLists* effects = g_effectMgr; const int index = static_cast(luaL_checknumber(state, 1)); - const double key = luaL_checknumber(state, 2); + const int key = static_cast(luaL_checknumber(state, 2)); CEffect* effect = effects->At(1412, static_cast(index)); if (!effect) { return 0; } - switch (static_cast(key)) { + switch (key) { case MSG_SET_STR_FILENAME: { std::string name = luaL_checkstring(state, 3); effect->SetResource(reinterpret_cast(name.c_str())); diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index 658b202d2..c47208b6e 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -2598,12 +2598,13 @@ void UIComboBoxV2Wnd::Paint() { // OFFSET: 0x00880CC0 // FUNCTION: fn_11289 std::string UIComboBoxV2Wnd::SelectedText() { - int index = this->selected; + const int selected = this->selected; - if (index < 0 || index >= static_cast(this->list->lines.size())) { + if (selected < 0 || static_cast(this->list->lines.size()) <= selected) { return std::string(); } + int index = selected; return this->list->lines[index].text; } diff --git a/Source/UI/Text/UIStaticText.cpp b/Source/UI/Text/UIStaticText.cpp index 120ae2f1a..0db2ba237 100644 --- a/Source/UI/Text/UIStaticText.cpp +++ b/Source/UI/Text/UIStaticText.cpp @@ -271,7 +271,14 @@ void UIStaticText::SetFont(int family, int height, unsigned char bold, unsigned // OFFSET: 0x008685E0 // FUNCTION: fn_10962 void UIBmpTextButton::AddTextStyle(int state, int height, std::uint32_t color, unsigned char bold, unsigned char shadow, int x, int y) { - BitmapButtonTextStyle style{state, x, y, height, bold, color, shadow}; + BitmapButtonTextStyle style; + style.state = state; + style.x = x; + style.y = y; + style.height = height; + style.color = color; + style.bold = bold; + style.shadow = shadow; if (x == -1000) { const int width = this->TextWidth(this->text.c_str(), this->text.size(), 0, height, bold, 0 @@ -286,7 +293,7 @@ void UIBmpTextButton::AddTextStyle(int state, int height, std::uint32_t color, u } for (const BitmapButtonTextStyle existing : this->styles) { - if (existing.state == state) { + if (state == existing.state) { return; } }