Change town locations variable name to better reflect its use

This commit is contained in:
2015-02-06 14:55:37 -05:00
parent 7f6992da56
commit 7307fee425
6 changed files with 35 additions and 35 deletions

View File

@@ -526,11 +526,11 @@ static void handle_move(location destination, bool& did_something, bool& need_re
else if(univ.party.direction < 4) find_direction_from = 3; else if(univ.party.direction < 4) find_direction_from = 3;
else find_direction_from = 1; else find_direction_from = 1;
for(int i = 0; i < univ.out->exit_locs.size(); i++) for(int i = 0; i < univ.out->city_locs.size(); i++)
if(univ.party.loc_in_sec == univ.out->exit_locs[i]) { if(univ.party.loc_in_sec == univ.out->city_locs[i]) {
short which_t = univ.out->exit_locs[i].spec; short which_t = univ.out->city_locs[i].spec;
if(which_t >= 0) if(which_t >= 0)
start_town_mode(univ.out->exit_locs[i].spec, find_direction_from); start_town_mode(univ.out->city_locs[i].spec, find_direction_from);
if(is_town()) { if(is_town()) {
need_redraw = false; need_redraw = false;
i = 8; i = 8;

View File

@@ -1264,18 +1264,18 @@ void erase_out_specials() {
for(short j = 0; j < 2; j++) for(short j = 0; j < 2; j++)
if(quadrant_legal(i,j)) { if(quadrant_legal(i,j)) {
cOutdoors& sector = *univ.scenario.outdoors[univ.party.outdoor_corner.x + i][univ.party.outdoor_corner.y + j]; cOutdoors& sector = *univ.scenario.outdoors[univ.party.outdoor_corner.x + i][univ.party.outdoor_corner.y + j];
for(short k = 0; k < sector.exit_locs.size(); k++) { for(short k = 0; k < sector.city_locs.size(); k++) {
if(sector.exit_locs[k].spec >= 0 && if(sector.city_locs[k].spec >= 0 &&
univ.scenario.ter_types[sector.terrain[sector.exit_locs[k].x][sector.exit_locs[k].y]].special == eTerSpec::TOWN_ENTRANCE && univ.scenario.ter_types[sector.terrain[sector.city_locs[k].x][sector.city_locs[k].y]].special == eTerSpec::TOWN_ENTRANCE &&
(sector.exit_locs[k].x == minmax(0,47,sector.exit_locs[k].x)) && (sector.city_locs[k].x == minmax(0,47,sector.city_locs[k].x)) &&
(sector.exit_locs[k].y == minmax(0,47,sector.exit_locs[k].y))) { (sector.city_locs[k].y == minmax(0,47,sector.city_locs[k].y))) {
if(!univ.party.can_find_town[sector.exit_locs[k].spec]) { if(!univ.party.can_find_town[sector.city_locs[k].spec]) {
univ.out[48 * i + sector.exit_locs[k].x][48 * j + sector.exit_locs[k].y] = univ.out[48 * i + sector.city_locs[k].x][48 * j + sector.city_locs[k].y] =
univ.scenario.ter_types[sector.terrain[sector.exit_locs[k].x][sector.exit_locs[k].y]].flag1; univ.scenario.ter_types[sector.terrain[sector.city_locs[k].x][sector.city_locs[k].y]].flag1;
} }
else if(univ.party.can_find_town[sector.exit_locs[k].spec]) { else if(univ.party.can_find_town[sector.city_locs[k].spec]) {
univ.out[48 * i + sector.exit_locs[k].x][48 * j + sector.exit_locs[k].y] = univ.out[48 * i + sector.city_locs[k].x][48 * j + sector.city_locs[k].y] =
sector.terrain[sector.exit_locs[k].x][sector.exit_locs[k].y]; sector.terrain[sector.city_locs[k].x][sector.city_locs[k].y];
} }
} }

View File

@@ -75,9 +75,9 @@ void cOutdoors::append(legacy::outdoor_record_type& old){
else special_locs[i].spec = old.special_id[i]; else special_locs[i].spec = old.special_id[i];
} }
for(i = 0; i < 8; i++){ for(i = 0; i < 8; i++){
exit_locs[i].x = old.exit_locs[i].x; city_locs[i].x = old.exit_locs[i].x;
exit_locs[i].y = old.exit_locs[i].y; city_locs[i].y = old.exit_locs[i].y;
exit_locs[i].spec = old.exit_dests[i]; city_locs[i].spec = old.exit_dests[i];
sign_locs[i].x = old.sign_locs[i].x; sign_locs[i].x = old.sign_locs[i].x;
sign_locs[i].y = old.sign_locs[i].y; sign_locs[i].y = old.sign_locs[i].y;
info_rect[i].top = old.info_rect[i].top; info_rect[i].top = old.info_rect[i].top;
@@ -133,7 +133,7 @@ cOutdoors::cOutdoors(cScenario& scenario, bool init_strings) : scenario(scenario
} }
for(i = 0; i < 8; i++) { for(i = 0; i < 8; i++) {
exit_locs[i].x = 100; city_locs[i].x = 100;
sign_locs[i].x = 100; sign_locs[i].x = 100;
} }
for(i = 0; i < 4; i++) { for(i = 0; i < 4; i++) {

View File

@@ -61,7 +61,7 @@ public:
short x,y; // Used while loading legacy scenarios. short x,y; // Used while loading legacy scenarios.
ter_num_t terrain[48][48]; ter_num_t terrain[48][48];
std::vector<spec_loc_t> special_locs; std::vector<spec_loc_t> special_locs;
std::array<spec_loc_t,8> exit_locs; std::array<spec_loc_t,8> city_locs;
std::array<sign_loc_t,8> sign_locs; std::array<sign_loc_t,8> sign_locs;
std::array<cWandering,4> wandering, special_enc; std::array<cWandering,4> wandering, special_enc;
location wandering_locs[4]; location wandering_locs[4];

View File

@@ -2027,25 +2027,25 @@ void town_entry(location spot_hit) {
return; return;
} }
// clean up old town entries // clean up old town entries
for(x = 0; x < current_terrain->exit_locs.size(); x++) for(x = 0; x < current_terrain->city_locs.size(); x++)
if(current_terrain->exit_locs[x].spec >= 0) { if(current_terrain->city_locs[x].spec >= 0) {
ter = current_terrain->terrain[current_terrain->exit_locs[x].x][current_terrain->exit_locs[x].y]; ter = current_terrain->terrain[current_terrain->city_locs[x].x][current_terrain->city_locs[x].y];
if(scenario.ter_types[ter].special != eTerSpec::TOWN_ENTRANCE) if(scenario.ter_types[ter].special != eTerSpec::TOWN_ENTRANCE)
current_terrain->exit_locs[x].spec = -1; current_terrain->city_locs[x].spec = -1;
} }
y = -2; y = -2;
for(x = 0; x < current_terrain->exit_locs.size(); x++) for(x = 0; x < current_terrain->city_locs.size(); x++)
if(current_terrain->exit_locs[x] == spot_hit) { if(current_terrain->city_locs[x] == spot_hit) {
y = pick_town_num("select-town-enter",current_terrain->exit_locs[x].spec,scenario); y = pick_town_num("select-town-enter",current_terrain->city_locs[x].spec,scenario);
if(y >= 0) current_terrain->exit_locs[x].spec = y; if(y >= 0) current_terrain->city_locs[x].spec = y;
} }
if(y == -2) { if(y == -2) {
for(x = 0; x < current_terrain->exit_locs.size(); x++) for(x = 0; x < current_terrain->city_locs.size(); x++)
if(current_terrain->exit_locs[x].spec < 0) { if(current_terrain->city_locs[x].spec < 0) {
y = pick_town_num("select-town-enter",0,scenario); y = pick_town_num("select-town-enter",0,scenario);
if(y >= 0) { if(y >= 0) {
current_terrain->exit_locs[x].spec = y; current_terrain->city_locs[x].spec = y;
current_terrain->exit_locs[x] = spot_hit; current_terrain->city_locs[x] = spot_hit;
} }
x = 500; x = 500;
} }

View File

@@ -797,9 +797,9 @@ static map_data buildOutMapData(location which) {
if(sector.special_locs[i].spec >= 0) if(sector.special_locs[i].spec >= 0)
terrain.addFeature(sector.special_locs[i].x, sector.special_locs[i].y, eMapFeature::SPECIAL_NODE, sector.special_locs[i].spec); terrain.addFeature(sector.special_locs[i].x, sector.special_locs[i].y, eMapFeature::SPECIAL_NODE, sector.special_locs[i].spec);
} }
for(size_t i = 0; i < sector.exit_locs.size(); i++) { for(size_t i = 0; i < sector.city_locs.size(); i++) {
if(sector.exit_locs[i].spec >= 0) if(sector.city_locs[i].spec >= 0)
terrain.addFeature(sector.exit_locs[i].x, sector.exit_locs[i].y, eMapFeature::TOWN, sector.exit_locs[i].spec); terrain.addFeature(sector.city_locs[i].x, sector.city_locs[i].y, eMapFeature::TOWN, sector.city_locs[i].spec);
} }
for(size_t i = 0; i < sector.sign_locs.size(); i++) { for(size_t i = 0; i < sector.sign_locs.size(); i++) {
if(!sector.sign_locs[i].text.empty()) if(!sector.sign_locs[i].text.empty())