freebsd-ports/games/spring/files/patch-math
Jan Beich 3e0b78e13f games/spring: unbreak with boost 1.65
PR:		220762
Submitted by:	Walter Schwarzenfeld <w.schwarzenfeld@utanet.at>
Approved by:	maintainer timeout (3 months)
2018-03-03 22:40:28 +00:00

196 lines
6.4 KiB
Text

+++ rts/aGui/GuiElement.h 2015-04-08 15:06:26 -0400
@@ -4,4 +4,5 @@
#define GUIELEMENT_H
+#include <cmath>
#include <list>
#include <SDL_events.h>
+++ rts/lib/streflop/SMath.h
@@ -16,6 +16,8 @@
#ifndef STREFLOP_MATH_H
#define STREFLOP_MATH_H
+#include <cmath>
+
// just in case, should already be included
#include "streflop.h"
+++ rts/Sim/Weapons/LaserCannon.cpp 2015-04-07 20:49:52 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "LaserCannon.h"
#include "WeaponDef.h"
+++ rts/Sim/Weapons/FlameThrower.cpp 2015-04-07 20:50:46 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "FlameThrower.h"
#include "WeaponDef.h"
+++ rts/Sim/Weapons/MissileLauncher.cpp 2015-04-07 20:53:21 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "MissileLauncher.h"
#include "WeaponDef.h"
+++ rts/Sim/Weapons/EmgCannon.cpp 2015-04-07 20:57:50 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "EmgCannon.h"
#include "WeaponDef.h"
+++ rts/Sim/Units/Groups/GroupHandler.cpp 2015-04-08 16:24:53 -0400
@@ -2,4 +2,6 @@
#include <boost/cstdint.hpp>
+
+#include <cmath>
#include <SDL_keycode.h>
+++ rts/Sim/Weapons/TorpedoLauncher.cpp 2015-04-08 16:26:07 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "TorpedoLauncher.h"
#include "WeaponDef.h"
+++ rts/Game/Camera.cpp 2015-04-08 16:27:30 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
#include <string.h>
+++ rts/Game/InMapDraw.cpp 2015-04-08 16:44:34 -0400
@@ -1,6 +1,7 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
-#include "SDL_mouse.h"
-#include "SDL_keyboard.h"
+#include <cmath>
+#include <SDL_mouse.h>
+#include <SDL_keyboard.h>
#include "InMapDraw.h"
+++ rts/Game/PreGame.cpp 2015-04-08 16:45:50 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
#include <map>
#include <SDL_keycode.h>
+++ rts/Game/UI/MiniMap.cpp 2015-04-08 16:47:16 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
#include <SDL_keycode.h>
#include <SDL_mouse.h>
+++ rts/Rendering/GL/myGL.cpp 2015-04-08 16:51:02 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
#include <vector>
#include <string>
+++ rts/System/Input/Joystick.cpp 2015-04-08 16:54:28 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "InputHandler.h"
#include "Joystick.h"
+++ rts/System/SpringApp.cpp 2015-04-08 16:59:02 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "System/Input/InputHandler.h"
+++ rts/Sim/Projectiles/WeaponProjectiles/LargeBeamLaserProjectile.cpp 2015-04-07 20:42:45 -0400
@@ -10,4 +10,5 @@
#include "System/myMath.h"
#include <cstring> //memset
+#include <cmath> // floor
CR_BIND_DERIVED(CLargeBeamLaserProjectile, CWeaponProjectile, (ProjectileParams()))
--- rts/System/Sync/SyncedFloat3.h 2014-10-07 20:09:51 UTC
+++ rts/System/Sync/SyncedFloat3.h 2015-04-24 08:44:31 -0400
@@ -13,4 +13,6 @@
#include "System/FastMath.h" //SSE (I)SQRT
+#include <math.h>
+
/**
* @brief SyncedFloat3 class
@@ -614,7 +616,7 @@
void AssertNaNs() const {
- assert(!math::isnan(x) && !math::isinf(x));
- assert(!math::isnan(y) && !math::isinf(y));
- assert(!math::isnan(z) && !math::isinf(z));
+ assert(!isnanf(x) && !__isinff(x));
+ assert(!isnanf(y) && !__isinff(y));
+ assert(!isnanf(z) && !__isinff(z));
}
+++ rts/Sim/Path/IPathController.cpp 2015-04-08 18:59:04 -0400
@@ -1,3 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <math.h>
+
#include "IPathController.hpp"
#include "Sim/Units/Unit.h"
@@ -27,8 +29,8 @@
const float rawSpeedDiff = (targetSpeed * targetSpeedSign) - (currentSpeed * currentSpeedSign);
- const float absSpeedDiff = math::fabs(rawSpeedDiff);
+ const float absSpeedDiff = fabsf(rawSpeedDiff);
// need to clamp, game-supplied values can be much larger than |speedDiff|
- const float modAccRate = std::min(absSpeedDiff, maxAccRate);
- const float modDecRate = std::min(absSpeedDiff, maxDecRate);
+ const float modAccRate = fminf(absSpeedDiff, maxAccRate);
+ const float modDecRate = fminf(absSpeedDiff, maxDecRate);
const float deltaSpeed = mix(modAccRate, -modDecRate, (rawSpeedDiff < 0.0f));
@@ -66,6 +68,6 @@
static float TurnAccelerationSign(float turnBrakeDist, short curDeltaHeading, short newDeltaHeading) {
- const bool b0 = (turnBrakeDist >= std::abs(curDeltaHeading));
- const bool b1 = (std::abs(newDeltaHeading) <= std::abs(curDeltaHeading));
+ const bool b0 = (turnBrakeDist >= abs(curDeltaHeading));
+ const bool b1 = (abs(newDeltaHeading) <= abs(curDeltaHeading));
const bool b2 = (Sign(curDeltaHeading) != Sign(newDeltaHeading));
@@ -86,5 +88,5 @@
const short curDeltaHeading = newHeading - short(oldHeading + (*curTurnSpeed) * (maxTurnAccel / maxTurnSpeed));
- const float minTurnAccel = std::min(float(std::abs(curDeltaHeading)), maxTurnAccel);
+ const float minTurnAccel = fminf(float(abs(curDeltaHeading)), maxTurnAccel);
const float rawTurnAccel = Clamp(Sign(curDeltaHeading) * maxTurnAccel, -minTurnAccel, minTurnAccel);
const float newTurnSpeed = Clamp((*curTurnSpeed) + rawTurnAccel * (1 - owner->IsInAir()), -maxTurnSpeed, maxTurnSpeed);
+++ rts/Sim/Projectiles/Unsynced/BitmapMuzzleFlame.cpp 2015-04-08 20:20:52 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <math.h>
#include "BitmapMuzzleFlame.h"
@@ -61,5 +62,5 @@
const float ilength = length * (igrowth + 1.0f);
- const float3 udir = (std::fabs(dir.dot(UpVector)) >= 0.99f)? FwdVector: UpVector;
+ const float3 udir = (fabsf(dir.dot(UpVector)) >= 0.99f)? FwdVector: UpVector;
const float3 xdir = (dir.cross(udir)).SafeANormalize();
const float3 ydir = (dir.cross(xdir)).SafeANormalize();