1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Implement AI simturns checkbox

This commit is contained in:
Ivan Savenko 2023-11-10 21:21:10 +02:00
parent c5eeaa6526
commit d1ae5bbee5
2 changed files with 10 additions and 0 deletions

View File

@ -53,6 +53,12 @@ OptionsTabBase::OptionsTabBase(const JsonPath & configPath)
CSH->setSimturnsInfo(info);
});
addCallback("setSimturnAI", [&](int index){
SimturnsInfo info = SEL->getStartInfo()->simturnsInfo;
info.allowHumanWithAI = index;
CSH->setSimturnsInfo(info);
});
//helper function to parse string containing time to integer reflecting time in seconds
//assumed that input string can be modified by user, function shall support user's intention
// normal: 2:00, 12:30
@ -237,6 +243,9 @@ void OptionsTabBase::recreate()
if(auto w = widget<CLabel>("labelSimturnsDurationValueMax"))
w->setText(generateSimturnsDurationText(SEL->getStartInfo()->simturnsInfo.optionalTurns));
if(auto buttonSimturnsAI = widget<CToggleButton>("buttonSimturnsAI"))
buttonSimturnsAI->setSelectedSilent(SEL->getStartInfo()->simturnsInfo.allowHumanWithAI);
const auto & turnTimerRemote = SEL->getStartInfo()->turnTimerInfo;
//classic timer

View File

@ -267,6 +267,7 @@
"rect": {"x": 70, "y": 480, "w": 300, "h": 40}
},
{
"name": "buttonSimturnsAI",
"position": {"x": 70, "y": 535},
"type": "toggleButton",
"image": "lobby/checkbox"