diff options
author | hop311 <hop3114@gmail.com> | 2024-04-24 00:59:36 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-04-24 00:59:36 +0200 |
commit | ef770b37ee841cca6899d1c91c3997365a8e8bb6 (patch) | |
tree | a23a97bd30aa6cb6b2731cd96c1d6c7e3d4bf4b9 /src/openvic-simulation/map/Province.cpp | |
parent | d0f8ec5484a0ea49d778c0ebb6c2ba2e6df9b7d1 (diff) |
Province text info functionsprovince-text
Diffstat (limited to 'src/openvic-simulation/map/Province.cpp')
-rw-r--r-- | src/openvic-simulation/map/Province.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp index 89ddd39..d4569ad 100644 --- a/src/openvic-simulation/map/Province.cpp +++ b/src/openvic-simulation/map/Province.cpp @@ -32,9 +32,9 @@ bool Province::load_positions(Map const& map, BuildingTypeManager const& buildin const fixed_point_t map_height = map.get_height(); const bool ret = expect_dictionary_keys( - "text_position", ZERO_OR_ONE, expect_fvec2(flip_y_callback(assign_variable_callback(positions.text), map_height)), - "text_rotation", ZERO_OR_ONE, - expect_fixed_point(negate_callback<fixed_point_t>(assign_variable_callback(positions.text_rotation))), + "text_position", ZERO_OR_ONE, + expect_fvec2(flip_y_callback(assign_variable_callback(positions.text_position), map_height)), + "text_rotation", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(positions.text_rotation)), "text_scale", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(positions.text_scale)), "unit", ZERO_OR_ONE, expect_fvec2(flip_y_callback(assign_variable_callback(positions.unit), map_height)), @@ -94,6 +94,18 @@ bool Province::load_positions(Map const& map, BuildingTypeManager const& buildin return ret; } +fvec2_t Province::get_text_position() const { + return positions.text_position.value_or(centre); +} + +fixed_point_t Province::get_text_rotation() const { + return positions.text_rotation.value_or(0); +} + +fixed_point_t Province::get_text_scale() const { + return positions.text_scale.value_or(1); +} + bool Province::expand_building(size_t building_index) { BuildingInstance* building = buildings.get_item_by_index(building_index); if (building == nullptr) { |