diff --git a/meson.build b/meson.build index a3b96320f..7d78d3237 100644 --- a/meson.build +++ b/meson.build @@ -321,7 +321,7 @@ else endif if host_platform == 'windows' - args_ccomp_win = [ '-D_WIN32_WINNT=0x0501' ] + args_ccomp_win = [ '-D_WIN32_WINNT=0x0501', '-DNOMINMAX' ] windows_mod = import('windows') if is_static args_ccomp_win += [ '-DCURL_STATICLIB' ] diff --git a/src/Misc.cpp b/src/Misc.cpp index 668f94bbc..646c4557b 100644 --- a/src/Misc.cpp +++ b/src/Misc.cpp @@ -1,9 +1,9 @@ #include "Misc.h" -#include "common/tpt-minmax.h" #include "common/String.h" #include #include #include +#include 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 { diff --git a/src/bson/BSON.h b/src/bson/BSON.h index bb03cf7d2..9ffd4f58e 100644 --- a/src/bson/BSON.h +++ b/src/bson/BSON.h @@ -19,7 +19,6 @@ */ #pragma once -#include "common/tpt-inline.h" #include #include #include @@ -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) ) //#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; char *out = ( char * )outp; @@ -1197,7 +1196,7 @@ static TPT_INLINE void bson_swap_endian64( void *outp, const void *inp ) { 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; char *out = ( char * )outp; diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 1ef394ff8..00b8066be 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -3,7 +3,6 @@ #include "Format.h" #include "simulation/Simulation.h" #include "simulation/ElementClasses.h" -#include "common/tpt-minmax.h" #include "common/tpt-compat.h" #include "bson/BSON.h" #include "graphics/Renderer.h" @@ -14,6 +13,7 @@ #include #include #include +#include static void ConvertJsonToBson(bson *b, Json::Value j, int depth = 0); static void ConvertBsonToJson(bson_iterator *b, Json::Value *j, int depth = 0); diff --git a/src/client/SaveInfo.h b/src/client/SaveInfo.h index a5fc96e2d..08b59e83f 100644 --- a/src/client/SaveInfo.h +++ b/src/client/SaveInfo.h @@ -4,10 +4,6 @@ #include #include -#ifdef GetUserName -# undef GetUserName // dammit windows -#endif - class GameSave; class SaveInfo diff --git a/src/common/String.h b/src/common/String.h index 9cbea581b..b6ccc94b3 100644 --- a/src/common/String.h +++ b/src/common/String.h @@ -1,5 +1,5 @@ #pragma once -#include "tpt-minmax.h" +#include #include #include #include diff --git a/src/common/platform/Windows.cpp b/src/common/platform/Windows.cpp index 983c5ba2b..4b126f261 100644 --- a/src/common/platform/Windows.cpp +++ b/src/common/platform/Windows.cpp @@ -1,9 +1,6 @@ #include "Platform.h" #include "resource.h" #include "Config.h" -#ifndef NOMINMAX -# define NOMINMAX -#endif #include #include #include diff --git a/src/common/tpt-compat.h b/src/common/tpt-compat.h index 52356c231..8812fe173 100644 --- a/src/common/tpt-compat.h +++ b/src/common/tpt-compat.h @@ -29,9 +29,3 @@ constexpr double TPT_PI_DBL = double(M_PI); constexpr float TPT_PI_FLT = 3.14159265f; constexpr double TPT_PI_DBL = 3.14159265358979323846; #endif - -typedef unsigned short Uint16; - -#ifndef NULL -# define NULL 0 -#endif diff --git a/src/common/tpt-inline.h b/src/common/tpt-inline.h deleted file mode 100644 index 6f0996e5c..000000000 --- a/src/common/tpt-inline.h +++ /dev/null @@ -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 . - */ - -#pragma once -#if defined(_MSC_VER) -# define TPT_INLINE _inline -#else -# define TPT_INLINE inline -#endif diff --git a/src/common/tpt-minmax.h b/src/common/tpt-minmax.h deleted file mode 100644 index a19a1d66a..000000000 --- a/src/common/tpt-minmax.h +++ /dev/null @@ -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 . - */ - -#pragma once -#include - -#ifdef _MSC_VER -# define NOMINMAX -# ifdef min -# undef min -# endif -# ifdef max -# undef max -# endif -#endif diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h index da83f028d..00eeb21cc 100644 --- a/src/graphics/Graphics.h +++ b/src/graphics/Graphics.h @@ -4,7 +4,6 @@ #include #include "common/Plane.h" #include "common/String.h" -#include "common/tpt-inline.h" #include "Icons.h" #include "Pixel.h" #include "RasterDrawMethods.h" diff --git a/src/gui/game/BitmapBrush.cpp b/src/gui/game/BitmapBrush.cpp index e90bf72cf..87f3cee42 100644 --- a/src/gui/game/BitmapBrush.cpp +++ b/src/gui/game/BitmapBrush.cpp @@ -1,6 +1,6 @@ #include "BitmapBrush.h" -#include "common/tpt-minmax.h" #include "Misc.h" +#include #include BitmapBrush::BitmapBrush(ui::Point inputSize, unsigned char const *inputBitmap) diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index 283f99567..a04b3c844 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -65,10 +65,6 @@ #include #include -#ifdef GetUserName -# undef GetUserName // dammit windows -#endif - GameController::GameController(): firstTick(true), foundSignID(-1), diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 8597c5397..abfc52bef 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -40,10 +40,6 @@ #include #include -#ifdef GetUserName -# undef GetUserName // dammit windows -#endif - class SplitButton : public ui::Button { bool rightDown; diff --git a/src/gui/interface/ContextMenu.cpp b/src/gui/interface/ContextMenu.cpp index a1206cb34..aee65c9da 100644 --- a/src/gui/interface/ContextMenu.cpp +++ b/src/gui/interface/ContextMenu.cpp @@ -1,7 +1,7 @@ #include "ContextMenu.h" #include "graphics/Graphics.h" -#include "common/tpt-minmax.h" #include "SimulationConfig.h" +#include using namespace ui; diff --git a/src/gui/interface/ProgressBar.cpp b/src/gui/interface/ProgressBar.cpp index c5807fc0f..e9c1b1052 100644 --- a/src/gui/interface/ProgressBar.cpp +++ b/src/gui/interface/ProgressBar.cpp @@ -4,7 +4,7 @@ #include "gui/Style.h" -#include "common/tpt-minmax.h" +#include using namespace ui; diff --git a/src/gui/interface/ScrollPanel.cpp b/src/gui/interface/ScrollPanel.cpp index 9814d44a8..87c2336b2 100644 --- a/src/gui/interface/ScrollPanel.cpp +++ b/src/gui/interface/ScrollPanel.cpp @@ -3,7 +3,7 @@ #include "graphics/Graphics.h" -#include "common/tpt-minmax.h" +#include using namespace ui; diff --git a/src/gui/localbrowser/LocalBrowserController.cpp b/src/gui/localbrowser/LocalBrowserController.cpp index 5d37be858..6fd87ce47 100644 --- a/src/gui/localbrowser/LocalBrowserController.cpp +++ b/src/gui/localbrowser/LocalBrowserController.cpp @@ -12,7 +12,7 @@ #include "Controller.h" -#include "common/tpt-minmax.h" +#include LocalBrowserController::LocalBrowserController(std::function onDone_): HasDone(false) diff --git a/src/gui/preview/PreviewView.cpp b/src/gui/preview/PreviewView.cpp index e9b3a1287..5909571ff 100644 --- a/src/gui/preview/PreviewView.cpp +++ b/src/gui/preview/PreviewView.cpp @@ -32,10 +32,6 @@ #include "SimulationConfig.h" #include -#ifdef GetUserName -# undef GetUserName // dammit windows -#endif - PreviewView::PreviewView(std::unique_ptr newSavePreview): ui::Window(ui::Point(-1, -1), ui::Point((XRES/2)+210, (YRES/2)+150)), submitCommentButton(NULL), diff --git a/src/gui/search/SearchController.cpp b/src/gui/search/SearchController.cpp index 9b742f155..1a309715b 100644 --- a/src/gui/search/SearchController.cpp +++ b/src/gui/search/SearchController.cpp @@ -14,7 +14,6 @@ #include "client/http/SearchSavesRequest.h" #include "client/http/SearchTagsRequest.h" #include "common/platform/Platform.h" -#include "common/tpt-minmax.h" #include "graphics/Graphics.h" #include "tasks/Task.h" #include "tasks/TaskWindow.h" @@ -23,6 +22,7 @@ #include "gui/preview/PreviewController.h" #include "gui/preview/PreviewView.h" #include "SimulationConfig.h" +#include SearchController::SearchController(std::function onDone_): activePreview(NULL), diff --git a/src/gui/search/SearchModel.cpp b/src/gui/search/SearchModel.cpp index 1b03ea377..949b2e421 100644 --- a/src/gui/search/SearchModel.cpp +++ b/src/gui/search/SearchModel.cpp @@ -6,7 +6,7 @@ #include "client/Client.h" #include "client/http/SearchSavesRequest.h" #include "client/http/SearchTagsRequest.h" -#include "common/tpt-minmax.h" +#include #include #include diff --git a/src/gui/search/SearchView.cpp b/src/gui/search/SearchView.cpp index 6f1ede05a..6d72097a0 100644 --- a/src/gui/search/SearchView.cpp +++ b/src/gui/search/SearchView.cpp @@ -14,10 +14,6 @@ #include "SimulationConfig.h" #include -#ifdef GetUserName -# undef GetUserName // dammit windows -#endif - SearchView::SearchView(): ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)), c(NULL), diff --git a/src/resampler/resampler.cpp b/src/resampler/resampler.cpp index 2aedb10c3..af2517fba 100644 --- a/src/resampler/resampler.cpp +++ b/src/resampler/resampler.cpp @@ -23,7 +23,7 @@ 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 #ifndef TRUE #define TRUE (1) diff --git a/src/simulation/ElementCommon.h b/src/simulation/ElementCommon.h index 28bc54963..3f6f90c74 100644 --- a/src/simulation/ElementCommon.h +++ b/src/simulation/ElementCommon.h @@ -3,13 +3,13 @@ #include "Misc.h" #include "common/tpt-rand.h" #include "common/tpt-compat.h" -#include "common/tpt-minmax.h" #include "ElementDefs.h" #include "ElementClasses.h" #include "Particle.h" #include "ElementGraphics.h" #include "Simulation.h" #include "graphics/Renderer.h" +#include #include constexpr float IPL = MIN_PRESSURE - 1; diff --git a/src/simulation/SnapshotDelta.cpp b/src/simulation/SnapshotDelta.cpp index b1e33c562..92fdb83c1 100644 --- a/src/simulation/SnapshotDelta.cpp +++ b/src/simulation/SnapshotDelta.cpp @@ -1,5 +1,5 @@ #include "SnapshotDelta.h" -#include "common/tpt-minmax.h" +#include #include // * A SnapshotDelta is a bidirectional difference type between Snapshots, defined such diff --git a/src/simulation/elements/DEUT.cpp b/src/simulation/elements/DEUT.cpp index 83c639328..ece1645f1 100644 --- a/src/simulation/elements/DEUT.cpp +++ b/src/simulation/elements/DEUT.cpp @@ -1,5 +1,5 @@ #include "simulation/ElementCommon.h" -#include "common/tpt-minmax.h" +#include static int update(UPDATE_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS); diff --git a/src/simulation/elements/FIRE.cpp b/src/simulation/elements/FIRE.cpp index 658e3aada..69d2b3fd2 100644 --- a/src/simulation/elements/FIRE.cpp +++ b/src/simulation/elements/FIRE.cpp @@ -1,5 +1,5 @@ -#include "common/tpt-minmax.h" #include "simulation/ElementCommon.h" +#include int Element_FIRE_update(UPDATE_FUNC_ARGS); static int updateLegacy(UPDATE_FUNC_ARGS); diff --git a/src/simulation/elements/FWRK.cpp b/src/simulation/elements/FWRK.cpp index 6a444b666..4a6f5ef69 100644 --- a/src/simulation/elements/FWRK.cpp +++ b/src/simulation/elements/FWRK.cpp @@ -1,5 +1,5 @@ -#include "common/tpt-minmax.h" #include "simulation/ElementCommon.h" +#include static int update(UPDATE_FUNC_ARGS); diff --git a/src/simulation/elements/GRAV.cpp b/src/simulation/elements/GRAV.cpp index 08e1ee79c..cd818851d 100644 --- a/src/simulation/elements/GRAV.cpp +++ b/src/simulation/elements/GRAV.cpp @@ -1,5 +1,5 @@ -#include "common/tpt-minmax.h" #include "simulation/ElementCommon.h" +#include static int update(UPDATE_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS); diff --git a/src/simulation/elements/PLNT.cpp b/src/simulation/elements/PLNT.cpp index f5f92cc62..f05d73935 100644 --- a/src/simulation/elements/PLNT.cpp +++ b/src/simulation/elements/PLNT.cpp @@ -1,5 +1,5 @@ -#include "common/tpt-minmax.h" #include "simulation/ElementCommon.h" +#include static int update(UPDATE_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS); diff --git a/src/simulation/elements/PSTN.cpp b/src/simulation/elements/PSTN.cpp index 63efb4811..7cc49d307 100644 --- a/src/simulation/elements/PSTN.cpp +++ b/src/simulation/elements/PSTN.cpp @@ -1,5 +1,5 @@ -#include "common/tpt-minmax.h" #include "simulation/ElementCommon.h" +#include struct StackData; static int update(UPDATE_FUNC_ARGS); diff --git a/src/simulation/elements/VINE.cpp b/src/simulation/elements/VINE.cpp index 857ecc8d8..41918733c 100644 --- a/src/simulation/elements/VINE.cpp +++ b/src/simulation/elements/VINE.cpp @@ -1,5 +1,5 @@ -#include "common/tpt-minmax.h" #include "simulation/ElementCommon.h" +#include static int update(UPDATE_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS); diff --git a/src/simulation/elements/WOOD.cpp b/src/simulation/elements/WOOD.cpp index 45f8231cc..e0b92da73 100644 --- a/src/simulation/elements/WOOD.cpp +++ b/src/simulation/elements/WOOD.cpp @@ -1,5 +1,5 @@ -#include "common/tpt-minmax.h" #include "simulation/ElementCommon.h" +#include static int update(UPDATE_FUNC_ARGS); static int graphics(GRAPHICS_FUNC_ARGS); diff --git a/src/tasks/TaskWindow.cpp b/src/tasks/TaskWindow.cpp index 448cf309d..a5ef3eb96 100644 --- a/src/tasks/TaskWindow.cpp +++ b/src/tasks/TaskWindow.cpp @@ -9,7 +9,7 @@ #include "graphics/Graphics.h" -#include "common/tpt-minmax.h" +#include TaskWindow::TaskWindow(String title_, Task * task_, bool closeOnDone): ui::Window(ui::Point(-1, -1), ui::Point(240, 60)),