1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-25 23:26:37 +00:00

Replace more C-style casts with C++ variants

This commit is contained in:
Andrew Lanzone 2025-07-18 01:06:25 -07:00
parent a73b803592
commit c53b1bf2c0
5 changed files with 12 additions and 15 deletions

View file

@ -1302,7 +1302,7 @@ namespace MWGui
void setFocusItem(BookTypesetter::Style* itemStyle) override void setFocusItem(BookTypesetter::Style* itemStyle) override
{ {
mPageDisplay->mFocusItem = (TypesetBookImpl::StyleImpl*)itemStyle; mPageDisplay->mFocusItem = static_cast<TypesetBookImpl::StyleImpl*>(itemStyle);
mPageDisplay->dirtyFocusItem(); mPageDisplay->dirtyFocusItem();
} }

View file

@ -1046,20 +1046,16 @@ namespace MWGui
{ {
// Take all. Pass the button press to the container window and let it do the // Take all. Pass the button press to the container window and let it do the
// logic of taking all. // logic of taking all.
MWGui::ContainerWindow* containerWindow = (MWGui::ContainerWindow*)MWBase::Environment::get() MWGui::ContainerWindow* containerWindow = static_cast<MWGui::ContainerWindow*>(
.getWindowManager() MWBase::Environment::get().getWindowManager()->getGuiModeWindows(mGuiMode).at(0));
->getGuiModeWindows(mGuiMode)
.at(0);
containerWindow->onControllerButtonEvent(arg); containerWindow->onControllerButtonEvent(arg);
} }
else if (mGuiMode == MWGui::GM_Barter) else if (mGuiMode == MWGui::GM_Barter)
{ {
// Offer. Pass the button press to the barter window and let it do the logic // Offer. Pass the button press to the barter window and let it do the logic
// of making an offer. // of making an offer.
MWGui::TradeWindow* tradeWindow = (MWGui::TradeWindow*)MWBase::Environment::get() MWGui::TradeWindow* tradeWindow = static_cast<MWGui::TradeWindow*>(
.getWindowManager() MWBase::Environment::get().getWindowManager()->getGuiModeWindows(mGuiMode).at(1));
->getGuiModeWindows(mGuiMode)
.at(1);
tradeWindow->onControllerButtonEvent(arg); tradeWindow->onControllerButtonEvent(arg);
} }
} }

View file

@ -556,7 +556,7 @@ namespace MWGui
} }
else else
{ {
((MyGUI::Button*)button)->setStateSelected(false); static_cast<MyGUI::Button*>(button)->setStateSelected(false);
} }
} }
@ -570,7 +570,7 @@ namespace MWGui
} }
else else
{ {
((MyGUI::Button*)button)->setStateSelected(true); static_cast<MyGUI::Button*>(button)->setStateSelected(true);
} }
} }
} }

View file

@ -143,7 +143,7 @@ namespace MWGui
mLines.emplace_back(t, costChance, i); mLines.emplace_back(t, costChance, i);
} }
else else
mLines.emplace_back(t, (MyGUI::Widget*)nullptr, i); mLines.emplace_back(t, static_cast<MyGUI::Widget*>(nullptr), i);
t->setStateSelected(spell.mSelected); t->setStateSelected(spell.mSelected);
} }
@ -252,7 +252,7 @@ namespace MWGui
MyGUI::ImageBox* separator = mScrollView->createWidget<MyGUI::ImageBox>( MyGUI::ImageBox* separator = mScrollView->createWidget<MyGUI::ImageBox>(
"MW_HLine", MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 18), MyGUI::Align::Left | MyGUI::Align::Top); "MW_HLine", MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 18), MyGUI::Align::Left | MyGUI::Align::Top);
separator->setNeedMouseFocus(false); separator->setNeedMouseFocus(false);
mLines.emplace_back(separator, (MyGUI::Widget*)nullptr, NoSpellIndex); mLines.emplace_back(separator, static_cast<MyGUI::Widget*>(nullptr), NoSpellIndex);
} }
MyGUI::TextBox* groupWidget = mScrollView->createWidget<Gui::TextBox>("SandBrightText", MyGUI::TextBox* groupWidget = mScrollView->createWidget<Gui::TextBox>("SandBrightText",
@ -272,7 +272,7 @@ namespace MWGui
mLines.emplace_back(groupWidget, groupWidget2, NoSpellIndex); mLines.emplace_back(groupWidget, groupWidget2, NoSpellIndex);
} }
else else
mLines.emplace_back(groupWidget, (MyGUI::Widget*)nullptr, NoSpellIndex); mLines.emplace_back(groupWidget, static_cast<MyGUI::Widget*>(nullptr), NoSpellIndex);
mGroupIndices.push_back(mButtons.size()); mGroupIndices.push_back(mButtons.size());
} }

View file

@ -1922,7 +1922,8 @@ namespace MWGui
// If using controller menus, don't persist changes to size of the stats or magic // If using controller menus, don't persist changes to size of the stats or magic
// windows. // windows.
if (Settings::gui().mControllerMenus if (Settings::gui().mControllerMenus
&& (window == (MyGUI::Window*)mStatsWindow || window == (MyGUI::Window*)mSpellWindow)) && (window == mStatsWindow->mMainWidget->castType<MyGUI::Window>()
|| window == mSpellWindow->mMainWidget->castType<MyGUI::Window>()))
return; return;
const auto it = mTrackedWindows.find(window); const auto it = mTrackedWindows.find(window);