diff --git a/client/lobby/OptionsTab.cpp b/client/lobby/OptionsTab.cpp index a15aafd6f..cfa94763c 100644 --- a/client/lobby/OptionsTab.cpp +++ b/client/lobby/OptionsTab.cpp @@ -58,6 +58,12 @@ OptionsTab::OptionsTab() : humanPlayers(0) CSH->setTurnTimerInfo(tinfo); } }); + + addCallback("setSimturnDuration", [&](int index){ + SimturnsInfo info; + info.optionalTurns = 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 @@ -214,6 +220,18 @@ void OptionsTab::recreate() entries.insert(std::make_pair(pInfo.first, std::make_shared(pInfo.second, * this))); } + + //Simultaneous turns + if(auto turnSlider = widget("labelSimturnsDurationValue")) + turnSlider->scrollTo(SEL->getStartInfo()->simturnsInfo.optionalTurns); + + if(auto w = widget("labelSimturnsDurationValue")) + { + MetaString message; + message.appendRawString("Simturns: up to %d days"); + message.replaceNumber(SEL->getStartInfo()->simturnsInfo.optionalTurns); + w->setText(message.toString()); + } const auto & turnTimerRemote = SEL->getStartInfo()->turnTimerInfo; diff --git a/config/widgets/optionsTab.json b/config/widgets/optionsTab.json index ca3c936f2..bd8c76126 100644 --- a/config/widgets/optionsTab.json +++ b/config/widgets/optionsTab.json @@ -73,16 +73,41 @@ "adoptHeight": true }, - // timer { + "name": "simturnsDuration", + "type": "slider", + "orientation": "horizontal", + "position": {"x": 55, "y": 537}, + "size": 194, + "callback": "setSimturnDuration", + "itemsVisible": 1, + "itemsTotal": 28, + "selected": 0, + "style": "blue", + "scrollBounds": {"x": 0, "y": 0, "w": 194, "h": 32}, + "panningStep": 20 + }, + + { + "name": "labelSimturnsDurationValue", "type": "label", "font": "small", "alignment": "center", - "color": "yellow", - "text": "core.genrltxt.521", - "position": {"x": 222, "y": 544} + "color": "white", + "text": "", + "position": {"x": 319, "y": 545} }, + // timer + //{ + // "type": "label", + // "font": "small", + // "alignment": "center", + // "color": "yellow", + // "text": "core.genrltxt.521", + // "position": {"x": 222, "y": 544} + //}, + { "name": "labelTurnDurationValue", "type": "label", @@ -104,7 +129,8 @@ "itemsTotal": 11, "selected": 11, "style": "blue", - "scrollBounds": {"x": -3, "y": -25, "w": 337, "h": 43}, + "scrollBounds": {"x": 0, "y": 0, "w": 194, "h": 32}, + //"scrollBounds": {"x": -3, "y": -25, "w": 337, "h": 43}, "panningStep": 20 }, ], diff --git a/lib/StartInfo.h b/lib/StartInfo.h index b1addd4b2..a558c4d32 100644 --- a/lib/StartInfo.h +++ b/lib/StartInfo.h @@ -30,7 +30,7 @@ struct DLL_LINKAGE SimturnsInfo /// Maximum number of turns that might be played simultaneously unless contact is detected int optionalTurns = 0; /// If set to true, human and 1 AI can act at the same time - bool allowHumanWithAI = false; + bool allowHumanWithAI = true; template void serialize(Handler &h, const int version)