Scenario Editor: try improve the scenario events' edition...

This commit is contained in:
Laurent alonso
2021-11-05 17:48:20 +01:00
committed by Celtic Minstrel
parent e6c45a3162
commit 2ad286b12d
2 changed files with 26 additions and 15 deletions

View File

@@ -2,15 +2,24 @@
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
<dialog defbtn='okay'>
<!-- OK button -->
<field name='time1' top='133' left='130' width='67' height='16'/>
<field name='time2' top='161' left='130' width='67' height='16'/>
<field name='time3' top='189' left='130' width='67' height='16'/>
<field name='time4' top='217' left='130' width='67' height='16'/>
<field name='time5' top='245' left='130' width='67' height='16'/>
<field name='time6' top='273' left='130' width='67' height='16'/>
<field name='time7' top='301' left='130' width='67' height='16'/>
<field name='time8' top='329' left='130' width='67' height='16'/>
<field name='time9' top='357' left='130' width='67' height='16'/>
<text name='id1' top='133' left='130' width='20' height='16'/>
<text name='id2' top='161' left='130' width='20' height='16'/>
<text name='id3' top='189' left='130' width='20' height='16'/>
<text name='id4' top='217' left='130' width='20' height='16'/>
<text name='id5' top='245' left='130' width='20' height='16'/>
<text name='id6' top='273' left='130' width='20' height='16'/>
<text name='id7' top='301' left='130' width='20' height='16'/>
<text name='id8' top='329' left='130' width='20' height='16'/>
<text name='id9' top='357' left='130' width='20' height='16'/>
<field name='time1' top='133' left='160' width='67' height='16'/>
<field name='time2' top='161' left='160' width='67' height='16'/>
<field name='time3' top='189' left='160' width='67' height='16'/>
<field name='time4' top='217' left='160' width='67' height='16'/>
<field name='time5' top='245' left='160' width='67' height='16'/>
<field name='time6' top='273' left='160' width='67' height='16'/>
<field name='time7' top='301' left='160' width='67' height='16'/>
<field name='time8' top='329' left='160' width='67' height='16'/>
<field name='time9' top='357' left='160' width='67' height='16'/>
<field name='node1' top='133' left='270' width='39' height='16'/>
<field name='node2' top='161' left='270' width='39' height='16'/>
<field name='node3' top='189' left='270' width='39' height='16'/>
@@ -21,8 +30,8 @@
<field name='node8' top='329' left='270' width='39' height='16'/>
<field name='node9' top='357' left='270' width='39' height='16'/>
<text framed='true' top='125' left='120' width='310' height='252'/>
<button name='up' type='up' def-key='up' top='100' left='342'/>
<button name='down' type='down' def-key='down' top='380' left='342'/>
<button name='up' type='up' def-key='up' top='100' left='362'/>
<button name='down' type='down' def-key='down' top='380' left='362'/>
<button name='cancel' type='regular' top='410' left='340'>Cancel</button>
<button name='okay' type='regular' top='410' left='406'>OK</button>
<pict type='dlog' num='16' top='8' left='8'/>
@@ -35,8 +44,9 @@
<text top='81' left='50' width='439' height='14'>
For more information on how this works, see the documentation.
</text>
<text top='97' left='102' width='135' height='28'>Number of moves between each call.</text>
<text top='97' left='239' width='131' height='28'>Scenario special node to call.</text>
<text top='97' left='120' width='20' height='28'>Id</text>
<text top='97' left='145' width='120' height='28'>Number of moves between each call.</text>
<text top='97' left='259' width='131' height='28'>Scenario special node to call.</text>
<text top='246' left='2' width='119' height='106'>
Note: If you leave the time between calls at 0, no special node is called.
Don't have special nodes called too often ... it slows the game down.

View File

@@ -3113,6 +3113,7 @@ static void put_scenario_events(cDialog& me, ::cTimersState const &state)
me["down"].show();
for(size_t i = 0; first_item+i < state.timers.size() && i < state.num_items; i++) {
std::string id = std::to_string(i + 1);
me["id" + id].setText(std::to_string(first_item+i));
me["time" + id].setTextToNum(state.timers[first_item+i].time);
me["node" + id].setTextToNum(state.timers[first_item+i].node);
}
@@ -3127,14 +3128,14 @@ static bool display_scenario_events(cDialog& me, ::cTimersState &state, std::str
if (item=="up") {
if (state.first_item<=0)
return false;
--state.first_item;
state.first_item=std::max(state.num_items,state.first_item)-state.num_items;
put_scenario_events(me, state);
return true;
}
if (item=="down") {
if (state.first_item+state.num_items>=state.timers.size())
return false;
++state.first_item;
state.first_item=std::min(state.timers.size()-state.num_items,state.first_item+state.num_items);
put_scenario_events(me, state);
return true;
}