1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-24 19:56: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
{
mPageDisplay->mFocusItem = (TypesetBookImpl::StyleImpl*)itemStyle;
mPageDisplay->mFocusItem = static_cast<TypesetBookImpl::StyleImpl*>(itemStyle);
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
// logic of taking all.
MWGui::ContainerWindow* containerWindow = (MWGui::ContainerWindow*)MWBase::Environment::get()
.getWindowManager()
->getGuiModeWindows(mGuiMode)
.at(0);
MWGui::ContainerWindow* containerWindow = static_cast<MWGui::ContainerWindow*>(
MWBase::Environment::get().getWindowManager()->getGuiModeWindows(mGuiMode).at(0));
containerWindow->onControllerButtonEvent(arg);
}
else if (mGuiMode == MWGui::GM_Barter)
{
// Offer. Pass the button press to the barter window and let it do the logic
// of making an offer.
MWGui::TradeWindow* tradeWindow = (MWGui::TradeWindow*)MWBase::Environment::get()
.getWindowManager()
->getGuiModeWindows(mGuiMode)
.at(1);
MWGui::TradeWindow* tradeWindow = static_cast<MWGui::TradeWindow*>(
MWBase::Environment::get().getWindowManager()->getGuiModeWindows(mGuiMode).at(1));
tradeWindow->onControllerButtonEvent(arg);
}
}

View file

@ -556,7 +556,7 @@ namespace MWGui
}
else
{
((MyGUI::Button*)button)->setStateSelected(false);
static_cast<MyGUI::Button*>(button)->setStateSelected(false);
}
}
@ -570,7 +570,7 @@ namespace MWGui
}
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);
}
else
mLines.emplace_back(t, (MyGUI::Widget*)nullptr, i);
mLines.emplace_back(t, static_cast<MyGUI::Widget*>(nullptr), i);
t->setStateSelected(spell.mSelected);
}
@ -252,7 +252,7 @@ namespace MWGui
MyGUI::ImageBox* separator = mScrollView->createWidget<MyGUI::ImageBox>(
"MW_HLine", MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 18), MyGUI::Align::Left | MyGUI::Align::Top);
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",
@ -272,7 +272,7 @@ namespace MWGui
mLines.emplace_back(groupWidget, groupWidget2, NoSpellIndex);
}
else
mLines.emplace_back(groupWidget, (MyGUI::Widget*)nullptr, NoSpellIndex);
mLines.emplace_back(groupWidget, static_cast<MyGUI::Widget*>(nullptr), NoSpellIndex);
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
// windows.
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;
const auto it = mTrackedWindows.find(window);