Merge pull request #408 from GravisZro/remove/unusedpredefs

Code cleanup: Add one macro, remove five others
This commit is contained in:
Louis Gombert 2024-06-01 20:51:41 +00:00 committed by GitHub
commit 6d3a4c3e7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 19 additions and 32 deletions

View File

@ -95,15 +95,15 @@ endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message("Building for Linux")
add_compile_definitions(__LINUX__ LINUX _MAX_PATH=260 _MAX_FNAME=256 _REENRANT __32BIT__ HAVEALLOCA_H _USE_OGL_ACTIVE_TEXTURES)
add_compile_definitions(__LINUX__ _USE_OGL_ACTIVE_TEXTURES PRIMARY_HOG=\"d3-linux.hog\")
set(PLATFORM_INCLUDES "lib/linux" ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
message("Building for MAC OSX")
add_compile_definitions(__LINUX__ LINUX _MAX_PATH=260 _MAX_FNAME=256 _REENRANT MACOSX=1 _USE_OGL_ACTIVE_TEXTURES)
add_compile_definitions(__LINUX__ MACOSX=1 _USE_OGL_ACTIVE_TEXTURES PRIMARY_HOG=\"d3-osx.hog\")
set(PLATFORM_INCLUDES "lib/linux" ${SDL2_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Windows.h defines to avoid as many issues as possible.
add_compile_definitions(WIN32_LEAN_AND_MEAN NOMINMAX NODRAWTEXT NOBITMAP NOMCX NOSERVICE NOHELP
add_compile_definitions(WIN32_LEAN_AND_MEAN NOMINMAX NODRAWTEXT NOBITMAP NOMCX NOSERVICE NOHELP PRIMARY_HOG=\"d3-win.hog\"
#[[NOGDI]] # We need GDI for now, enable when GDI is actually not needed (or when all windows.h mentions are gone)
)

View File

@ -58,7 +58,7 @@
#include "newui.h"
#if defined(LINUX)
#if defined(__LINUX__)
void CIListBoxCallback(int ID, void *);
void CISliderCallback(int ID, void *);
#endif

View File

@ -881,7 +881,7 @@ void ListenDedicatedSocket(void) {
shutdown(incoming_socket, 2);
#if defined(WIN32)
closesocket(incoming_socket);
#elif defined(__LINUX__)
#else
close(incoming_socket);
#endif
return;
@ -942,7 +942,7 @@ dedicated_socket *DedicatedLogoutTelnet(dedicated_socket *conn) {
shutdown(conn->sock, 2);
#if defined(WIN32)
closesocket(conn->sock);
#elif defined(__LINUX__)
#else
close(conn->sock);
#endif
@ -1030,7 +1030,7 @@ void DedicatedReadTelnet(void) {
shutdown(conn->sock, 2);
#if defined(WIN32)
closesocket(conn->sock);
#elif defined(__LINUX__)
#else
close(conn->sock);
#endif
}

View File

@ -781,15 +781,12 @@ const char *GetCDVolume(int cd_num) {
char message_txt[50];
snprintf(message_txt, sizeof(message_txt), TXT_CDPROMPT, cd_num);
// We need a background drawn!
#if defined(LINUX)
void (*ui_cb)() = GetUICallback();
#else
void *ui_cb = GetUICallback();
#endif
if (ui_cb == NULL)
SetUICallback(RenderBlankScreen);
int res = DoMessageBox(PRODUCT_NAME, message_txt, MSGBOX_OKCANCEL, UICOL_WINDOW_TITLE, UICOL_TEXT_NORMAL);
SetUICallback((void (*)(void))ui_cb);
SetUICallback(ui_cb);
//
if (res == 0) {
return NULL;

View File

@ -510,7 +510,7 @@ struct tLoadGameDialogData {
chunked_bitmap chunk;
};
#if defined(LINUX)
#if defined(__LINUX__)
void LoadGameDialogCB(newuiTiledWindow *wnd, void *data)
#else
void __cdecl LoadGameDialogCB(newuiTiledWindow *wnd, void *data)

View File

@ -1531,15 +1531,7 @@ void InitIOSystems(bool editor) {
// last library opened is the first to be searched for dynamic libs, so put
// this one at the end to find our newly build script libraries first
#ifdef __LINUX__
#ifndef MACOSX
ddio_MakePath(fullname, LocalD3Dir, "d3-linux.hog", NULL);
#else
ddio_MakePath(fullname, LocalD3Dir, "d3-osx.hog", NULL);
#endif
#elif _WIN32
ddio_MakePath(fullname, LocalD3Dir, "d3-win.hog", NULL);
#endif
ddio_MakePath(fullname, LocalD3Dir, PRIMARY_HOG, NULL);
sys_hid = cf_OpenLibrary(fullname);
// Check to see if there is a -mission command line option

View File

@ -1904,7 +1904,7 @@ void InitMatcens() {
atexit(DestroyAllMatcens);
}
#if defined(LINUX)
#if defined(__LINUX__)
void DestroyAllMatcens()
#else
void __cdecl DestroyAllMatcens()

View File

@ -121,10 +121,7 @@
#include "osiris_dll.h"
#include "levelgoal.h"
#ifdef LINUX
#include <stdlib.h>
#endif
#include <string.h>
// The maximum number of triggers that can be in the mine

View File

@ -86,8 +86,7 @@
#define FF_DEGREES DI_DEGREES
#define FF_NOMINALMAX DI_FFNOMINALMAX
#define FF_SECONDS DI_SECONDS
#elif defined(__LINUX__)
// LINUX
#else
#define FF_DEGREES 360 // fake value
#define FF_NOMINALMAX 10000 // fake value
#define FF_SECONDS 1000 // fake value

View File

@ -232,7 +232,7 @@ static inline void SetDebugBreakHandlers(void (*stop)(), void (*resume)()) {
if (_heapchk() != _HEAPOK) \
Int3(); \
} while (0)
#elif defined(LINUX)
#elif defined(__LINUX__)
#include "SDL.h"
// For some reason Linux doesn't like the \ continuation character, so I have to uglify this
#define DEBUG_BREAK() \

View File

@ -22,6 +22,10 @@
#include <cstdlib>
#include <cstdint>
#ifdef __LINUX__
#include "linux_fix.h"
#endif
// define unsigned types;
typedef uint8_t uint8_t;
typedef int8_t int8_t;

View File

@ -188,7 +188,7 @@
*
* $NoKeywords: $
*/
#ifndef LINUX
#ifndef __LINUX__
#include <new.h>
#endif
#if defined(MACOSX)

View File

@ -49,9 +49,7 @@
*
*/
#ifdef LINUX
#include <cstring>
#endif
#include "hlsoundlib.h"
#include "ddsndgeometry.h"