mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	| @@ -138,6 +138,8 @@ | |||||||
| 	"vcmi.lobby.deleteFile" : "Do you want to delete following file?", | 	"vcmi.lobby.deleteFile" : "Do you want to delete following file?", | ||||||
| 	"vcmi.lobby.deleteFolder" : "Do you want to delete following folder?", | 	"vcmi.lobby.deleteFolder" : "Do you want to delete following folder?", | ||||||
| 	"vcmi.lobby.deleteMode" : "Switch to delete mode and back", | 	"vcmi.lobby.deleteMode" : "Switch to delete mode and back", | ||||||
|  | 	"vcmi.lobby.templatesSelect.hover" : "Templates", | ||||||
|  | 	"vcmi.lobby.templatesSelect.help" : "Search and select template", | ||||||
|  |  | ||||||
| 	"vcmi.broadcast.failedLoadGame" : "Failed to load game", | 	"vcmi.broadcast.failedLoadGame" : "Failed to load game", | ||||||
| 	"vcmi.broadcast.command" : "Use '!help' to list available commands", | 	"vcmi.broadcast.command" : "Use '!help' to list available commands", | ||||||
|   | |||||||
| @@ -138,6 +138,8 @@ | |||||||
| 	"vcmi.lobby.deleteFile" : "Möchtet Ihr folgende Datei löschen?", | 	"vcmi.lobby.deleteFile" : "Möchtet Ihr folgende Datei löschen?", | ||||||
| 	"vcmi.lobby.deleteFolder" : "Möchtet Ihr folgenden Ordner löschen?", | 	"vcmi.lobby.deleteFolder" : "Möchtet Ihr folgenden Ordner löschen?", | ||||||
| 	"vcmi.lobby.deleteMode" : "In den Löschmodus wechseln und zurück", | 	"vcmi.lobby.deleteMode" : "In den Löschmodus wechseln und zurück", | ||||||
|  | 	"vcmi.lobby.templatesSelect.hover" : "Templates", | ||||||
|  | 	"vcmi.lobby.templatesSelect.help" : "Suche und wähle Template aus", | ||||||
|  |  | ||||||
| 	"vcmi.broadcast.failedLoadGame" : "Spiel konnte nicht geladen werden", | 	"vcmi.broadcast.failedLoadGame" : "Spiel konnte nicht geladen werden", | ||||||
| 	"vcmi.broadcast.command" : "Benutze '!help' um alle verfügbaren Befehle aufzulisten", | 	"vcmi.broadcast.command" : "Benutze '!help' um alle verfügbaren Befehle aufzulisten", | ||||||
|   | |||||||
| @@ -43,7 +43,8 @@ | |||||||
| #include "../../lib/serializer/JsonDeserializer.h" | #include "../../lib/serializer/JsonDeserializer.h" | ||||||
|  |  | ||||||
| RandomMapTab::RandomMapTab(): | RandomMapTab::RandomMapTab(): | ||||||
| 	InterfaceObjectConfigurable() | 	InterfaceObjectConfigurable(), | ||||||
|  | 	templateIndex(0) | ||||||
| { | { | ||||||
| 	recActions = 0; | 	recActions = 0; | ||||||
| 	mapGenOptions = std::make_shared<CMapGenOptions>(); | 	mapGenOptions = std::make_shared<CMapGenOptions>(); | ||||||
| @@ -140,16 +141,18 @@ RandomMapTab::RandomMapTab(): | |||||||
| 	//set combo box callbacks | 	//set combo box callbacks | ||||||
| 	if(auto w = widget<ComboBox>("templateList")) | 	if(auto w = widget<ComboBox>("templateList")) | ||||||
| 	{ | 	{ | ||||||
| 		w->onConstructItems = [](std::vector<const void *> & curItems){ | 		auto getTemplates = [](){ | ||||||
| 			auto templates = LIBRARY->tplh->getTemplates(); | 			auto templates = LIBRARY->tplh->getTemplates(); | ||||||
| 		 |  | ||||||
| 			boost::range::sort(templates, [](const CRmgTemplate * a, const CRmgTemplate * b){ | 			boost::range::sort(templates, [](const CRmgTemplate * a, const CRmgTemplate * b){ | ||||||
| 				return a->getName() < b->getName(); | 				return a->getName() < b->getName(); | ||||||
| 			}); | 			}); | ||||||
|  | 			return templates; | ||||||
|  | 		}; | ||||||
|  |  | ||||||
|  | 		w->onConstructItems = [getTemplates](std::vector<const void *> & curItems){ | ||||||
| 			curItems.push_back(nullptr); //default template | 			curItems.push_back(nullptr); //default template | ||||||
| 			 | 			 | ||||||
| 			for(auto & t : templates) | 			for(auto & t : getTemplates()) | ||||||
| 				curItems.push_back(t); | 				curItems.push_back(t); | ||||||
| 		}; | 		}; | ||||||
| 		 | 		 | ||||||
| @@ -164,6 +167,20 @@ RandomMapTab::RandomMapTab(): | |||||||
| 				return readText(variables["randomTemplate"]); | 				return readText(variables["randomTemplate"]); | ||||||
| 			return std::string(""); | 			return std::string(""); | ||||||
| 		}; | 		}; | ||||||
|  |  | ||||||
|  | 		w->addCallback([this, getTemplates]() // no real dropdown... - instead open dialog | ||||||
|  | 		{ | ||||||
|  | 			std::vector<std::string> texts; | ||||||
|  | 			texts.push_back(readText(variables["randomTemplate"])); | ||||||
|  | 			for(auto & t : getTemplates()) | ||||||
|  | 				texts.push_back(t->getName()); | ||||||
|  |  | ||||||
|  | 			ENGINE->windows().popWindows(1); | ||||||
|  | 			ENGINE->windows().createAndPushWindow<CObjectListWindow>(texts, nullptr, LIBRARY->generaltexth->translate("vcmi.lobby.templatesSelect.hover"), LIBRARY->generaltexth->translate("vcmi.lobby.templatesSelect.help"), [this](int index){ | ||||||
|  | 				widget<ComboBox>("templateList")->setItem(index); | ||||||
|  | 				templateIndex = index; | ||||||
|  | 			}, templateIndex, std::vector<std::shared_ptr<IImage>>(), true); | ||||||
|  | 		}); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	loadOptions(); | 	loadOptions(); | ||||||
|   | |||||||
| @@ -55,6 +55,8 @@ private: | |||||||
| 	std::set<int> playerTeamsAllowed; | 	std::set<int> playerTeamsAllowed; | ||||||
| 	std::set<int> compCountAllowed; | 	std::set<int> compCountAllowed; | ||||||
| 	std::set<int> compTeamsAllowed; | 	std::set<int> compTeamsAllowed; | ||||||
|  |  | ||||||
|  | 	int templateIndex; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| class TeamAlignmentsWidget: public InterfaceObjectConfigurable | class TeamAlignmentsWidget: public InterfaceObjectConfigurable | ||||||
|   | |||||||
| @@ -86,7 +86,7 @@ std::shared_ptr<CPicture> CWindowObject::createBg(const ImagePath & imageName, b | |||||||
| 		return nullptr; | 		return nullptr; | ||||||
|  |  | ||||||
| 	auto image = std::make_shared<CPicture>(imageName, Point(0,0), EImageBlitMode::OPAQUE); | 	auto image = std::make_shared<CPicture>(imageName, Point(0,0), EImageBlitMode::OPAQUE); | ||||||
| 	if(playerColored) | 	if(playerColored && GAME->interface()) | ||||||
| 		image->setPlayerColor(GAME->interface()->playerID); | 		image->setPlayerColor(GAME->interface()->playerID); | ||||||
| 	return image; | 	return image; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user