diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-28 14:29:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-28 14:29:38 +0300 |
commit | 4010ff9dac72bb5d7c076610131f50390d193669 (patch) | |
tree | d46bcbc0b9d352681304e3f91510ed760041daf8 | |
parent | b72b28c3b9dc3ecb1aa0c95e70967d931d246d39 (diff) | |
download | manaplus-4010ff9dac72bb5d7c076610131f50390d193669.tar.gz manaplus-4010ff9dac72bb5d7c076610131f50390d193669.tar.bz2 manaplus-4010ff9dac72bb5d7c076610131f50390d193669.tar.xz manaplus-4010ff9dac72bb5d7c076610131f50390d193669.zip |
fix compilation with very old SDL.
-rw-r--r-- | src/main.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 03be62543..193610156 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -50,6 +50,21 @@ #include <SDL_image.h> #include <SDL_mixer.h> +#include <SDL_version.h> + +#define SDL_IMAGE_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, \ + SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL) + +#define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \ + (SDL_IMAGE_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +#define SDL_MIXER_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, \ + SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL) + +#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \ + (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) #include "debug.h" @@ -295,8 +310,12 @@ int main(int argc, char *argv[]) atexit((void(*)()) PHYSFS_deinit); XML::initXML(); +#if SDL_IMAGE_VERSION_ATLEAST(1, 2, 11) IMG_Init(IMG_INIT_PNG); +#endif +#if SDL_MIXER_VERSION_ATLEAST(1, 2, 11) Mix_Init(MIX_INIT_OGG); +#endif #ifdef WIN32 SetCurrentDirectory(PhysFs::getBaseDir()); @@ -317,8 +336,12 @@ int main(int argc, char *argv[]) delete client; client = nullptr; +#if SDL_MIXER_VERSION_ATLEAST(1, 2, 11) Mix_Quit(); +#endif +#if SDL_IMAGE_VERSION_ATLEAST(1, 2, 11) IMG_Quit(); +#endif #ifdef DUMP_LEAKED_RESOURCES reportRWops(); |