summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-09-09 09:13:18 +0000
committerrubidium <rubidium@openttd.org>2011-09-09 09:13:18 +0000
commitbffa93a4e9b760bae394d0f2b96e38909ea2cd76 (patch)
tree89e8843fa6a3880203890bd6fb9e33c0464e6d6a /src
parentfb24ab71d02169b3b272663582788923c3dee670 (diff)
downloadopenttd-bffa93a4e9b760bae394d0f2b96e38909ea2cd76.tar.xz
(svn r22910) -Fix [FS#4617]: icon would (almost) never be shown for SDL builds
Diffstat (limited to 'src')
-rw-r--r--src/video/sdl_v.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index f5389ea55..401bcc948 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -22,6 +22,7 @@
#include "../progress.h"
#include "../core/random_func.hpp"
#include "../core/math_func.hpp"
+#include "../fileio_func.h"
#include "sdl_v.h"
#include <SDL.h>
@@ -203,10 +204,6 @@ static void GetAvailableVideoMode(uint *w, uint *h)
*h = _resolutions[best].height;
}
-#ifndef ICON_DIR
-#define ICON_DIR "media"
-#endif
-
#ifdef WIN32
/* Let's redefine the LoadBMP macro with because we are dynamically
* loading SDL and need to 'SDL_CALL' all functions */
@@ -226,15 +223,18 @@ static bool CreateMainSurface(uint w, uint h)
if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
- /* Give the application an icon */
- icon = SDL_CALL SDL_LoadBMP(ICON_DIR PATHSEP "openttd.32.bmp");
- if (icon != NULL) {
- /* Get the colourkey, which will be magenta */
- uint32 rgbmap = SDL_CALL SDL_MapRGB(icon->format, 255, 0, 255);
-
- SDL_CALL SDL_SetColorKey(icon, SDL_SRCCOLORKEY, rgbmap);
- SDL_CALL SDL_WM_SetIcon(icon, NULL);
- SDL_CALL SDL_FreeSurface(icon);
+ char icon_path[MAX_PATH];
+ if (FioFindFullPath(icon_path, lengthof(icon_path), BASESET_DIR, "openttd.32.bmp") != NULL) {
+ /* Give the application an icon */
+ icon = SDL_CALL SDL_LoadBMP(icon_path);
+ if (icon != NULL) {
+ /* Get the colourkey, which will be magenta */
+ uint32 rgbmap = SDL_CALL SDL_MapRGB(icon->format, 255, 0, 255);
+
+ SDL_CALL SDL_SetColorKey(icon, SDL_SRCCOLORKEY, rgbmap);
+ SDL_CALL SDL_WM_SetIcon(icon, NULL);
+ SDL_CALL SDL_FreeSurface(icon);
+ }
}
/* DO NOT CHANGE TO HWSURFACE, IT DOES NOT WORK */