diff options
author | Hop311 <Hop3114@gmail.com> | 2024-05-16 22:15:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-16 22:15:25 +0200 |
commit | 963a4a84a0cb6990f4542eafa0b8a82cfc032834 (patch) | |
tree | 1ee38ce3be0325752f89e72062aea51d54747a70 /extension/src/openvic-extension/classes | |
parent | bfccdb87d66304604ad018037db1581746646bfa (diff) | |
parent | 14a2b79f261091dede324f972f9c7841974c9a2a (diff) |
Merge pull request #230 from OpenVicProject/misc
Misc UI code changes
Diffstat (limited to 'extension/src/openvic-extension/classes')
-rw-r--r-- | extension/src/openvic-extension/classes/GFXPieChartTexture.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/extension/src/openvic-extension/classes/GFXPieChartTexture.cpp b/extension/src/openvic-extension/classes/GFXPieChartTexture.cpp index 10a2cb5..ead72cf 100644 --- a/extension/src/openvic-extension/classes/GFXPieChartTexture.cpp +++ b/extension/src/openvic-extension/classes/GFXPieChartTexture.cpp @@ -111,12 +111,11 @@ Error GFXPieChartTexture::set_slices_array(godot_pie_chart_data_t const& new_sli ERR_CONTINUE_MSG( !slice_dict.has(_slice_colour_key()) || !slice_dict.has(_slice_weight_key()), vformat("Invalid slice keys at index %d", i) ); - slice_t slice = std::make_pair(slice_dict[_slice_colour_key()], slice_dict[_slice_weight_key()]); - ERR_CONTINUE_MSG( - slice.second <= 0.0f, vformat("Invalid slice values at index %d \"%s\"", i, slice_dict[_slice_identifier_key()]) - ); - total_weight += slice.second; - slices.emplace_back(std::move(slice)); + const slice_t slice = std::make_pair(slice_dict[_slice_colour_key()], slice_dict[_slice_weight_key()]); + if (slice.second > 0.0f) { + total_weight += slice.second; + slices.push_back(slice); + } } return _generate_pie_chart_image(); } |