Move Set Town Start to Town menu and make it work the same as Set Out Start

- Also fix problem with initial starting town in new scenarios (it was uninitialized)
This commit is contained in:
2015-09-27 14:50:00 -04:00
parent 66efa9cb62
commit 1222cb57f5
11 changed files with 36 additions and 102 deletions

View File

@@ -1,14 +0,0 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
<dialog defbtn='okay'>
<button name='okay' type='regular' top='103' left='251'>OK</button>
<button name='cancel' type='regular' def-key='esc' top='103' left='186'>Cancel</button>
<pict type='dlog' num='16' top='6' left='6'/>
<text top='6' left='49' width='270' height='54'>
You are about to set this location at the parties outdoor starting location.
When the party starts the scenario and leaves the town they start in, this is where they will be.
</text>
<text top='61' left='49' width='268' height='39'>
To set the town the party starts in, use the Set Starting Location option in the Scenario menu.
</text>
</dialog>

View File

@@ -1,24 +0,0 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
<dialog skin='light' defbtn='okay' debug='true'>
<!-- OK button -->
<field name='town-num' top='77' left='181' width='43' height='16'/>
<field name='town-x' top='104' left='181' width='43' height='16'/>
<field name='town-y' top='104' left='280' width='43' height='16'/>
<button name='okay' type='regular' top='185' left='359'>OK</button>
<pict type='dlog' num='16' top='8' left='8'/>
<text top='25' left='50' width='371' height='41'>
Enter the town the party will start the scenario in.
Also enter the x-y location in the town to place the party at.
Don't forget to place that town somewhere in your scenario.
</text>
<text size='large' top='6' left='50' width='256' height='17'>Starting Location</text>
<text top='105' left='50' width='120' height='14'>Start location: X =</text>
<text top='105' left='232' width='39' height='14'>Y =</text>
<button name='cancel' type='regular' top='185' left='293'>Cancel</button>
<text top='129' left='51' width='372' height='55'>
NOTE: You also need to set the starting location outdoors.
This is where the party ends up when they leave town for the first time.
To set this, use the Set Starting Location option in the outdoors menu.
</text>
</dialog>

View File

@@ -91,7 +91,6 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "&Scenario Details", IDM_SCEN_DETAILS
MENUITEM "Scenario Intr&o Text", IDM_SCEN_INTRO
MENUITEM "Set Starting &Location", IDM_SCEN_START
MENUITEM "Edit Custom Graphic Sheets", IDM_SCEN_CUSTOM_SHEETS
MENUITEM "Classify Custom &Graphics", IDM_SCEN_CUSTOM_PICS
MENUITEM "Edit Custom Sounds", IDM_SCEN_CUSTOM_SNDS
@@ -125,6 +124,7 @@ BEGIN
MENUITEM "Remo&ve Terrain Frills", IDM_TOWN_UNFRILL
MENUITEM "Edit &Area Descriptions", IDM_TOWN_AREAS
MENUITEM SEPARATOR
MENUITEM "Set Starting &Location", IDM_SCEN_START
MENUITEM "Add Rand&om Items", IDM_TOWN_RANDOM_ITEMS
MENUITEM "Set All Items Not Propert&y", IDM_TOWN_NOT_PROPERTY
MENUITEM "Clear All &Items", IDM_TOWN_CLEAR_ITEMS

View File

@@ -3,12 +3,12 @@
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11G63</string>
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1138.51</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2844</string>
<string key="NS.object.0">3084</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSCustomObject</string>
@@ -382,14 +382,6 @@
<reference key="NSOnImage" ref="229763992"/>
<reference key="NSMixedImage" ref="909111550"/>
</object>
<object class="NSMenuItem" id="646438288">
<reference key="NSMenu" ref="399390342"/>
<string key="NSTitle">Set Starting Location</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="229763992"/>
<reference key="NSMixedImage" ref="909111550"/>
</object>
<object class="NSMenuItem" id="1072664025">
<reference key="NSMenu" ref="399390342"/>
<string key="NSTitle">Edit Custom Graphic Sheets</string>
@@ -618,6 +610,14 @@
<reference key="NSOnImage" ref="229763992"/>
<reference key="NSMixedImage" ref="909111550"/>
</object>
<object class="NSMenuItem" id="646438288">
<reference key="NSMenu" ref="61689393"/>
<string key="NSTitle">Set Starting Location</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="229763992"/>
<reference key="NSMixedImage" ref="909111550"/>
</object>
<object class="NSMenuItem" id="1038227897">
<reference key="NSMenu" ref="61689393"/>
<string key="NSTitle">Add Random Items</string>
@@ -1262,7 +1262,6 @@
<array class="NSMutableArray" key="children">
<reference ref="142725490"/>
<reference ref="610226442"/>
<reference ref="646438288"/>
<reference ref="547366333"/>
<reference ref="799771914"/>
<reference ref="1007446984"/>
@@ -1322,6 +1321,7 @@
<reference ref="654574897"/>
<reference ref="156465632"/>
<reference ref="2020849"/>
<reference ref="646438288"/>
</array>
<reference key="parent" ref="12009264"/>
</object>
@@ -1368,11 +1368,6 @@
<reference key="object" ref="610226442"/>
<reference key="parent" ref="399390342"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">805</int>
<reference key="object" ref="646438288"/>
<reference key="parent" ref="399390342"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">806</int>
<reference key="object" ref="547366333"/>
@@ -1663,6 +1658,11 @@
<reference key="object" ref="327378958"/>
<reference key="parent" ref="399390342"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">805</int>
<reference key="object" ref="646438288"/>
<reference key="parent" ref="61689393"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">

View File

@@ -66,6 +66,7 @@ cScenario::cScenario() {
format.prog_make_ver[0] = 2;
init_spec = -1;
default_ground = 2;
which_town_start = 0;
where_start.x = 24;
where_start.y = 24;
out_start = where_start = loc(24,24);

View File

@@ -1140,9 +1140,7 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
overall_mode = MODE_DRAWING;
change_made = true;
break;
case MODE_SET_OUT_START: //edit out start loc
if(cChoiceDlog("set-out-start-confirm", {"okay", "cancel"}).show() == "cancel")
break;
case MODE_SET_OUT_START:
if((spot_hit.x != minmax(4,43,spot_hit.x)) || (spot_hit.y != minmax(4,43,spot_hit.y))) {
showError("You can't put the starting location this close to the edge of an outdoor section. It has to be at least 4 spaces away.");
break;
@@ -1174,7 +1172,15 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
town->preset_items.pop_back();
overall_mode = MODE_DRAWING;
break;
case MODE_SET_TOWN_START: // TODO: Implement this
case MODE_SET_TOWN_START:
if(!town->in_town_rect.contains(spot_hit)) {
showError("You can't put the starting location outside the town boundaries.");
break;
}
scenario.which_town_start = cur_town;
scenario.where_start = spot_hit;
overall_mode = MODE_DRAWING;
change_made = true;
break;
case MODE_INTRO_SCREEN:
case MODE_EDIT_TYPES:

View File

@@ -3113,42 +3113,6 @@ bool build_scenario() {
return true;
}
static bool check_location_bounds(cDialog& me, std::string id, bool losing) {
if(!losing) return true;
short town_num = me["town-num"].getTextAsNum();
short dim = me[id].getTextAsNum();
if(dim < 0 || dim >= scenario.towns[town_num]->max_dim()) {
showError("This coordinate is not inside the bounds of the town.");
return false;
}
return true;
}
static bool set_starting_loc_filter(cDialog& me, std::string, eKeyMod) {
if(me.toast(true)) {
scenario.which_town_start = me["town-num"].getTextAsNum();
scenario.where_start.x = me["town-x"].getTextAsNum();
scenario.where_start.y = me["town-y"].getTextAsNum();
}
return true;
}
void set_starting_loc() {
using namespace std::placeholders;
cDialog loc_dlg("set-start-loc");
loc_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &loc_dlg, false));
loc_dlg["okay"].attachClickHandler(set_starting_loc_filter);
loc_dlg["town-num"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, scenario.towns.size() - 1, "The starting town"));
loc_dlg.attachFocusHandlers(check_location_bounds, {"town-x", "town-y"});
loc_dlg["town-num"].setTextToNum(scenario.which_town_start);
loc_dlg["town-x"].setTextToNum(scenario.where_start.x);
loc_dlg["town-y"].setTextToNum(scenario.where_start.y);
loc_dlg.run();
}
static bool save_scenario_events(cDialog& me, std::string, eKeyMod) {
short i;

View File

@@ -21,7 +21,6 @@ bool edit_make_scen_2(short& out_w, short& out_h, short& town_l, short& town_m,
bool edit_make_scen_1(std::string& filename,std::string& title,bool& grass);
void edit_scenario_events();
bool build_scenario();
void set_starting_loc();
void edit_boats();
bool check_range_msg(cDialog& me,std::string id,bool losing,long min_val,long max_val,std::string fld_name,std::string xtra);

View File

@@ -315,8 +315,8 @@ void handle_menu_choice(eMenu item_hit) {
change_made = true;
break;
case eMenu::TOWN_START:
set_starting_loc();
change_made = true;
overall_mode = MODE_SET_TOWN_START;
set_string("Select party starting location.","");
break;
case eMenu::SCEN_SHEETS:
edit_custom_sheets();

View File

@@ -53,14 +53,15 @@ void init_menubar() {
};
static const eMenu scen_choices[] = {
eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::TOWN_START, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
eMenu::SCEN_HORSES, eMenu::SCEN_BOATS, eMenu::TOWN_VARYING, eMenu::SCEN_TIMERS, eMenu::SCEN_ITEM_SHORTCUTS,
eMenu::TOWN_DELETE, eMenu::SCEN_DATA_DUMP, eMenu::SCEN_TEXT_DUMP,
};
static const eMenu town_choices[] = {
eMenu::TOWN_DETAILS, eMenu::TOWN_WANDERING, eMenu::TOWN_BOUNDARIES, eMenu::FRILL, eMenu::UNFRILL, eMenu::TOWN_AREAS,
eMenu::NONE, eMenu::TOWN_ITEMS_RANDOM, eMenu::TOWN_ITEMS_NOT_PROPERTY, eMenu::TOWN_ITEMS_CLEAR, eMenu::NONE, eMenu::NONE,
eMenu::NONE, eMenu::TOWN_START, eMenu::TOWN_ITEMS_RANDOM, eMenu::TOWN_ITEMS_NOT_PROPERTY, eMenu::TOWN_ITEMS_CLEAR,
eMenu::NONE, eMenu::NONE,
eMenu::TOWN_SPECIALS, eMenu::TOWN_TEXT, eMenu::TOWN_SIGNS, eMenu::TOWN_ADVANCED, eMenu::TOWN_TIMERS,
};
static const eMenu out_choices[] = {

View File

@@ -81,14 +81,15 @@ void init_menubar() {
};
static const eMenu scen_choices[] = {
eMenu::TOWN_CREATE, eMenu::OUT_RESIZE, eMenu::NONE,
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::TOWN_START, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
eMenu::SCEN_DETAILS, eMenu::SCEN_INTRO, eMenu::SCEN_SHEETS, eMenu::SCEN_PICS, eMenu::SCEN_SNDS, eMenu::NONE, eMenu::NONE,
eMenu::SCEN_SPECIALS, eMenu::SCEN_TEXT, eMenu::SCEN_JOURNALS, eMenu::TOWN_IMPORT, eMenu::OUT_IMPORT, eMenu::SCEN_SAVE_ITEM_RECTS,
eMenu::SCEN_HORSES, eMenu::SCEN_BOATS, eMenu::TOWN_VARYING, eMenu::SCEN_TIMERS, eMenu::SCEN_ITEM_SHORTCUTS,
eMenu::TOWN_DELETE, eMenu::SCEN_DATA_DUMP, eMenu::SCEN_TEXT_DUMP,
};
static const eMenu town_choices[] = {
eMenu::TOWN_DETAILS, eMenu::TOWN_WANDERING, eMenu::TOWN_BOUNDARIES, eMenu::FRILL, eMenu::UNFRILL, eMenu::TOWN_AREAS,
eMenu::NONE, eMenu::TOWN_ITEMS_RANDOM, eMenu::TOWN_ITEMS_NOT_PROPERTY, eMenu::TOWN_ITEMS_CLEAR, eMenu::NONE, eMenu::NONE,
eMenu::NONE, eMenu::TOWN_START, eMenu::TOWN_ITEMS_RANDOM, eMenu::TOWN_ITEMS_NOT_PROPERTY, eMenu::TOWN_ITEMS_CLEAR,
eMenu::NONE, eMenu::NONE,
eMenu::TOWN_SPECIALS, eMenu::TOWN_TEXT, eMenu::TOWN_SIGNS, eMenu::TOWN_ADVANCED, eMenu::TOWN_TIMERS,
};
static const eMenu out_choices[] = {