aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GUINode.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-05-09 23:32:18 +0200
committer GitHub <noreply@github.com>2024-05-09 23:32:18 +0200
commitb0a533f945bbc6201fd7df4bc60746cb98efaba4 (patch)
tree56c84e804b11a271e15f38e64d5b3727c636b474 /extension/src/openvic-extension/classes/GUINode.cpp
parentf57bbe6604a237c9fea52aec43641585d0b24568 (diff)
parenta3ef8c1ad72f7e839e073679f374195681208837 (diff)
Merge pull request #228 from OpenVicProject/menu-tweaks
Topbar display data + Population menu rebel icons
Diffstat (limited to 'extension/src/openvic-extension/classes/GUINode.cpp')
-rw-r--r--extension/src/openvic-extension/classes/GUINode.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/extension/src/openvic-extension/classes/GUINode.cpp b/extension/src/openvic-extension/classes/GUINode.cpp
index c9af7e2..452efc8 100644
--- a/extension/src/openvic-extension/classes/GUINode.cpp
+++ b/extension/src/openvic-extension/classes/GUINode.cpp
@@ -84,8 +84,9 @@ void GUINode::_bind_methods() {
OV_BIND_METHOD(GUINode::hide_node, { "path" });
OV_BIND_METHOD(GUINode::hide_nodes, { "paths" });
- OV_BIND_SMETHOD(int_to_formatted_string, { "val" });
- OV_BIND_SMETHOD(float_to_formatted_string, { "val", "decimal_places" });
+ OV_BIND_SMETHOD(int_to_string_suffixed, { "val" });
+ OV_BIND_SMETHOD(float_to_string_suffixed, { "val" });
+ OV_BIND_SMETHOD(float_to_string_dp, { "val", "decimal_places" });
OV_BIND_SMETHOD(format_province_name, { "province_identifier" });
}
@@ -221,17 +222,26 @@ Error GUINode::hide_nodes(TypedArray<NodePath> const& paths) const {
return ret;
}
-String GUINode::int_to_formatted_string(int64_t val) {
- return Utilities::int_to_formatted_string(val);
+String GUINode::int_to_string_suffixed(int64_t val) {
+ return Utilities::int_to_string_suffixed(val);
}
-String GUINode::float_to_formatted_string(float val, int32_t decimal_places) {
- return Utilities::float_to_formatted_string(val, decimal_places);
+String GUINode::float_to_string_suffixed(float val) {
+ return Utilities::float_to_string_suffixed(val);
+}
+
+String GUINode::float_to_string_dp(float val, int32_t decimal_places) {
+ return Utilities::float_to_string_dp(val, decimal_places);
}
String GUINode::format_province_name(String const& province_identifier) {
- static const String province_prefix = "PROV";
- return province_prefix + province_identifier;
+ if (!province_identifier.is_empty()) {
+ static const String province_prefix = "PROV";
+ return province_prefix + province_identifier;
+ } else {
+ static const String no_province = "NO PROVINCE";
+ return no_province;
+ }
}
Ref<BitMap> GUINode::get_click_mask() const {