Laserlicht hai 1 ano
pai
achega
e86b694b22

+ 11 - 5
client/adventureMap/AdventureMapShortcuts.cpp

@@ -114,7 +114,8 @@ std::vector<AdventureMapShortcutState> AdventureMapShortcuts::getShortcuts()
 		{ EShortcut::ADVENTURE_MOVE_HERO_NW,     optionHeroSelected(),   [this]() { this->moveHeroDirectional({-1, -1}); } },
 		{ EShortcut::ADVENTURE_MOVE_HERO_NN,     optionHeroSelected(),   [this]() { this->moveHeroDirectional({ 0, -1}); } },
 		{ EShortcut::ADVENTURE_MOVE_HERO_NE,     optionHeroSelected(),   [this]() { this->moveHeroDirectional({+1, -1}); } },
-		{ EShortcut::ADVENTURE_SEARCH,           optionSidePanelActive(),[this]() { this->search(); } }
+		{ EShortcut::ADVENTURE_SEARCH,           optionSidePanelActive(),[this]() { this->search(false); } },
+		{ EShortcut::ADVENTURE_SEARCH_CONTINUE,  optionSidePanelActive(),[this]() { this->search(true); } }
 	};
 	return result;
 }
@@ -462,7 +463,7 @@ void AdventureMapShortcuts::zoom( int distance)
 	owner.hotkeyZoom(distance, false);
 }
 
-void AdventureMapShortcuts::search()
+void AdventureMapShortcuts::search(bool next)
 {
 	// get all relevant objects
 	std::vector<ObjectInstanceID> visitableObjInstances;
@@ -501,8 +502,8 @@ void AdventureMapShortcuts::search()
 	for(auto & obj : textCountList)
 		texts.push_back(obj.first + " (" + std::to_string(obj.second) + ")");
 
-	GH.windows().createAndPushWindow<CObjectListWindow>(texts, nullptr, CGI->generaltexth->translate("vcmi.adventureMap.search.hover"), CGI->generaltexth->translate("vcmi.adventureMap.search.help"),
-		[this, textCountList, visitableObjInstances](int index)
+	// function to center element from list on map
+	auto selectObjOnMap = [this, textCountList, visitableObjInstances](int index)
 		{
 			auto selObj = textCountList[index].first;
 
@@ -520,7 +521,12 @@ void AdventureMapShortcuts::search()
 			auto objInst = LOCPLINT->cb->getObjInstance(selVisitableObjInstances[searchPos]);
 			owner.centerOnObject(objInst);
 			searchLast = VLC->objtypeh->getObjectName(objInst->getObjGroupIndex(), objInst->getObjTypeIndex());
-		}, lastSel);
+		};
+
+	if(next)
+		selectObjOnMap(lastSel);
+	else
+		GH.windows().createAndPushWindow<CObjectListWindow>(texts, nullptr, CGI->generaltexth->translate("vcmi.adventureMap.search.hover"), CGI->generaltexth->translate("vcmi.adventureMap.search.help"), [selectObjOnMap](int index){ selectObjOnMap(index); }, lastSel);
 }
 
 void AdventureMapShortcuts::nextObject()

+ 1 - 1
client/adventureMap/AdventureMapShortcuts.h

@@ -76,7 +76,7 @@ class AdventureMapShortcuts
 	void nextTown();
 	void nextObject();
 	void zoom( int distance);
-	void search();
+	void search(bool next);
 	void moveHeroDirectional(const Point & direction);
 
 public:

+ 1 - 0
client/gui/Shortcut.h

@@ -162,6 +162,7 @@ enum class EShortcut
 	ADVENTURE_TO_MAIN_MENU,
 	ADVENTURE_QUIT_GAME,
 	ADVENTURE_SEARCH,
+	ADVENTURE_SEARCH_CONTINUE,
 
 	// Move hero one tile in specified direction. Bound to cursors & numpad buttons
 	ADVENTURE_MOVE_HERO_SW,

+ 1 - 0
client/gui/ShortcutHandler.cpp

@@ -210,6 +210,7 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const
 		{"adventureZoomOut",         EShortcut::ADVENTURE_ZOOM_OUT        },
 		{"adventureZoomReset",       EShortcut::ADVENTURE_ZOOM_RESET      },
 		{"adventureSearch",          EShortcut::ADVENTURE_SEARCH          },
+		{"adventureSearchContinue",  EShortcut::ADVENTURE_SEARCH_CONTINUE },
 		{"battleToggleHeroesStats",  EShortcut::BATTLE_TOGGLE_HEROES_STATS},
 		{"battleToggleQueue",        EShortcut::BATTLE_TOGGLE_QUEUE       },
 		{"battleUseCreatureSpell",   EShortcut::BATTLE_USE_CREATURE_SPELL },

+ 1 - 0
config/shortcutsConfig.json

@@ -57,6 +57,7 @@
 		"adventureZoomOut":         "Keypad -",
 		"adventureZoomReset":       "Backspace",
 		"adventureSearch":          "Ctrl+F",
+		"adventureSearchContinue":  "Alt+F",
 		"battleAutocombat":         "A",
 		"battleAutocombatEnd":      "Q",
 		"battleCastSpell":          "C",