Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change negative threshold values to act as inverted threshold #317

Merged
merged 4 commits into from
Dec 10, 2024

Conversation

AdenKoperczak
Copy link
Contributor

If this is not a change you want to make, I am fine with that. It was a small change I was interested in, and I want your opinion on it.
Inverted threshold means that once you zoom in past that threshold, it disrepair. This is useful for placefiles that give low detail, nation wide information, such as surface fronts.

Breaking Compatibility
I do not believe this will break compatibility with placefiles or other programs. If any placefile does use negative numbers to disable threshold's, the user can disable thresholds in Supercell Wx. The only case this would not work is if a placefile sometimes has thresholds, and sometimes uses negative numbers to disable thresholds. If other programs act as Supercell Wx did before this change, then any placefile with negative threshold will simply not have a threshold.

@@ -136,7 +136,11 @@ void PlacefileText::Impl::RenderTextDrawItem(
std::chrono::system_clock::now() :
selectedTime_;

if ((!thresholded_ || mapDistance_ <= di->threshold_) &&
const bool thresholdMet =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding !thresholded_ to the front of this check, to optimize and skip performing evaluation when not thresholding.

if ((!thresholded_ || mapDistance_ <= di->threshold_) &&
const bool thresholdMet =
mapDistance_ <= di->threshold_ ||
((double) di->threshold_ < 0.0 && mapDistance_ >= -(di->threshold_));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: recommend static_cast(value) over C-style cast

@dpaulat dpaulat merged commit 37af071 into dpaulat:develop Dec 10, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants