Scenario editor initialize new town bounds/entrances

This commit is contained in:
2023-02-02 18:42:08 -07:00
committed by Celtic Minstrel
parent 8ec20f977d
commit cf28d61035
3 changed files with 6 additions and 3 deletions

View File

@@ -94,6 +94,7 @@ public:
std::vector<cTown*> towns; std::vector<cTown*> towns;
void addTown(size_t dim) { void addTown(size_t dim) {
towns.push_back(new cTown(*this, dim)); towns.push_back(new cTown(*this, dim));
towns.back()->init_start();
} }
void import_legacy(legacy::scenario_data_type& old); void import_legacy(legacy::scenario_data_type& old);

View File

@@ -81,10 +81,12 @@ cTown::cTown(cScenario& scenario, size_t dim) : cArea(dim), scenario(&scenario),
town_chop_key = -1; town_chop_key = -1;
for(short i = 0; i < wandering.size(); i++) { for(short i = 0; i < wandering.size(); i++) {
wandering[i] = d_wan; wandering[i] = d_wan;
// x of 100 indicates an unset wandering monster location
wandering_locs[i].x = 100; wandering_locs[i].x = 100;
} }
lighting_type = LIGHT_NORMAL; lighting_type = LIGHT_NORMAL;
for(short i = 0; i < 4; i++) { for(short i = 0; i < 4; i++) {
// x of 100 indicates an unset starting location
start_locs[i].x = 100; start_locs[i].x = 100;
exits[i].spec = -1; exits[i].spec = -1;
exits[i].x = -1; exits[i].x = -1;

View File

@@ -1324,9 +1324,9 @@ bool new_town() {
std::string size = dynamic_cast<cLedGroup&>(new_dlg->getControl("size")).getSelected(); std::string size = dynamic_cast<cLedGroup&>(new_dlg->getControl("size")).getSelected();
std::string preset = dynamic_cast<cLedGroup&>(new_dlg->getControl("preset")).getSelected(); std::string preset = dynamic_cast<cLedGroup&>(new_dlg->getControl("preset")).getSelected();
if(size == "lg") scenario.towns.push_back(new cTown(scenario, AREA_LARGE)); if(size == "lg") scenario.addTown(AREA_LARGE);
else if(size == "med") scenario.towns.push_back(new cTown(scenario, AREA_MEDIUM)); else if(size == "med") scenario.addTown(AREA_MEDIUM);
else if(size == "sm") scenario.towns.push_back(new cTown(scenario, AREA_SMALL)); else if(size == "sm") scenario.addTown(AREA_SMALL);
set_current_town(scenario.towns.size() - 1); set_current_town(scenario.towns.size() - 1);
town->name = new_dlg->getControl("name").getText().substr(0,30); town->name = new_dlg->getControl("name").getText().substr(0,30);