diff options
Diffstat (limited to 'src/openvic-simulation/map/Province.cpp')
-rw-r--r-- | src/openvic-simulation/map/Province.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp index 8dcaa42..19dd873 100644 --- a/src/openvic-simulation/map/Province.cpp +++ b/src/openvic-simulation/map/Province.cpp @@ -138,24 +138,22 @@ void Province::tick(Date const& today) { building.tick(today); } -Province::adjacency_t::adjacency_t(index_t new_provice_id, distance_t new_distance, flags_t new_flags) { - assert(new_provice_id != Province::NULL_INDEX); - province_id = new_provice_id; - distance = new_distance; - flags = new_flags; +Province::adjacency_t::adjacency_t(Province const* province, distance_t distance, flags_t flags) + : province { province }, distance { distance }, flags { flags } { + assert(province != nullptr); } -bool Province::is_adjacent_to(index_t province_index) { +bool Province::is_adjacent_to(Province const* province) { for (adjacency_t adj : adjacencies) - if (adj.province_id == province_index) + if (adj.province->index == province->index) return true; return false; } -bool Province::add_adjacency(index_t province_index, distance_t distance, flags_t flags) { - if (is_adjacent_to(province_index)) +bool Province::add_adjacency(Province const* province, distance_t distance, flags_t flags) { + if (is_adjacent_to(province)) return false; - adjacencies.push_back({ province_index, distance, flags }); + adjacencies.push_back({ province, distance, flags }); return true; } |