From eb81cc7908c184fd11168c921a1e73df7ed275f2 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Tue, 23 Sep 2025 23:47:27 +0100 Subject: [PATCH] More GCC Ubuntu warnings --- apps/openmw/mwgui/charactercreation.cpp | 25 ++++++++++++++++++++----- apps/openmw/mwgui/class.cpp | 4 ++-- apps/openmw/mwgui/itemchargeview.cpp | 2 +- apps/openmw/mwgui/race.cpp | 4 ++-- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index 860608cb0c..42109a7c28 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -158,6 +158,7 @@ namespace MWGui switch (id) { case GM_Name: + { MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mNameDialog)); mNameDialog = std::make_unique(); mNameDialog->setTextLabel( @@ -167,8 +168,9 @@ namespace MWGui mNameDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onNameDialogDone); mNameDialog->setVisible(true); break; - + } case GM_Race: + { MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mRaceDialog)); mRaceDialog = std::make_unique(mParent, mResourceSystem); mRaceDialog->setNextButtonShow(mCreationStage >= CSE_RaceChosen); @@ -179,8 +181,9 @@ namespace MWGui if (mCreationStage < CSE_NameChosen) mCreationStage = CSE_NameChosen; break; - + } case GM_Class: + { MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mClassChoiceDialog)); mClassChoiceDialog = std::make_unique(); mClassChoiceDialog->eventButtonSelected @@ -189,8 +192,9 @@ namespace MWGui if (mCreationStage < CSE_RaceChosen) mCreationStage = CSE_RaceChosen; break; - + } case GM_ClassPick: + { MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mPickClassDialog)); mPickClassDialog = std::make_unique(); mPickClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen); @@ -201,8 +205,9 @@ namespace MWGui if (mCreationStage < CSE_RaceChosen) mCreationStage = CSE_RaceChosen; break; - + } case GM_Birth: + { MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mBirthSignDialog)); mBirthSignDialog = std::make_unique(); mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen); @@ -213,8 +218,9 @@ namespace MWGui if (mCreationStage < CSE_ClassChosen) mCreationStage = CSE_ClassChosen; break; - + } case GM_ClassCreate: + { if (mCreateClassDialog == nullptr) { mCreateClassDialog = std::make_unique(); @@ -228,7 +234,9 @@ namespace MWGui if (mCreationStage < CSE_RaceChosen) mCreationStage = CSE_RaceChosen; break; + } case GM_ClassGenerate: + { mGenerateClassStep = 0; mGenerateClass = ESM::RefId(); mGenerateClassSpecializations[0] = 0; @@ -238,7 +246,9 @@ namespace MWGui if (mCreationStage < CSE_RaceChosen) mCreationStage = CSE_RaceChosen; break; + } case GM_Review: + { MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mReviewDialog)); mReviewDialog = std::make_unique(); @@ -279,6 +289,11 @@ namespace MWGui if (mCreationStage < CSE_BirthSignChosen) mCreationStage = CSE_BirthSignChosen; break; + } + default: + { + Log(Debug::Error) << "Unexpected GuiMode in CharacterCreation::spawnDialog: " << id; + } } } catch (std::exception& e) diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index afb22e3fe9..0c8c9548df 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -127,9 +127,9 @@ namespace MWGui getWidget(mFavoriteAttribute[0], "FavoriteAttribute0"); getWidget(mFavoriteAttribute[1], "FavoriteAttribute1"); - for (char i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) { - char theIndex = '0' + i; + char theIndex = '0' + static_cast(i); getWidget(mMajorSkill[i], std::string("MajorSkill").append(1, theIndex)); getWidget(mMinorSkill[i], std::string("MinorSkill").append(1, theIndex)); } diff --git a/apps/openmw/mwgui/itemchargeview.cpp b/apps/openmw/mwgui/itemchargeview.cpp index 2f49c8a4f3..06d77ed268 100644 --- a/apps/openmw/mwgui/itemchargeview.cpp +++ b/apps/openmw/mwgui/itemchargeview.cpp @@ -272,7 +272,7 @@ namespace MWGui mLines[prevFocus].mIcon->setControllerFocus(false); } - if (newFocus >= 0 && newFocus < mLines.size()) + if (newFocus < mLines.size()) { mLines[newFocus].mText->setTextColour(textColours.link); mLines[newFocus].mIcon->setControllerFocus(true); diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index ded68b39ac..a6f0683cb4 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -359,10 +359,10 @@ namespace MWGui record.mRace = mCurrentRaceId; record.setIsMale(mGenderIndex == 0); - if (mFaceIndex >= 0 && mFaceIndex < mAvailableHeads.size()) + if (mFaceIndex < mAvailableHeads.size()) record.mHead = mAvailableHeads[mFaceIndex]; - if (mHairIndex >= 0 && mHairIndex < mAvailableHairs.size()) + if (mHairIndex < mAvailableHairs.size()) record.mHair = mAvailableHairs[mHairIndex]; try