aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/GameManager.cpp
diff options
context:
space:
mode:
author BuildTools <unconfigured@null.spigotmc.org>2023-11-20 08:23:08 +0100
committer hop311 <hop3114@gmail.com>2023-12-17 20:43:53 +0100
commitee9562c767631fbec6b444cf18f2435d24848e93 (patch)
tree8c5a770d6cf6d01c6b92247ae89522f9165967ef /src/openvic-simulation/GameManager.cpp
parente6b455b8924948761dbd792756303efe18875c6d (diff)
Additional adjacency loading
Diffstat (limited to 'src/openvic-simulation/GameManager.cpp')
-rw-r--r--src/openvic-simulation/GameManager.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/openvic-simulation/GameManager.cpp b/src/openvic-simulation/GameManager.cpp
index 5142c66..6c600ae 100644
--- a/src/openvic-simulation/GameManager.cpp
+++ b/src/openvic-simulation/GameManager.cpp
@@ -203,6 +203,43 @@ bool GameManager::load_hardcoded_defines() {
},
{
"mapmode_religion", shaded_mapmode(&Province::get_religion_distribution)
+ },
+ {
+ "mapmode_adjacencies", [](Map const& map, Province const& province) -> Mapmode::base_stripe_t {
+ Province const* selected_province = map.get_selected_province();
+ if (selected_province != nullptr) {
+ if (selected_province == &province) {
+ return make_solid_base_stripe(ALPHA_VALUE | 0xFFFFFF);
+ }
+ colour_t base = NULL_COLOUR, stripe = NULL_COLOUR;
+ Province::adjacency_t const* adj = selected_province->get_adjacency_to(&province);
+ if (adj != nullptr) {
+ using enum Province::adjacency_t::type_t;
+ switch (adj->get_type()) {
+ case LAND: base = 0x00FF00; break;
+ case WATER: base = 0x0000FF; break;
+ case COASTAL: base = 0xF9D199; break;
+ case IMPASSABLE: base = 0x8B4513; break;
+ case STRAIT: base = 0x00FFFF; break;
+ case CANAL: base = 0x888888; break;
+ default: base = 0xFF0000; break;
+ }
+ base |= ALPHA_VALUE;
+ stripe = base;
+ }
+ if (selected_province->has_adjacency_going_through(&province)) {
+ stripe = ALPHA_VALUE | 0xFFFF00;
+ }
+
+ return combine_base_stripe(base, stripe);
+ }
+ return NULL_COLOUR;
+ }
+ },
+ {
+ "mapmode_port", make_solid_base_stripe_func([](Map const& map, Province const& province) -> colour_t {
+ return province.has_port() ? ALPHA_VALUE | 0xFFFFFF : NULL_COLOUR;
+ })
}
};