Skip to content

Commit 232f606

Browse files
committed
refactor: common definition
1 parent 1c072f0 commit 232f606

File tree

10 files changed

+8
-39
lines changed

10 files changed

+8
-39
lines changed

src/Features/ConfigPlus.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "Modules/Engine.hpp"
66
#include "Modules/FileSystem.hpp"
77
#include "Modules/Server.hpp"
8+
#include "Utils.hpp"
89

910
#include <cstdlib>
1011
#include <cstring>
@@ -15,12 +16,6 @@
1516
#include <unordered_set>
1617
#include <fstream>
1718

18-
// Fuck you Windows
19-
#ifdef _WIN32
20-
# define strdup _strdup
21-
# define strcasecmp _stricmp
22-
#endif
23-
2419
#define PERSISTENT_SVAR_FILENAME "svars_persist"
2520
#define CFG_MESSAGE_TYPE "cfgmessage"
2621

src/Features/Hud/Hud.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
#include <map>
2222
#include <optional>
2323

24-
#ifdef _WIN32
25-
# define strcasecmp _stricmp
26-
#endif
27-
2824
Variable sar_hud_spacing("sar_hud_spacing", "1", 0, "Spacing between elements of HUD.\n", FCVAR_DONTRECORD);
2925
Variable sar_hud_x("sar_hud_x", "2", 0, "X padding of HUD.\n", FCVAR_DONTRECORD);
3026
Variable sar_hud_y("sar_hud_y", "2", 0, "Y padding of HUD.\n", FCVAR_DONTRECORD);

src/Features/Speedrun/Categories.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
#include <optional>
1717
#include <variant>
1818

19-
#ifdef _WIN32
20-
# define strcasecmp _stricmp
21-
#endif
22-
2319
Variable sar_speedrun_draw_triggers("sar_speedrun_draw_triggers", "0", "Draw the triggers associated with speedrun rules in the world.\n");
2420
Variable sar_speedrun_triggers_info("sar_speedrun_triggers_info", "0", "Print player velocity (and position) upon mtrigger activation.\n1 - position and velocity\n2 - only horizontal velocity\n");
2521

src/Features/Speedrun/Rules.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@
1010
#include "Modules/Scheme.hpp"
1111
#include "Modules/Server.hpp"
1212
#include "Modules/Surface.hpp"
13-
14-
#define TAU 6.28318530718
15-
16-
#ifdef _WIN32
17-
# define strcasecmp _stricmp
18-
#endif
13+
#include "Utils/Math.hpp"
1914

2015
template <typename V>
2116
static inline V *lookupMap(std::map<std::string, V> &m, std::string k) {

src/Features/WindowResizer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
#include "Utils.hpp"
66
#include "Modules/Engine.hpp"
77

8-
#ifdef _WIN32
9-
#include <windows.h>
10-
#endif
118

129
Variable sar_allow_resizing_window("sar_allow_resizing_window", "0", 0, 1, "EXPERIMENTAL! Forces resizing on game's window.\n");
1310

src/Modules/Engine.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,6 @@
3232
#include <cstring>
3333
#include <cmath>
3434

35-
#ifdef _WIN32
36-
// clang-format off
37-
# include <Windows.h>
38-
# include <Memoryapi.h>
39-
# define strcasecmp _stricmp
40-
// clang-format on
41-
#else
42-
# include <sys/mman.h>
43-
#endif
44-
4535
#define FPS_CHECK_WINDOW 0.5f
4636

4737
Variable host_timescale;

src/Modules/Server.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@
4949
#include <cstring>
5050
#include <cfloat>
5151

52-
#ifdef _WIN32
53-
# define strcasecmp _stricmp
54-
#endif
55-
5652
#define RESET_COOP_PROGRESS_MESSAGE_TYPE "coop-reset"
5753
#define CM_FLAGS_MESSAGE_TYPE "cm-flags"
5854

src/Utils.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#ifdef _WIN32
1010
// clang-format off
11-
# include <Windows.h>
1211
# include <ImageHlp.h>
1312
// clang-format on
1413
#else

src/Utils.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
#include "Utils/SDK.hpp"
66
#include <optional>
77

8-
#ifndef _WIN32
8+
#ifdef _WIN32
9+
# include <Windows.h>
10+
# define strdup _strdup
11+
# define strcasecmp _stricmp
12+
#else
913
# include <unistd.h>
1014
#endif
1115

src/Utils/Math.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define M_PI 3.14159265358979323846
77
#define M_PI_F ((float)(M_PI))
88
#define M_PI_2 1.57079632679489661923 // pi/2
9+
#define TAU 6.28318530717958647692
910
#define RAD2DEG(x) ((float)(x) * (float)(180.f / M_PI_F))
1011
#define DEG2RAD(x) ((float)(x) * (float)(M_PI_F / 180.f))
1112

0 commit comments

Comments
 (0)