diff --git a/Mods/vcmi/config/vcmi/english.json b/Mods/vcmi/config/vcmi/english.json index 0f9e38383..db41b2216 100644 --- a/Mods/vcmi/config/vcmi/english.json +++ b/Mods/vcmi/config/vcmi/english.json @@ -236,8 +236,7 @@ "vcmi.optionsTab.simturnsMin.hover" : "At least for", "vcmi.optionsTab.simturnsMax.hover" : "At most for", "vcmi.optionsTab.simturnsAI.hover" : "(Experimental) Simultaneous AI Turns", - "vcmi.optionsTab.simturnsMin.help" : "Play simultaneously at least for specified number of days. Contacts between players during this period are blocked", - "vcmi.optionsTab.simturnsMax.help" : "Play simultaneously at most for specified number of days or until they meet each other.", + "vcmi.optionsTab.simturns.help" : "Play simultaneously at least for specified number of days, after which simultaneous turns will stay active until specified day or until players make contact. Contacts between players during this period are blocked", "vcmi.optionsTab.simturnsAI.help" : "", // Custom victory conditions for H3 campaigns and HotA maps diff --git a/client/lobby/OptionsTabBase.cpp b/client/lobby/OptionsTabBase.cpp index 60996951b..1fc917809 100644 --- a/client/lobby/OptionsTabBase.cpp +++ b/client/lobby/OptionsTabBase.cpp @@ -38,8 +38,14 @@ OptionsTabBase::OptionsTabBase(const JsonPath & configPath) } }); - addCallback("setSimturnDuration", [&](int index){ - SimturnsInfo info; + addCallback("setSimturnDurationMin", [&](int index){ + SimturnsInfo info = SEL->getStartInfo()->simturnsInfo; + info.requiredTurns = index; + CSH->setSimturnsInfo(info); + }); + + addCallback("setSimturnDurationMax", [&](int index){ + SimturnsInfo info = SEL->getStartInfo()->simturnsInfo; info.optionalTurns = index; CSH->setSimturnsInfo(info); }); @@ -184,10 +190,21 @@ OptionsTabBase::OptionsTabBase(const JsonPath & configPath) void OptionsTabBase::recreate() { //Simultaneous turns - if(auto turnSlider = widget("labelSimturnsDurationValue")) + if(auto turnSlider = widget("simturnsDurationMin")) + turnSlider->scrollTo(SEL->getStartInfo()->simturnsInfo.requiredTurns); + + if(auto turnSlider = widget("simturnsDurationMax")) turnSlider->scrollTo(SEL->getStartInfo()->simturnsInfo.optionalTurns); - if(auto w = widget("labelSimturnsDurationValue")) + if(auto w = widget("labelSimturnsDurationValueMin")) + { + MetaString message; + message.appendRawString("%d days"); + message.replaceNumber(SEL->getStartInfo()->simturnsInfo.requiredTurns); + w->setText(message.toString()); + } + + if(auto w = widget("labelSimturnsDurationValueMax")) { MetaString message; message.appendRawString("%d days"); diff --git a/config/widgets/turnOptionsTab.json b/config/widgets/turnOptionsTab.json index 17c7ad33b..dda539f8e 100644 --- a/config/widgets/turnOptionsTab.json +++ b/config/widgets/turnOptionsTab.json @@ -78,7 +78,13 @@ }, { "type": "transparentFilledRectangle", - "rect": {"x" : 64, "y" : 480, "w": 316, "h": 1}, + "rect": {"x" : 64, "y" : 465, "w": 316, "h": 1}, + "color": [0, 0, 0, 0], + "colorLine": [80, 96, 160, 128] + }, + { + "type": "transparentFilledRectangle", + "rect": {"x" : 64, "y" : 466, "w": 316, "h": 1}, "color": [0, 0, 0, 0], "colorLine": [32, 40, 128, 128] }, @@ -123,16 +129,10 @@ }, { "text": "vcmi.optionsTab.chessFieldCreature.help" - }, - { - "text": "" - }, - { - "text": "vcmi.optionsTab.simturnsMin.help" } ] }, - + { "type" : "verticalLayout66", "customType" : "timeInputBackground", @@ -181,7 +181,7 @@ "alignment": "left", "color": "white", "text": "vcmi.optionsTab.simturnsMin.hover", - "position": {"x": 70, "y": 430} + "position": {"x": 70, "y": 420} }, { "type": "label", @@ -189,16 +189,16 @@ "alignment": "left", "color": "white", "text": "vcmi.optionsTab.simturnsMax.hover", - "position": {"x": 70, "y": 460} + "position": {"x": 70, "y": 445} }, { "name": "simturnsDurationMin", "type": "slider", "orientation": "horizontal", - "position": {"x": 178, "y": 430}, + "position": {"x": 178, "y": 420}, "size": 200, - "callback": "setSimturnDuration", + "callback": "setSimturnDurationMin", "itemsVisible": 1, "itemsTotal": 28, "selected": 0, @@ -210,9 +210,9 @@ "name": "simturnsDurationMax", "type": "slider", "orientation": "horizontal", - "position": {"x": 178, "y": 460}, + "position": {"x": 178, "y": 445}, "size": 200, - "callback": "setSimturnDuration", + "callback": "setSimturnDurationMax", "itemsVisible": 1, "itemsTotal": 28, "selected": 0, @@ -227,7 +227,7 @@ "alignment": "center", "color": "white", "text": "", - "position": {"x": 320, "y": 438} + "position": {"x": 320, "y": 428} }, { "name": "labelSimturnsDurationValueMax", @@ -236,9 +236,17 @@ "alignment": "center", "color": "white", "text": "", - "position": {"x": 320, "y": 468} + "position": {"x": 320, "y": 453} + }, + { + "type" : "label", + "text": "vcmi.optionsTab.simturns.help", + "type": "multiLineLabel", + "font": "tiny", + "alignment": "center", + "color": "white", + "rect": {"x": 70, "y": 470, "w": 300, "h": 40} }, - { "position": {"x": 70, "y": 535}, "type": "toggleButton",