[Fix] Incorrect displaying info and tooltips in Advances Properties Tab#157
Merged
Conversation
* Tooltips were shifted by one position due to wrong handling "Accuracy modifier".
* DrawAdvancedValues():
if ( iFloatModifier[0] > 1.0 || ( fComparisonMode && iComparedFloatModifier[0] > 1.0 ) )
it checks number of laser range tiles (iFloatModifier[0] > 1.0, "meters" / CELL_X_SIZE) right before actual drawing a line with values. So if someone put 1..9 into XML (<BestLaserRange>) it will not print that value. But number of "meters" was checked (like x > 0) everywhere prior to this code.
so all the code before decided to draw line with icon for laser range, but the guilty code line didn't
I suppose not to draw laser info at all if a modder screwed up <BestLaserRange> putting a 1..9 value
so all values 0..9 basically mean 0 tiles, i.e. there is no laser ability.
NorthFury
reviewed
May 27, 2023
| // with the reworked NCTH code and the laser performance factor we will display BestLaserRange instead of ProjectionFactor but we still need the mouse region | ||
| if (UsingNewCTHSystem() && ( GetProjectionFactor( gpItemDescObject ) > 1.0 || GetBestLaserRange( gpItemDescObject ) > 0 | ||
| && (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) ) ) | ||
| if (UsingNewCTHSystem() && ( GetProjectionFactor( gpItemDescObject ) > 1.0 || (GetBestLaserRange(gpItemDescObject) / CELL_X_SIZE > 0 |
Contributor
There was a problem hiding this comment.
Adding / CELL_X_SIZE doesn't change the evaluation of the condition unless CELL_X_SIZE can be negative. I see CELL_X_SIZE is a constant defined as 10.
Contributor
Author
There was a problem hiding this comment.
It changes condition for cases when GetBestLaserRange(gpItemDescObject) returns [0..9]
Contributor
There was a problem hiding this comment.
I see. The division is evaluated to an integer. Thank you for the clarification.
NorthFury
reviewed
May 27, 2023
| if (UsingNewCTHSystem() && ( GetProjectionFactor( gpItemDescObject ) > 1.0 || GetBestLaserRange( gpItemDescObject ) > 0 | ||
| && (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0) ) ) | ||
| if (UsingNewCTHSystem() && ( GetProjectionFactor( gpItemDescObject ) > 1.0 || (GetBestLaserRange(gpItemDescObject) / CELL_X_SIZE > 0 | ||
| && (gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE != 0)) ) ) |
Contributor
There was a problem hiding this comment.
should this also be checking if it's higher than zero?
gGameCTHConstants.LASER_PERFORMANCE_BONUS_HIP + gGameCTHConstants.LASER_PERFORMANCE_BONUS_IRON + gGameCTHConstants.LASER_PERFORMANCE_BONUS_SCOPE > 0
Contributor
Author
There was a problem hiding this comment.
Maybe. But this was out of the scope of issue I resolved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tooltips were shifted by one position due to wrong handling "Accuracy modifier".
DrawAdvancedValues(): if ( iFloatModifier[0] > 1.0 || ( fComparisonMode && iComparedFloatModifier[0] > 1.0 ) ) it checks number of laser range tiles (iFloatModifier[0] > 1.0, "meters" / CELL_X_SIZE) right before actual drawing a line with values. So if someone put 1..9 into XML () it will not print that value. But number of "meters" was checked (like x > 0) everywhere prior to this code. so all the code before decided to draw line with icon for laser range, but the guilty code line didn't I suppose not to draw laser info at all if a modder screwed up putting a 1..9 value so all values 0..9 basically mean 0 tiles, i.e. there is no laser ability.