Remove a few outdated windows-only preprocessor hacks

This commit is contained in:
Tamás Bálint Misius 2023-10-15 11:58:30 +02:00
parent 9605e0fcb9
commit 374209eebe
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
34 changed files with 25 additions and 104 deletions

View File

@ -321,7 +321,7 @@ else
endif endif
if host_platform == 'windows' if host_platform == 'windows'
args_ccomp_win = [ '-D_WIN32_WINNT=0x0501' ] args_ccomp_win = [ '-D_WIN32_WINNT=0x0501', '-DNOMINMAX' ]
windows_mod = import('windows') windows_mod = import('windows')
if is_static if is_static
args_ccomp_win += [ '-DCURL_STATICLIB' ] args_ccomp_win += [ '-DCURL_STATICLIB' ]

View File

@ -1,9 +1,9 @@
#include "Misc.h" #include "Misc.h"
#include "common/tpt-minmax.h"
#include "common/String.h" #include "common/String.h"
#include <cstring> #include <cstring>
#include <sys/types.h> #include <sys/types.h>
#include <cmath> #include <cmath>
#include <algorithm>
void HSV_to_RGB(int h,int s,int v,int *r,int *g,int *b)//convert 0-255(0-360 for H) HSV values to 0-255 RGB void HSV_to_RGB(int h,int s,int v,int *r,int *g,int *b)//convert 0-255(0-360 for H) HSV values to 0-255 RGB
{ {

View File

@ -19,7 +19,6 @@
*/ */
#pragma once #pragma once
#include "common/tpt-inline.h"
#include <ctime> #include <ctime>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
@ -1183,7 +1182,7 @@ bson_bool_t bson_check_string( bson *b, const char *string,
#define bson_big_endian32(out, in) ( bson_swap_endian32(out, in) ) #define bson_big_endian32(out, in) ( bson_swap_endian32(out, in) )
//#endif //#endif
static TPT_INLINE void bson_swap_endian64( void *outp, const void *inp ) { static inline void bson_swap_endian64( void *outp, const void *inp ) {
const char *in = ( const char * )inp; const char *in = ( const char * )inp;
char *out = ( char * )outp; char *out = ( char * )outp;
@ -1197,7 +1196,7 @@ static TPT_INLINE void bson_swap_endian64( void *outp, const void *inp ) {
out[7] = in[0]; out[7] = in[0];
} }
static TPT_INLINE void bson_swap_endian32( void *outp, const void *inp ) { static inline void bson_swap_endian32( void *outp, const void *inp ) {
const char *in = ( const char * )inp; const char *in = ( const char * )inp;
char *out = ( char * )outp; char *out = ( char * )outp;

View File

@ -3,7 +3,6 @@
#include "Format.h" #include "Format.h"
#include "simulation/Simulation.h" #include "simulation/Simulation.h"
#include "simulation/ElementClasses.h" #include "simulation/ElementClasses.h"
#include "common/tpt-minmax.h"
#include "common/tpt-compat.h" #include "common/tpt-compat.h"
#include "bson/BSON.h" #include "bson/BSON.h"
#include "graphics/Renderer.h" #include "graphics/Renderer.h"
@ -14,6 +13,7 @@
#include <memory> #include <memory>
#include <set> #include <set>
#include <cmath> #include <cmath>
#include <algorithm>
static void ConvertJsonToBson(bson *b, Json::Value j, int depth = 0); static void ConvertJsonToBson(bson *b, Json::Value j, int depth = 0);
static void ConvertBsonToJson(bson_iterator *b, Json::Value *j, int depth = 0); static void ConvertBsonToJson(bson_iterator *b, Json::Value *j, int depth = 0);

View File

@ -4,10 +4,6 @@
#include <memory> #include <memory>
#include <ctime> #include <ctime>
#ifdef GetUserName
# undef GetUserName // dammit windows
#endif
class GameSave; class GameSave;
class SaveInfo class SaveInfo

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "tpt-minmax.h" #include <algorithm>
#include <stdexcept> #include <stdexcept>
#include <sstream> #include <sstream>
#include <vector> #include <vector>

View File

@ -1,9 +1,6 @@
#include "Platform.h" #include "Platform.h"
#include "resource.h" #include "resource.h"
#include "Config.h" #include "Config.h"
#ifndef NOMINMAX
# define NOMINMAX
#endif
#include <iostream> #include <iostream>
#include <sys/stat.h> #include <sys/stat.h>
#include <io.h> #include <io.h>

View File

@ -29,9 +29,3 @@ constexpr double TPT_PI_DBL = double(M_PI);
constexpr float TPT_PI_FLT = 3.14159265f; constexpr float TPT_PI_FLT = 3.14159265f;
constexpr double TPT_PI_DBL = 3.14159265358979323846; constexpr double TPT_PI_DBL = 3.14159265358979323846;
#endif #endif
typedef unsigned short Uint16;
#ifndef NULL
# define NULL 0
#endif

View File

@ -1,21 +0,0 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#if defined(_MSC_VER)
# define TPT_INLINE _inline
#else
# define TPT_INLINE inline
#endif

View File

@ -1,27 +0,0 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <algorithm>
#ifdef _MSC_VER
# define NOMINMAX
# ifdef min
# undef min
# endif
# ifdef max
# undef max
# endif
#endif

View File

@ -4,7 +4,6 @@
#include <vector> #include <vector>
#include "common/Plane.h" #include "common/Plane.h"
#include "common/String.h" #include "common/String.h"
#include "common/tpt-inline.h"
#include "Icons.h" #include "Icons.h"
#include "Pixel.h" #include "Pixel.h"
#include "RasterDrawMethods.h" #include "RasterDrawMethods.h"

View File

@ -1,6 +1,6 @@
#include "BitmapBrush.h" #include "BitmapBrush.h"
#include "common/tpt-minmax.h"
#include "Misc.h" #include "Misc.h"
#include <algorithm>
#include <cmath> #include <cmath>
BitmapBrush::BitmapBrush(ui::Point inputSize, unsigned char const *inputBitmap) BitmapBrush::BitmapBrush(ui::Point inputSize, unsigned char const *inputBitmap)

View File

@ -65,10 +65,6 @@
#include <SDL.h> #include <SDL.h>
#include <iostream> #include <iostream>
#ifdef GetUserName
# undef GetUserName // dammit windows
#endif
GameController::GameController(): GameController::GameController():
firstTick(true), firstTick(true),
foundSignID(-1), foundSignID(-1),

View File

@ -40,10 +40,6 @@
#include <iostream> #include <iostream>
#include <SDL.h> #include <SDL.h>
#ifdef GetUserName
# undef GetUserName // dammit windows
#endif
class SplitButton : public ui::Button class SplitButton : public ui::Button
{ {
bool rightDown; bool rightDown;

View File

@ -1,7 +1,7 @@
#include "ContextMenu.h" #include "ContextMenu.h"
#include "graphics/Graphics.h" #include "graphics/Graphics.h"
#include "common/tpt-minmax.h"
#include "SimulationConfig.h" #include "SimulationConfig.h"
#include <algorithm>
using namespace ui; using namespace ui;

View File

@ -4,7 +4,7 @@
#include "gui/Style.h" #include "gui/Style.h"
#include "common/tpt-minmax.h" #include <algorithm>
using namespace ui; using namespace ui;

View File

@ -3,7 +3,7 @@
#include "graphics/Graphics.h" #include "graphics/Graphics.h"
#include "common/tpt-minmax.h" #include <algorithm>
using namespace ui; using namespace ui;

View File

@ -12,7 +12,7 @@
#include "Controller.h" #include "Controller.h"
#include "common/tpt-minmax.h" #include <algorithm>
LocalBrowserController::LocalBrowserController(std::function<void ()> onDone_): LocalBrowserController::LocalBrowserController(std::function<void ()> onDone_):
HasDone(false) HasDone(false)

View File

@ -32,10 +32,6 @@
#include "SimulationConfig.h" #include "SimulationConfig.h"
#include <SDL.h> #include <SDL.h>
#ifdef GetUserName
# undef GetUserName // dammit windows
#endif
PreviewView::PreviewView(std::unique_ptr<VideoBuffer> newSavePreview): PreviewView::PreviewView(std::unique_ptr<VideoBuffer> newSavePreview):
ui::Window(ui::Point(-1, -1), ui::Point((XRES/2)+210, (YRES/2)+150)), ui::Window(ui::Point(-1, -1), ui::Point((XRES/2)+210, (YRES/2)+150)),
submitCommentButton(NULL), submitCommentButton(NULL),

View File

@ -14,7 +14,6 @@
#include "client/http/SearchSavesRequest.h" #include "client/http/SearchSavesRequest.h"
#include "client/http/SearchTagsRequest.h" #include "client/http/SearchTagsRequest.h"
#include "common/platform/Platform.h" #include "common/platform/Platform.h"
#include "common/tpt-minmax.h"
#include "graphics/Graphics.h" #include "graphics/Graphics.h"
#include "tasks/Task.h" #include "tasks/Task.h"
#include "tasks/TaskWindow.h" #include "tasks/TaskWindow.h"
@ -23,6 +22,7 @@
#include "gui/preview/PreviewController.h" #include "gui/preview/PreviewController.h"
#include "gui/preview/PreviewView.h" #include "gui/preview/PreviewView.h"
#include "SimulationConfig.h" #include "SimulationConfig.h"
#include <algorithm>
SearchController::SearchController(std::function<void ()> onDone_): SearchController::SearchController(std::function<void ()> onDone_):
activePreview(NULL), activePreview(NULL),

View File

@ -6,7 +6,7 @@
#include "client/Client.h" #include "client/Client.h"
#include "client/http/SearchSavesRequest.h" #include "client/http/SearchSavesRequest.h"
#include "client/http/SearchTagsRequest.h" #include "client/http/SearchTagsRequest.h"
#include "common/tpt-minmax.h" #include <algorithm>
#include <thread> #include <thread>
#include <cmath> #include <cmath>

View File

@ -14,10 +14,6 @@
#include "SimulationConfig.h" #include "SimulationConfig.h"
#include <SDL.h> #include <SDL.h>
#ifdef GetUserName
# undef GetUserName // dammit windows
#endif
SearchView::SearchView(): SearchView::SearchView():
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)), ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)),
c(NULL), c(NULL),

View File

@ -23,7 +23,7 @@
static inline int resampler_range_check(int v, int h) { (void)h; resampler_assert((v >= 0) && (v < h)); return v; } static inline int resampler_range_check(int v, int h) { (void)h; resampler_assert((v >= 0) && (v < h)); return v; }
#include "common/tpt-minmax.h" #include <algorithm>
#ifndef TRUE #ifndef TRUE
#define TRUE (1) #define TRUE (1)

View File

@ -3,13 +3,13 @@
#include "Misc.h" #include "Misc.h"
#include "common/tpt-rand.h" #include "common/tpt-rand.h"
#include "common/tpt-compat.h" #include "common/tpt-compat.h"
#include "common/tpt-minmax.h"
#include "ElementDefs.h" #include "ElementDefs.h"
#include "ElementClasses.h" #include "ElementClasses.h"
#include "Particle.h" #include "Particle.h"
#include "ElementGraphics.h" #include "ElementGraphics.h"
#include "Simulation.h" #include "Simulation.h"
#include "graphics/Renderer.h" #include "graphics/Renderer.h"
#include <algorithm>
#include <cmath> #include <cmath>
constexpr float IPL = MIN_PRESSURE - 1; constexpr float IPL = MIN_PRESSURE - 1;

View File

@ -1,5 +1,5 @@
#include "SnapshotDelta.h" #include "SnapshotDelta.h"
#include "common/tpt-minmax.h" #include <algorithm>
#include <utility> #include <utility>
// * A SnapshotDelta is a bidirectional difference type between Snapshots, defined such // * A SnapshotDelta is a bidirectional difference type between Snapshots, defined such

View File

@ -1,5 +1,5 @@
#include "simulation/ElementCommon.h" #include "simulation/ElementCommon.h"
#include "common/tpt-minmax.h" #include <algorithm>
static int update(UPDATE_FUNC_ARGS); static int update(UPDATE_FUNC_ARGS);
static int graphics(GRAPHICS_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS);

View File

@ -1,5 +1,5 @@
#include "common/tpt-minmax.h"
#include "simulation/ElementCommon.h" #include "simulation/ElementCommon.h"
#include <algorithm>
int Element_FIRE_update(UPDATE_FUNC_ARGS); int Element_FIRE_update(UPDATE_FUNC_ARGS);
static int updateLegacy(UPDATE_FUNC_ARGS); static int updateLegacy(UPDATE_FUNC_ARGS);

View File

@ -1,5 +1,5 @@
#include "common/tpt-minmax.h"
#include "simulation/ElementCommon.h" #include "simulation/ElementCommon.h"
#include <algorithm>
static int update(UPDATE_FUNC_ARGS); static int update(UPDATE_FUNC_ARGS);

View File

@ -1,5 +1,5 @@
#include "common/tpt-minmax.h"
#include "simulation/ElementCommon.h" #include "simulation/ElementCommon.h"
#include <algorithm>
static int update(UPDATE_FUNC_ARGS); static int update(UPDATE_FUNC_ARGS);
static int graphics(GRAPHICS_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS);

View File

@ -1,5 +1,5 @@
#include "common/tpt-minmax.h"
#include "simulation/ElementCommon.h" #include "simulation/ElementCommon.h"
#include <algorithm>
static int update(UPDATE_FUNC_ARGS); static int update(UPDATE_FUNC_ARGS);
static int graphics(GRAPHICS_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS);

View File

@ -1,5 +1,5 @@
#include "common/tpt-minmax.h"
#include "simulation/ElementCommon.h" #include "simulation/ElementCommon.h"
#include <algorithm>
struct StackData; struct StackData;
static int update(UPDATE_FUNC_ARGS); static int update(UPDATE_FUNC_ARGS);

View File

@ -1,5 +1,5 @@
#include "common/tpt-minmax.h"
#include "simulation/ElementCommon.h" #include "simulation/ElementCommon.h"
#include <algorithm>
static int update(UPDATE_FUNC_ARGS); static int update(UPDATE_FUNC_ARGS);
static int graphics(GRAPHICS_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS);

View File

@ -1,5 +1,5 @@
#include "common/tpt-minmax.h"
#include "simulation/ElementCommon.h" #include "simulation/ElementCommon.h"
#include <algorithm>
static int update(UPDATE_FUNC_ARGS); static int update(UPDATE_FUNC_ARGS);
static int graphics(GRAPHICS_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS);

View File

@ -9,7 +9,7 @@
#include "graphics/Graphics.h" #include "graphics/Graphics.h"
#include "common/tpt-minmax.h" #include <algorithm>
TaskWindow::TaskWindow(String title_, Task * task_, bool closeOnDone): TaskWindow::TaskWindow(String title_, Task * task_, bool closeOnDone):
ui::Window(ui::Point(-1, -1), ui::Point(240, 60)), ui::Window(ui::Point(-1, -1), ui::Point(240, 60)),