From 5977860e090b7264de3cf13a8a1bfe356d61cd3d Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Tue, 2 Sep 2014 22:06:02 +0200 Subject: [PATCH 1/3] Fix broken coin placement in levelup dialog + possible memleak --- apps/openmw/mwgui/levelupdialog.cpp | 20 +++++++++----------- apps/openmw/mwgui/widgets.cpp | 2 ++ files/mygui/openmw_enchanting_dialog.layout | 1 - 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp index 32aaa6e71..021613571 100644 --- a/apps/openmw/mwgui/levelupdialog.cpp +++ b/apps/openmw/mwgui/levelupdialog.cpp @@ -83,13 +83,19 @@ namespace MWGui { const int coinSpacing = 10; int curX = mCoinBox->getWidth()/2 - (coinSpacing*(mCoinCount - 1) + 16*mCoinCount)/2; - for (unsigned int i=0; idetachFromWidget(); image->attachToWidget(mCoinBox); - image->setCoord(MyGUI::IntCoord(curX,0,16,16)); - curX += 16+coinSpacing; + if (i < mCoinCount) + { + mCoins[i]->setVisible(true); + image->setCoord(MyGUI::IntCoord(curX,0,16,16)); + curX += 16+coinSpacing; + } + else + mCoins[i]->setVisible(false); } } @@ -178,14 +184,6 @@ namespace MWGui mCoinCount = std::min(sMaxCoins, availableAttributes); - for (unsigned int i = 0; i < sMaxCoins; i++) - { - if (i < mCoinCount) - mCoins[i]->attachToWidget(mCoinBox); - else - mCoins[i]->detachFromWidget(); - } - mSpentAttributes.clear(); resetCoins(); diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp index 853b90b0f..1264185a2 100644 --- a/apps/openmw/mwgui/widgets.cpp +++ b/apps/openmw/mwgui/widgets.cpp @@ -559,6 +559,8 @@ namespace MWGui Box * b = dynamic_cast(parent); if (b) b->notifyChildrenSizeChanged(); + else + break; parent = parent->getParent(); } } diff --git a/files/mygui/openmw_enchanting_dialog.layout b/files/mygui/openmw_enchanting_dialog.layout index 188c538e4..811a214e3 100644 --- a/files/mygui/openmw_enchanting_dialog.layout +++ b/files/mygui/openmw_enchanting_dialog.layout @@ -92,7 +92,6 @@ - From 386bb98fd2fa9f2157ca5e684896da51fd1141cb Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Wed, 3 Sep 2014 03:03:03 +0200 Subject: [PATCH 2/3] Do not attach coin widgets to a box --- apps/openmw/mwgui/levelupdialog.cpp | 5 ++-- apps/openmw/mwgui/levelupdialog.hpp | 1 + files/mygui/openmw_levelup_dialog.layout | 36 ++++++++++++------------ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp index 021613571..272a9b27b 100644 --- a/apps/openmw/mwgui/levelupdialog.cpp +++ b/apps/openmw/mwgui/levelupdialog.cpp @@ -26,6 +26,7 @@ namespace MWGui getWidget(mLevelText, "LevelText"); getWidget(mLevelDescription, "LevelDescription"); getWidget(mCoinBox, "Coins"); + getWidget(mAssignWidget, "AssignWidget"); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onOkButtonClicked); @@ -106,13 +107,13 @@ namespace MWGui { MyGUI::ImageBox* image = mCoins[i]; image->detachFromWidget(); - image->attachToWidget(mMainWidget); + image->attachToWidget(mAssignWidget); int attribute = mSpentAttributes[i]; int xdiff = mAttributeMultipliers[attribute]->getCaption() == "" ? 0 : 20; - MyGUI::IntPoint pos = mAttributes[attribute]->getAbsolutePosition() - mMainWidget->getAbsolutePosition() - MyGUI::IntPoint(22+xdiff,0); + MyGUI::IntPoint pos = mAttributes[attribute]->getAbsolutePosition() - mAssignWidget->getAbsolutePosition() - MyGUI::IntPoint(22+xdiff,0); pos.top += (mAttributes[attribute]->getHeight() - image->getHeight())/2; image->setPosition(pos); } diff --git a/apps/openmw/mwgui/levelupdialog.hpp b/apps/openmw/mwgui/levelupdialog.hpp index 5ca9c8c75..e5edbd53c 100644 --- a/apps/openmw/mwgui/levelupdialog.hpp +++ b/apps/openmw/mwgui/levelupdialog.hpp @@ -20,6 +20,7 @@ namespace MWGui MyGUI::EditBox* mLevelDescription; MyGUI::Widget* mCoinBox; + MyGUI::Widget* mAssignWidget; std::vector mAttributes; std::vector mAttributeValues; diff --git a/files/mygui/openmw_levelup_dialog.layout b/files/mygui/openmw_levelup_dialog.layout index 07e1e560b..190f16e5d 100644 --- a/files/mygui/openmw_levelup_dialog.layout +++ b/files/mygui/openmw_levelup_dialog.layout @@ -16,7 +16,7 @@ - + @@ -27,20 +27,20 @@ - + - - - - - - - - + + + + + + + + - + @@ -54,7 +54,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -97,7 +97,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -139,7 +139,7 @@ - + From e0e561a105538b064d324a2ff970c5b6a1d87b4a Mon Sep 17 00:00:00 2001 From: cc9cii Date: Fri, 5 Sep 2014 07:17:31 +1000 Subject: [PATCH 3/3] Add icon to windows exe --- apps/openmw/CMakeLists.txt | 2 ++ files/openmw/openmw.rc | 1 + 2 files changed, 3 insertions(+) create mode 100644 files/openmw/openmw.rc diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index babde8ff2..e2c1ef5c9 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -2,6 +2,8 @@ set(GAME main.cpp engine.cpp + + ${CMAKE_SOURCE_DIR}/files/openmw/openmw.rc ) if (ANDROID) diff --git a/files/openmw/openmw.rc b/files/openmw/openmw.rc new file mode 100644 index 000000000..325c182c3 --- /dev/null +++ b/files/openmw/openmw.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "../launcher/images/openmw.ico"