[Scummvm-tracker] [ScummVM :: Bugs] #15292: AGS: Incorrect Use of Bitwise XOR Operator in Distance Calculation
ScummVM :: Bugs
trac at scummvm.org
Thu Jul 25 03:44:55 UTC 2024
#15292: AGS: Incorrect Use of Bitwise XOR Operator in Distance Calculation
--------------------+-------------------------
Reporter: RainRat | Owner: (none)
Type: defect | Status: new
Priority: low | Component: Engine: AGS
Version: | Keywords:
Game: |
--------------------+-------------------------
scummvm/blob/master/engines/ags/shared/util/geometry.cpp:
The function DistanceBetween in this code uses the bitwise XOR operator
(`^`) instead of the multiplication operator (`*`) when calculating the
square of distances. This results in incorrect distance calculations.
Current Code:
{{{
return static_cast<float>(std::sqrt((inner_width ^ 2) + (inner_height ^
2)));
}}}
Expected Code:
{{{
return static_cast<float>(std::sqrt(inner_width * inner_width +
inner_height * inner_height));
}}}
--
Ticket URL: <https://bugs.scummvm.org/ticket/15292>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list