freebsd-ports/games/barony/files/patch-src_net.cpp
Robert Clausecker 835b479670 games/barony: Fix build on armv7
The type real_t is float on ARM but double on other platforms.  Pepper
in a bunch of extra casts to make clang happy.

The alternative of making real_t a double on ARM does not work.

PR:		267442
Approved by:	maintainer timeout, >2 weeks
MFH:		2022Q4
2022-11-14 20:03:54 +00:00

11 lines
675 B
C++

--- src/net.cpp.orig 2022-10-30 17:24:45 UTC
+++ src/net.cpp
@@ -4212,7 +4212,7 @@ void clientHandlePacket()
if ( players[clientnum] && players[clientnum]->entity && stats[clientnum] )
{
real_t vel = sqrt(pow(players[clientnum]->entity->vel_y, 2) + pow(players[clientnum]->entity->vel_x, 2));
- players[clientnum]->entity->monsterKnockbackVelocity = std::min(2.25, std::max(1.0, vel));
+ players[clientnum]->entity->monsterKnockbackVelocity = std::min((real_t)2.25, std::max((real_t)1.0, vel));
players[clientnum]->entity->monsterKnockbackTangentDir = atan2(players[clientnum]->entity->vel_y, players[clientnum]->entity->vel_x);
if ( vel < 0.01 )
{