Skip to content

[Fix] Incorrect displaying info and tooltips in Advances Properties Tab#157

Merged
sun-alf merged 1 commit into
masterfrom
master_1dot13
May 29, 2023
Merged

[Fix] Incorrect displaying info and tooltips in Advances Properties Tab#157
sun-alf merged 1 commit into
masterfrom
master_1dot13

Conversation

@sun-alf
Copy link
Copy Markdown
Contributor

@sun-alf sun-alf commented May 27, 2023

  • 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.

* 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.
// 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
Copy link
Copy Markdown
Contributor

@NorthFury NorthFury May 27, 2023

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It changes condition for cases when GetBestLaserRange(gpItemDescObject) returns [0..9]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. The division is evaluated to an integer. Thank you for the clarification.

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)) ) )
Copy link
Copy Markdown
Contributor

@NorthFury NorthFury May 27, 2023

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

@sun-alf sun-alf May 29, 2023

Choose a reason for hiding this comment

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

Maybe. But this was out of the scope of issue I resolved.

@sun-alf sun-alf merged commit 481e518 into master May 29, 2023
@sun-alf sun-alf deleted the master_1dot13 branch May 29, 2023 19:46
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