Several little tweaks and fixes

- Fix some uninitialized fields getting populated with random data
- Fix identity of last edited town and outdoor section not being saved
- Fix editor sometimes saving to application directory instead of overwriting the loaded scenario
- Fix town specials being saved to outdoors list and vice versa
- Fix right-most column of map not being loaded properly
- Fix town entry node for start town being called after the first turn of the scenario
- Add option to call a special node at startup (right after the intro dialog)
This commit is contained in:
2015-06-01 22:43:41 -04:00
parent 0849df0e28
commit 7dddcdb86e
13 changed files with 31 additions and 9 deletions

View File

@@ -155,6 +155,7 @@ static void writeScenarioToXml(ticpp::Printer&& data) {
data.PushElement("num-towns", scenario.towns.size());
data.PushElement("out-width", scenario.outdoors.width());
data.PushElement("out-height", scenario.outdoors.height());
data.PushElement("on-init", scenario.init_spec);
data.PushElement("start-town", scenario.which_town_start);
data.PushElement("town-start", scenario.where_start);
data.PushElement("outdoor-start", scenario.out_sec_start);
@@ -307,8 +308,8 @@ static void writeScenarioToXml(ticpp::Printer&& data) {
data.CloseElement("game");
data.OpenElement("editor");
data.PushElement("default-ground", scenario.default_ground);
data.PushElement("last-out-section", scenario.last_out_edited);
data.PushElement("last-town", scenario.last_town_edited);
data.PushElement("last-out-section", cur_out);
data.PushElement("last-town", cur_town);
if(!scenario.custom_graphics.empty()) {
data.OpenElement("graphics");
for(size_t i = 0; i < scenario.custom_graphics.size(); i++) {
@@ -1068,8 +1069,8 @@ void save_scenario(fs::path toFile) {
fname.replace(dot,4,".boes");
else fname += ".boes";
}
scenario.scen_file = fname;
toFile = toFile.parent_path()/fname;
scenario.scen_file = toFile;
// Now write to zip file.
ogzstream zout(toFile.string().c_str());

View File

@@ -542,8 +542,8 @@ static bool commit_spec_enc(cDialog& me, std::string item_hit, node_stack_t& edi
int mode = edit_stack.top().mode, node = edit_stack.top().which;
switch(mode) {
case 0: scenario.scen_specials[node] = edit_stack.top().node; break;
case 1: town->specials[node] = edit_stack.top().node; break;
case 2: current_terrain->specials[node] = edit_stack.top().node; break;
case 1: current_terrain->specials[node] = edit_stack.top().node; break;
case 2: town->specials[node] = edit_stack.top().node; break;
}
edit_stack.pop();
if(item_hit == "okay") {