From 5ccf6750aba29601ea0523b5d5bd238751811e6d Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 3 Jul 2024 15:46:05 +0000 Subject: [PATCH 1/4] Fix assertion failure --- client/CPlayerInterface.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index f9bf8bcd4..0129cf9c6 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -1225,13 +1225,14 @@ void CPlayerInterface::loadGame( BinaryDeserializer & h ) void CPlayerInterface::moveHero( const CGHeroInstance *h, const CGPath& path ) { + LOG_TRACE(logGlobal); + if (!LOCPLINT->makingTurn) + return; + assert(h); assert(!showingDialog->isBusy()); assert(dialogs.empty()); - LOG_TRACE(logGlobal); - if (!LOCPLINT->makingTurn) - return; if (!h) return; //can't find hero From 2584432b920763fc1c82766f23a80aa768f44147 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 3 Jul 2024 16:52:31 +0000 Subject: [PATCH 2/4] Fix crash on clicking on map when player is not making turn in MP --- client/PlayerLocalState.cpp | 8 +++++++- client/adventureMap/AdventureMapInterface.cpp | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/PlayerLocalState.cpp b/client/PlayerLocalState.cpp index 03e948adb..541b9ff80 100644 --- a/client/PlayerLocalState.cpp +++ b/client/PlayerLocalState.cpp @@ -168,7 +168,7 @@ void PlayerLocalState::setSelection(const CArmedInstance * selection) currentSelection = selection; - if (selection) + if (adventureInt && selection) adventureInt->onSelectionChanged(selection); } @@ -212,6 +212,9 @@ void PlayerLocalState::addWanderingHero(const CGHeroInstance * hero) assert(hero); assert(!vstd::contains(wanderingHeroes, hero)); wanderingHeroes.push_back(hero); + + if (currentSelection == nullptr) + setSelection(hero); } void PlayerLocalState::removeWanderingHero(const CGHeroInstance * hero) @@ -260,6 +263,9 @@ void PlayerLocalState::addOwnedTown(const CGTownInstance * town) assert(town); assert(!vstd::contains(ownedTowns, town)); ownedTowns.push_back(town); + + if (currentSelection == nullptr) + setSelection(town); } void PlayerLocalState::removeOwnedTown(const CGTownInstance * town) diff --git a/client/adventureMap/AdventureMapInterface.cpp b/client/adventureMap/AdventureMapInterface.cpp index dce45e197..996d4d14c 100644 --- a/client/adventureMap/AdventureMapInterface.cpp +++ b/client/adventureMap/AdventureMapInterface.cpp @@ -395,8 +395,6 @@ void AdventureMapInterface::adjustActiveness() void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID) { - LOCPLINT->localState->setSelection(nullptr); - if (playerID == currentPlayerID) return; From 38bcc1e4754c64c9e0d8759e2b9637805dd0d51c Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 3 Jul 2024 16:52:50 +0000 Subject: [PATCH 3/4] Restored logic of up/down key in town interface --- client/windows/CCastleInterface.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index f4bda6475..077269bc8 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -1263,8 +1263,8 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst resdatabar = std::make_shared(ImagePath::builtin("ARESBAR"), 3, 575, 37, 3, 84, 78); townlist = std::make_shared(3, Rect(Point(743, 414), Point(48, 128)), Point(1,16), Point(0, 32), LOCPLINT->localState->getOwnedTowns().size() ); - townlist->setScrollUpButton( std::make_shared( Point(744, 414), AnimationPath::builtin("IAM014"), CButton::tooltipLocalized("core.help.306"), 0, EShortcut::MOVE_UP)); - townlist->setScrollDownButton( std::make_shared( Point(744, 526), AnimationPath::builtin("IAM015"), CButton::tooltipLocalized("core.help.307"), 0, EShortcut::MOVE_DOWN)); + townlist->setScrollUpButton( std::make_shared( Point(744, 414), AnimationPath::builtin("IAM014"), CButton::tooltipLocalized("core.help.306"), 0)); + townlist->setScrollDownButton( std::make_shared( Point(744, 526), AnimationPath::builtin("IAM015"), CButton::tooltipLocalized("core.help.307"), 0)); if(from) townlist->select(from); @@ -1399,6 +1399,12 @@ void CCastleInterface::keyPressed(EShortcut key) { switch(key) { + case EShortcut::MOVE_UP: + townlist->selectPrev(); + break; + case EShortcut::MOVE_DOWN: + townlist->selectNext(); + break; case EShortcut::TOWN_OPEN_FORT: GH.windows().createAndPushWindow(town); break; From 1f8fa3cd0195bb917fc285d29c737db100441adb Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 3 Jul 2024 16:53:02 +0000 Subject: [PATCH 4/4] Bump version code for Android --- android/vcmi-app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/vcmi-app/build.gradle b/android/vcmi-app/build.gradle index 8ab3a895c..3596c5027 100644 --- a/android/vcmi-app/build.gradle +++ b/android/vcmi-app/build.gradle @@ -26,7 +26,7 @@ android { minSdk = qtMinSdkVersion as Integer targetSdk = qtTargetSdkVersion as Integer // ANDROID_TARGET_SDK_VERSION in the CMake project - versionCode 1533 + versionCode 1535 versionName "1.5.3" setProperty("archivesBaseName", "vcmi")