From 11b2f58db7115686cfb825aef63c0e5462c4ee5a Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 5 Apr 2018 23:31:28 -0400 Subject: [PATCH] define M_PI in tpt-math.h --- src/Config.h | 3 --- src/common/tpt-math.h | 7 +++++++ src/graphics/Renderer.cpp | 1 + src/simulation/Element.h | 7 ++++--- src/simulation/Simulation.cpp | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Config.h b/src/Config.h index 4bcf287ca..1f0bccaee 100644 --- a/src/Config.h +++ b/src/Config.h @@ -97,9 +97,6 @@ //Number of unique thumbnails to have in cache at one time #define THUMB_CACHE_SIZE 256 -#ifndef M_PI -#define M_PI 3.14159265f -#endif #ifndef M_GRAV #define M_GRAV 6.67300e-1 #endif diff --git a/src/common/tpt-math.h b/src/common/tpt-math.h index c404f4316..88e185b96 100644 --- a/src/common/tpt-math.h +++ b/src/common/tpt-math.h @@ -1,6 +1,13 @@ #ifndef TPT_MATH_ #define TPT_MATH_ +#ifndef M_PI +#define M_PI 3.14159265f +#endif +#ifndef M_PI_2 +#define M_PI_2 1.57079633f +#endif + namespace tpt { float sin(float angle); diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index cc22710e9..a06e41fc7 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -7,6 +7,7 @@ #include "Misc.h" #include "Renderer.h" #include "Graphics.h" +#include "common/tpt-math.h" #include "common/tpt-minmax.h" #include "gui/game/RenderPreset.h" #include "simulation/Elements.h" diff --git a/src/simulation/Element.h b/src/simulation/Element.h index 3c28e2f9c..04707d55a 100644 --- a/src/simulation/Element.h +++ b/src/simulation/Element.h @@ -3,11 +3,12 @@ // This header should be included by all files in src/elements/ #include -#include "Simulation.h" -#include "graphics/Renderer.h" +#include "ElementGraphics.h" #include "Gravity.h" #include "Misc.h" -#include "ElementGraphics.h" +#include "Simulation.h" +#include "common/tpt-math.h" +#include "graphics/Renderer.h" #define IPL -257.0f #define IPH 257.0f diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index ad1800f1b..eef358544 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -19,6 +19,7 @@ #include "ToolClasses.h" #include "client/GameSave.h" #include "common/tpt-compat.h" +#include "common/tpt-math.h" #include "common/tpt-minmax.h" #include "gui/game/Brush.h"