ソースを参照

Merge pull request #4221 from IvanSavenko/bugfixing

[1.5.4] Bugfixing
Ivan Savenko 1 年間 前
コミット
4695c88705

+ 1 - 1
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")

+ 4 - 3
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
 

+ 7 - 1
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)

+ 0 - 2
client/adventureMap/AdventureMapInterface.cpp

@@ -395,8 +395,6 @@ void AdventureMapInterface::adjustActiveness()
 
 void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID)
 {
-	LOCPLINT->localState->setSelection(nullptr);
-
 	if (playerID == currentPlayerID)
 		return;
 

+ 8 - 2
client/windows/CCastleInterface.cpp

@@ -1263,8 +1263,8 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst
 	resdatabar = std::make_shared<CResDataBar>(ImagePath::builtin("ARESBAR"), 3, 575, 37, 3, 84, 78);
 
 	townlist = std::make_shared<CTownList>(3, Rect(Point(743, 414), Point(48, 128)), Point(1,16), Point(0, 32), LOCPLINT->localState->getOwnedTowns().size() );
-	townlist->setScrollUpButton( std::make_shared<CButton>( Point(744, 414), AnimationPath::builtin("IAM014"), CButton::tooltipLocalized("core.help.306"), 0, EShortcut::MOVE_UP));
-	townlist->setScrollDownButton( std::make_shared<CButton>( Point(744, 526), AnimationPath::builtin("IAM015"), CButton::tooltipLocalized("core.help.307"), 0, EShortcut::MOVE_DOWN));
+	townlist->setScrollUpButton( std::make_shared<CButton>( Point(744, 414), AnimationPath::builtin("IAM014"), CButton::tooltipLocalized("core.help.306"), 0));
+	townlist->setScrollDownButton( std::make_shared<CButton>( 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<CFortScreen>(town);
 		break;