From eadbd04f8157561dd67c184494a730e2dd90867e Mon Sep 17 00:00:00 2001 From: Miguel Horta Date: Sun, 7 Apr 2024 13:51:20 +0100 Subject: [PATCH] fix: Name clash between jni.h and error_func.h Openttd newly included file error_func.h defines two new macros named FatalError() and UserError(). FatalError() unfortunatly colides with a method declared in jni.h jni.h makes its way into Openttd code by being present at SDL_android.h; Since knownledge of jni.h is not needed for Openttd code the adopted solution was to remove jni.h from SDL_android.h and forward declare any of its usages. Akin to pimpl pattern. --- project/jni/sdl-1.2/include/SDL_android.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/project/jni/sdl-1.2/include/SDL_android.h b/project/jni/sdl-1.2/include/SDL_android.h index d22494b6e..360d73b04 100644 --- a/project/jni/sdl-1.2/include/SDL_android.h +++ b/project/jni/sdl-1.2/include/SDL_android.h @@ -26,9 +26,16 @@ #include "SDL_video.h" #include "SDL_screenkeyboard.h" #include "SDL_audio.h" -#include #include "begin_code.h" + +#if defined(__cplusplus) +struct JavaVM; +#else +struct JNIInvokeInterface; +typedef const struct JNIInvokeInterface* JavaVM; +#endif + /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { @@ -148,7 +155,7 @@ extern DECLSPEC void SDLCALL SDL_ANDROID_SetMouseEmulationMode( int forceHardwareMouse, int showScreenUnderFinger, int fingerHover, int fingerHoverJitterFilter, int generateSubframeTouchEvents ); - + extern DECLSPEC int SDLCALL SDL_ANDROID_GetMouseEmulationMode(); /* Control the System mouse pointer visibility */