mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-27 12:22:45 +02:00
Implement AI simturns checkbox
This commit is contained in:
parent
c5eeaa6526
commit
d1ae5bbee5
@ -53,6 +53,12 @@ OptionsTabBase::OptionsTabBase(const JsonPath & configPath)
|
|||||||
CSH->setSimturnsInfo(info);
|
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
|
//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
|
//assumed that input string can be modified by user, function shall support user's intention
|
||||||
// normal: 2:00, 12:30
|
// normal: 2:00, 12:30
|
||||||
@ -237,6 +243,9 @@ void OptionsTabBase::recreate()
|
|||||||
if(auto w = widget<CLabel>("labelSimturnsDurationValueMax"))
|
if(auto w = widget<CLabel>("labelSimturnsDurationValueMax"))
|
||||||
w->setText(generateSimturnsDurationText(SEL->getStartInfo()->simturnsInfo.optionalTurns));
|
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;
|
const auto & turnTimerRemote = SEL->getStartInfo()->turnTimerInfo;
|
||||||
|
|
||||||
//classic timer
|
//classic timer
|
||||||
|
@ -267,6 +267,7 @@
|
|||||||
"rect": {"x": 70, "y": 480, "w": 300, "h": 40}
|
"rect": {"x": 70, "y": 480, "w": 300, "h": 40}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"name": "buttonSimturnsAI",
|
||||||
"position": {"x": 70, "y": 535},
|
"position": {"x": 70, "y": 535},
|
||||||
"type": "toggleButton",
|
"type": "toggleButton",
|
||||||
"image": "lobby/checkbox"
|
"image": "lobby/checkbox"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user