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

Replaces inconsistent implementations of the square root of 2 #10070

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions code/__DEFINES/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#define INFINITY 1e31 //closer then enough
#define SYSTEM_TYPE_INFINITY 1.#INF //only for isinf check

#define SQRT_TWO 1.414214

#define SHORT_REAL_LIMIT 16777216

/// A 32 bit single-precision floating point number's mantissa gives us 7 significant digits
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/riding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
Unbuckle(user)
return

if(world.time < last_vehicle_move + ((last_move_diagonal? SQRT_TWO : 1) * vehicle_move_delay * vehicle_move_multiplier))
if(world.time < last_vehicle_move + ((last_move_diagonal? sqrt(2) : 1) * vehicle_move_delay * vehicle_move_multiplier))
return
last_vehicle_move = world.time

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/mob_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
. = ..()

if((direct & (direct - 1)) && mob.loc == n) //moved diagonally successfully
add_delay *= 1.414214 // sqrt(2)
add_delay *= sqrt(2)
// Record any time that we gained due to sub-tick slowdown
var/move_delta = move_delay - floored_move_delay
add_delay += move_delta
Expand Down