Update code and UI to clarify that town wandering locs are shared
This commit is contained in:
@@ -6,23 +6,19 @@
|
|||||||
<field name='group1-monst2' type='uint' top='165' left='174' width='39' height='16'/><button name='pick1-monst2' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group1-monst2' type='uint' top='165' left='174' width='39' height='16'/><button name='pick1-monst2' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group1-monst3' type='uint' top='193' left='174' width='39' height='16'/><button name='pick1-monst3' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group1-monst3' type='uint' top='193' left='174' width='39' height='16'/><button name='pick1-monst3' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group1-monst4' type='uint' top='221' left='174' width='39' height='16'/><button name='pick1-monst4' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group1-monst4' type='uint' top='221' left='174' width='39' height='16'/><button name='pick1-monst4' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<text name='group1-loc' top='248' left='174' width='39' height='16'/><button name='pick1-loc' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
|
||||||
<field name='group2-monst1' type='uint' top='137' left='239' width='39' height='16'/><button name='pick2-monst1' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group2-monst1' type='uint' top='137' left='239' width='39' height='16'/><button name='pick2-monst1' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group2-monst2' type='uint' top='165' left='239' width='39' height='16'/><button name='pick2-monst2' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group2-monst2' type='uint' top='165' left='239' width='39' height='16'/><button name='pick2-monst2' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group2-monst3' type='uint' top='193' left='239' width='39' height='16'/><button name='pick2-monst3' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group2-monst3' type='uint' top='193' left='239' width='39' height='16'/><button name='pick2-monst3' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group2-monst4' type='uint' top='221' left='239' width='39' height='16'/><button name='pick2-monst4' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group2-monst4' type='uint' top='221' left='239' width='39' height='16'/><button name='pick2-monst4' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<text name='group2-loc' top='248' left='239' width='39' height='16'/><button name='pick2-loc' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
|
||||||
<field name='group3-monst1' type='uint' top='137' left='304' width='39' height='16'/><button name='pick3-monst1' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group3-monst1' type='uint' top='137' left='304' width='39' height='16'/><button name='pick3-monst1' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group3-monst2' type='uint' top='165' left='304' width='39' height='16'/><button name='pick3-monst2' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group3-monst2' type='uint' top='165' left='304' width='39' height='16'/><button name='pick3-monst2' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group3-monst3' type='uint' top='193' left='304' width='39' height='16'/><button name='pick3-monst3' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group3-monst3' type='uint' top='193' left='304' width='39' height='16'/><button name='pick3-monst3' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group3-monst4' type='uint' top='221' left='304' width='39' height='16'/><button name='pick3-monst4' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group3-monst4' type='uint' top='221' left='304' width='39' height='16'/><button name='pick3-monst4' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<text name='group3-loc' top='248' left='304' width='39' height='16'/><button name='pick3-loc' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
|
||||||
<field name='group4-monst1' type='uint' top='137' left='369' width='39' height='16'/><button name='pick4-monst1' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group4-monst1' type='uint' top='137' left='369' width='39' height='16'/><button name='pick4-monst1' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group4-monst2' type='uint' top='165' left='369' width='39' height='16'/><button name='pick4-monst2' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group4-monst2' type='uint' top='165' left='369' width='39' height='16'/><button name='pick4-monst2' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group4-monst3' type='uint' top='193' left='369' width='39' height='16'/><button name='pick4-monst3' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group4-monst3' type='uint' top='193' left='369' width='39' height='16'/><button name='pick4-monst3' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<field name='group4-monst4' type='uint' top='221' left='369' width='39' height='16'/><button name='pick4-monst4' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<field name='group4-monst4' type='uint' top='221' left='369' width='39' height='16'/><button name='pick4-monst4' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
<text name='group4-loc' top='248' left='369' width='39' height='16'/><button name='pick4-loc' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
<button name='okay' type='regular' top='283' left='436'>OK</button>
|
||||||
<button name='okay' type='regular' top='273' left='436'>OK</button>
|
|
||||||
<button name='cancel' type='regular' relative='neg pos-in' rel-anchor='prev' top='0' left='71'>Cancel</button>
|
<button name='cancel' type='regular' relative='neg pos-in' rel-anchor='prev' top='0' left='71'>Cancel</button>
|
||||||
<text top='6' left='50' width='256' height='17'>Town wandering monsters</text>
|
<text top='6' left='50' width='256' height='17'>Town wandering monsters</text>
|
||||||
<text top='25' left='50' width='439' height='40'>
|
<text top='25' left='50' width='439' height='40'>
|
||||||
@@ -44,5 +40,10 @@
|
|||||||
<text top='166' left='8' width='150' height='14'>Monster 2 (1 appears)</text>
|
<text top='166' left='8' width='150' height='14'>Monster 2 (1 appears)</text>
|
||||||
<text top='194' left='8' width='150' height='14'>Monster 3 (1 appears)</text>
|
<text top='194' left='8' width='150' height='14'>Monster 3 (1 appears)</text>
|
||||||
<text top='222' left='8' width='150' height='14'>Monster 4 (1-2 appears)</text>
|
<text top='222' left='8' width='150' height='14'>Monster 4 (1-2 appears)</text>
|
||||||
<text top='250' left='8' width='150' height='14'>Location</text>
|
|
||||||
|
<text top='250' left='8' width='150' height='30'>Locations<br/>(Any group can appear at any location)</text>
|
||||||
|
<text name='loc1' top='258' left='174' width='39' height='16'/><button name='pick-loc1' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
|
<text name='loc2' top='258' left='239' width='39' height='16'/><button name='pick-loc2' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
|
<text name='loc3' top='258' left='304' width='39' height='16'/><button name='pick-loc3' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
|
<text name='loc4' top='258' left='369' width='39' height='16'/><button name='pick-loc4' type='tiny' relative='neg pos-in' rel-anchor='prev' top='2' left='20'></button>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
@@ -1103,9 +1103,12 @@ static bool save_town_wand(cDialog& me, std::string, eKeyMod) {
|
|||||||
town->wandering[i].monst[j] = me[id].getTextAsNum();
|
town->wandering[i].monst[j] = me[id].getTextAsNum();
|
||||||
if(town->wandering[i].monst[j] != old_wandering[i].monst[j]) changed = true;
|
if(town->wandering[i].monst[j] != old_wandering[i].monst[j]) changed = true;
|
||||||
}
|
}
|
||||||
town->wandering_locs[i] = boost::lexical_cast<location>(me["group" + std::to_string(i+1) + "-loc"].getText());
|
}
|
||||||
|
for(int i = 0; i < town->wandering_locs.size(); i++){
|
||||||
|
town->wandering_locs[i] = boost::lexical_cast<location>(me["loc" + std::to_string(i+1)].getText());
|
||||||
if(town->wandering_locs[i] != old_wandering_locs[i]) changed = true;
|
if(town->wandering_locs[i] != old_wandering_locs[i]) changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(changed){
|
if(changed){
|
||||||
undo_list.add(action_ptr(new aEditTownWandering(cur_town, old_wandering, old_wandering_locs, town->wandering, town->wandering_locs)));
|
undo_list.add(action_ptr(new aEditTownWandering(cur_town, old_wandering, old_wandering_locs, town->wandering, town->wandering_locs)));
|
||||||
update_edit_menu();
|
update_edit_menu();
|
||||||
@@ -1120,7 +1123,9 @@ static void put_town_wand_in_dlog(cDialog& me) {
|
|||||||
std::string id = base_id + "-monst" + std::to_string(j + 1);
|
std::string id = base_id + "-monst" + std::to_string(j + 1);
|
||||||
me[id].setTextToNum(town->wandering[i].monst[j]);
|
me[id].setTextToNum(town->wandering[i].monst[j]);
|
||||||
}
|
}
|
||||||
me[base_id + "-loc"].setText(boost::lexical_cast<std::string>(town->wandering_locs[i]));
|
}
|
||||||
|
for(int i = 0; i < town->wandering_locs.size(); i++){
|
||||||
|
me["loc" + std::to_string(i + 1)].setText(boost::lexical_cast<std::string>(town->wandering_locs[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1133,10 +1138,10 @@ static bool edit_town_wand_event_filter(cDialog& me, std::string item_hit, eKeyM
|
|||||||
};
|
};
|
||||||
short group = item_hit[4] - '0';
|
short group = item_hit[4] - '0';
|
||||||
std::string base_id = "group" + std::to_string(group);
|
std::string base_id = "group" + std::to_string(group);
|
||||||
if(item_hit.substr(5) == "-loc"){
|
if(item_hit.substr(0,8) == "pick-loc"){
|
||||||
std::string id = base_id + "-loc";
|
std::string id = "loc" + item_hit.substr(8);
|
||||||
location current = boost::lexical_cast<location>(me[id].getText());
|
location current = boost::lexical_cast<location>(me[id].getText());
|
||||||
current = cLocationPicker(current, *town, "Choose wandering group " + std::to_string(group) + " location", &me).run();
|
current = cLocationPicker(current, *town, "Choose wandering monster location " + item_hit.substr(8), &me).run();
|
||||||
me[id].setText(boost::lexical_cast<std::string>(current));
|
me[id].setText(boost::lexical_cast<std::string>(current));
|
||||||
}else{
|
}else{
|
||||||
short i = item_hit[11] - '1';
|
short i = item_hit[11] - '1';
|
||||||
|
Reference in New Issue
Block a user