mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	fix
This commit is contained in:
		| @@ -141,16 +141,18 @@ RandomMapTab::RandomMapTab(): | ||||
| 	//set combo box callbacks | ||||
| 	if(auto w = widget<ComboBox>("templateList")) | ||||
| 	{ | ||||
| 		w->onConstructItems = [](std::vector<const void *> & curItems){ | ||||
| 		auto getTemplates = [](){ | ||||
| 			auto templates = LIBRARY->tplh->getTemplates(); | ||||
| 		 | ||||
| 			boost::range::sort(templates, [](const CRmgTemplate * a, const CRmgTemplate * b){ | ||||
| 				return a->getName() < b->getName(); | ||||
| 			}); | ||||
| 			return templates; | ||||
| 		}; | ||||
|  | ||||
| 		w->onConstructItems = [getTemplates](std::vector<const void *> & curItems){ | ||||
| 			curItems.push_back(nullptr); //default template | ||||
| 			 | ||||
| 			for(auto & t : templates) | ||||
| 			for(auto & t : getTemplates()) | ||||
| 				curItems.push_back(t); | ||||
| 		}; | ||||
| 		 | ||||
| @@ -166,14 +168,14 @@ RandomMapTab::RandomMapTab(): | ||||
| 			return std::string(""); | ||||
| 		}; | ||||
|  | ||||
| 		w->addCallback([this]() | ||||
| 		w->addCallback([this, getTemplates]() // no real dropdown... - instead open dialog | ||||
| 		{ | ||||
| 			std::vector<std::string> texts; | ||||
| 			texts.push_back(readText(variables["randomTemplate"])); | ||||
| 			for(auto & t : LIBRARY->tplh->getTemplates()) | ||||
| 			for(auto & t : getTemplates()) | ||||
| 				texts.push_back(t->getName()); | ||||
|  | ||||
| 			ENGINE->windows().popWindows(1); // no real dropdown... | ||||
| 			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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user