1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

template search

This commit is contained in:
Laserlicht
2025-10-08 01:12:57 +02:00
parent da79b27547
commit 64c44ce887
5 changed files with 23 additions and 2 deletions

View File

@@ -138,6 +138,8 @@
"vcmi.lobby.deleteFile" : "Do you want to delete following file?",
"vcmi.lobby.deleteFolder" : "Do you want to delete following folder?",
"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.command" : "Use '!help' to list available commands",

View File

@@ -138,6 +138,8 @@
"vcmi.lobby.deleteFile" : "Möchtet Ihr folgende Datei 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.templatesSelect.hover" : "Templates",
"vcmi.lobby.templatesSelect.help" : "Suche und wähle Template aus",
"vcmi.broadcast.failedLoadGame" : "Spiel konnte nicht geladen werden",
"vcmi.broadcast.command" : "Benutze '!help' um alle verfügbaren Befehle aufzulisten",

View File

@@ -43,7 +43,8 @@
#include "../../lib/serializer/JsonDeserializer.h"
RandomMapTab::RandomMapTab():
InterfaceObjectConfigurable()
InterfaceObjectConfigurable(),
templateIndex(0)
{
recActions = 0;
mapGenOptions = std::make_shared<CMapGenOptions>();
@@ -164,6 +165,20 @@ RandomMapTab::RandomMapTab():
return readText(variables["randomTemplate"]);
return std::string("");
};
w->addCallback([this]()
{
std::vector<std::string> texts;
texts.push_back(readText(variables["randomTemplate"]));
for(auto & t : LIBRARY->tplh->getTemplates())
texts.push_back(t->getName());
ENGINE->windows().popWindows(1); // no real dropdown...
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();

View File

@@ -55,6 +55,8 @@ private:
std::set<int> playerTeamsAllowed;
std::set<int> compCountAllowed;
std::set<int> compTeamsAllowed;
int templateIndex;
};
class TeamAlignmentsWidget: public InterfaceObjectConfigurable

View File

@@ -86,7 +86,7 @@ std::shared_ptr<CPicture> CWindowObject::createBg(const ImagePath & imageName, b
return nullptr;
auto image = std::make_shared<CPicture>(imageName, Point(0,0), EImageBlitMode::OPAQUE);
if(playerColored)
if(playerColored && GAME->interface())
image->setPlayerColor(GAME->interface()->playerID);
return image;
}