aboutsummaryrefslogtreecommitdiff
path: root/src/openvic/map/Region.cpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-09-07 00:54:09 +0200
committer Hop311 <hop3114@gmail.com>2023-09-07 20:37:24 +0200
commit3cd1d62ec00690a1b29070dd4903754e8f089a21 (patch)
tree61d630aa130f8411cc0d539dbfb3705154740631 /src/openvic/map/Region.cpp
parent8e12540771f1fcc670481aa6299fd73cb10aad00 (diff)
NodeTools cleanup+province definition csv loading
Diffstat (limited to 'src/openvic/map/Region.cpp')
-rw-r--r--src/openvic/map/Region.cpp12
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();
}