From 0966f90f08bf2519ce862981f28877442356081b Mon Sep 17 00:00:00 2001 From: Nemrav <> Date: Sun, 17 Nov 2024 18:10:40 -0400 Subject: update sim for billboards --- extension/src/openvic-extension/singletons/MapItemSingleton.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'extension/src/openvic-extension/singletons') 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 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 -- cgit v1.2.3-56-ga3b1