aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/singletons
diff options
context:
space:
mode:
author Nemrav <>2024-11-17 23:10:40 +0100
committer Nemrav <>2024-11-17 23:10:40 +0100
commit0966f90f08bf2519ce862981f28877442356081b (patch)
tree1c9082d6be741bcf46b16f91d42718a14e94877b /extension/src/openvic-extension/singletons
parent0d1f42829b154c172608450e3689c56cbfacb4fd (diff)
update sim for billboardsbillboards
Diffstat (limited to 'extension/src/openvic-extension/singletons')
-rw-r--r--extension/src/openvic-extension/singletons/MapItemSingleton.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/extension/src/openvic-extension/singletons/MapItemSingleton.cpp b/extension/src/openvic-extension/singletons/MapItemSingleton.cpp
index d62e0fd..5b2127b 100644
--- a/extension/src/openvic-extension/singletons/MapItemSingleton.cpp
+++ b/extension/src/openvic-extension/singletons/MapItemSingleton.cpp
@@ -122,6 +122,7 @@ TypedArray<Dictionary> MapItemSingleton::get_billboards(){
return ret;
}
+//dont use this, it includes water provinces
int MapItemSingleton::get_province_count(){
GameSingleton const* game_singleton = GameSingleton::get_singleton();
ERR_FAIL_NULL_V(game_singleton, 0);
@@ -143,8 +144,10 @@ PackedVector2Array MapItemSingleton::get_province_positions(){
Logger::info("prov_count ", prov_count);
for(int i = 0; i < prov_count; i++){
+ //i+1 because the province indices are 1 based (0 causes an error)
ProvinceDefinition const* prov = game_singleton->get_definition_manager()
.get_map_definition().get_province_definition_by_index(i+1);
+ if(prov->is_water()) continue; //billboards dont appear over water, skip
fvec2_t city_pos = prov->get_city_position();
Vector2 pos = Utilities::to_godot_fvec2(city_pos) / game_singleton->get_map_dims();
@@ -155,6 +158,6 @@ PackedVector2Array MapItemSingleton::get_province_positions(){
//province_dict[position_key] = Utilities::to_godot_fvec2(province.get_text_position()) / get_map_dims();
}
-
+
return billboard_pos;
} \ No newline at end of file