Formatting

This commit is contained in:
2018-02-17 18:14:38 -05:00
parent b7d62067cc
commit 1d5e0c2e1e
3 changed files with 13 additions and 19 deletions

View File

@@ -1257,11 +1257,10 @@ void erase_out_specials() {
} }
} }
void erase_hidden_towns(cOutdoors& sector, int quadrant_x, int quadrant_y) void erase_hidden_towns(cOutdoors& sector, int quadrant_x, int quadrant_y) {
{ for(short tile_index = 0; tile_index < sector.city_locs.size(); tile_index++) {
for (short tile_index = 0; tile_index < sector.city_locs.size(); tile_index++) {
auto city_loc = sector.city_locs[tile_index]; auto city_loc = sector.city_locs[tile_index];
if (!univ.scenario.is_town_entrance_valid(city_loc) || if(!univ.scenario.is_town_entrance_valid(city_loc) ||
!does_location_have_special(sector, city_loc, eTerSpec::TOWN_ENTRANCE) || !does_location_have_special(sector, city_loc, eTerSpec::TOWN_ENTRANCE) ||
!sector.is_on_map(city_loc)) { !sector.is_on_map(city_loc)) {
continue; continue;
@@ -1271,7 +1270,7 @@ void erase_hidden_towns(cOutdoors& sector, int quadrant_x, int quadrant_y)
auto spec_pos_x = sector.city_locs[tile_index].x; auto spec_pos_x = sector.city_locs[tile_index].x;
auto spec_pos_y = sector.city_locs[tile_index].y; auto spec_pos_y = sector.city_locs[tile_index].y;
auto area_index = sector.terrain[spec_pos_x][spec_pos_y]; auto area_index = sector.terrain[spec_pos_x][spec_pos_y];
if (!univ.scenario.towns[sector.city_locs[tile_index].spec]->can_find) { if(!univ.scenario.towns[sector.city_locs[tile_index].spec]->can_find) {
univ.out[town_pos_x][town_pos_y] = univ.scenario.ter_types[area_index].flag1; univ.out[town_pos_x][town_pos_y] = univ.scenario.ter_types[area_index].flag1;
} else { } else {
univ.out[town_pos_x][town_pos_y] = area_index; univ.out[town_pos_x][town_pos_y] = area_index;
@@ -1279,17 +1278,16 @@ void erase_hidden_towns(cOutdoors& sector, int quadrant_x, int quadrant_y)
} }
} }
void erase_completed_specials(cOutdoors& sector) void erase_completed_specials(cOutdoors& sector) {
{ for(auto tile_index = 0; tile_index < sector.special_locs.size(); tile_index++) {
for (auto tile_index = 0; tile_index < sector.special_locs.size(); tile_index++) { if(sector.special_locs[tile_index].spec < 0 ||
if (sector.special_locs[tile_index].spec < 0 ||
sector.special_locs[tile_index].spec >= sector.specials.size()) sector.special_locs[tile_index].spec >= sector.specials.size())
continue; continue;
auto sn = sector.specials[sector.special_locs[tile_index].spec]; auto sn = sector.specials[sector.special_locs[tile_index].spec];
if (univ.party.sd_legit(sn.sd1, sn.sd2) && PSD[sn.sd1][sn.sd2] == SDF_COMPLETE) { if(univ.party.sd_legit(sn.sd1, sn.sd2) && PSD[sn.sd1][sn.sd2] == SDF_COMPLETE) {
auto completed_special = sector.special_locs[tile_index]; auto completed_special = sector.special_locs[tile_index];
if (!sector.is_on_map(completed_special)) { if(!sector.is_on_map(completed_special)) {
beep(); beep();
add_string_to_buf("Outdoor section corrupt. Problem fixed."); add_string_to_buf("Outdoor section corrupt. Problem fixed.");
sector.special_locs[tile_index].spec = -1; // TODO: Again, was there a reason for commenting this out? sector.special_locs[tile_index].spec = -1; // TODO: Again, was there a reason for commenting this out?
@@ -1300,8 +1298,7 @@ void erase_completed_specials(cOutdoors& sector)
} }
} }
bool does_location_have_special(cOutdoors& sector, location loc, eTerSpec special) bool does_location_have_special(cOutdoors& sector, location loc, eTerSpec special) {
{
auto terrain_index = sector.terrain[loc.x][loc.y]; auto terrain_index = sector.terrain[loc.x][loc.y];
return univ.scenario.ter_types[terrain_index].special == special; return univ.scenario.ter_types[terrain_index].special == special;
} }

View File

@@ -43,8 +43,7 @@ public:
, maps(dim, boost::dynamic_bitset<>(dim)) , maps(dim, boost::dynamic_bitset<>(dim))
{} {}
bool is_on_map(location loc) const bool is_on_map(location loc) const {
{
return loc.x < max_dim && loc.y < max_dim && loc.x >= 0 && loc.y >= 0; return loc.x < max_dim && loc.y < max_dim && loc.x >= 0 && loc.y >= 0;
} }
}; };

View File

@@ -529,13 +529,11 @@ cItem cScenario::return_treasure(int loot, bool allow_junk) {
return treas; return treas;
} }
cOutdoors& cScenario::get_sector(int x, int y) cOutdoors& cScenario::get_sector(int x, int y) {
{
return *outdoors[x][y]; return *outdoors[x][y];
} }
bool cScenario::is_town_entrance_valid(spec_loc_t loc) const bool cScenario::is_town_entrance_valid(spec_loc_t loc) const {
{
auto towns_in_scenario = towns.size(); auto towns_in_scenario = towns.size();
return loc.spec >= 0 && loc.spec < towns_in_scenario; return loc.spec >= 0 && loc.spec < towns_in_scenario;
} }