diff options
Diffstat (limited to 'src/openvic/map/Region.cpp')
-rw-r--r-- | src/openvic/map/Region.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/openvic/map/Region.cpp b/src/openvic/map/Region.cpp index 8ea45f0..6372e15 100644 --- a/src/openvic/map/Region.cpp +++ b/src/openvic/map/Region.cpp @@ -24,7 +24,7 @@ void ProvinceSet::lock(bool log) { Logger::error("Failed to lock province set - already locked!"); } else { locked = true; - if (log) Logger::info("Locked province set with ", get_province_count(), " provinces"); + if (log) Logger::info("Locked province set with ", size(), " provinces"); } } @@ -37,10 +37,18 @@ void ProvinceSet::reset() { locked = false; } -size_t ProvinceSet::get_province_count() const { +size_t ProvinceSet::size() const { return provinces.size(); } +void ProvinceSet::reserve(size_t size) { + if (locked) { + Logger::error("Failed to reserve space for ", size, " items in province set - already locked!"); + } else { + provinces.reserve(size); + } +} + bool ProvinceSet::contains_province(Province const* province) const { return province && std::find(provinces.begin(), provinces.end(), province) != provinces.end(); } |