From 8bee1f8bc2232bd6775c402f9f630e92d901593f Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 15 Jan 2014 19:23:46 +0100 Subject: [PATCH] rnd-20140115-1-src * fixed bug when displaying game envelope with even sized playfield --- ChangeLog | 7 +++++++ src/conftime.h | 2 +- src/libgame/misc.c | 23 ++++++++++++++++++----- src/libgame/misc.h | 7 ++++--- src/screens.c | 16 +++++++--------- 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6269f26..5d35816c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ 2014-01-14 + * fixed bug when displaying game envelope with even sized playfield * added graphic configuration options for request (dialog) buttons +2014-01-13 + * fixed some redraw bugs with window scaling under Mac OS X + +2014-01-10 + * fixed problems with window scaling and updating related setup value + 2014-01-07 * fixed problems related to fullscreen switching and window scaling diff --git a/src/conftime.h b/src/conftime.h index 65131934..2921eb0c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2014-01-14 23:33" +#define COMPILE_DATE_STRING "2014-01-15 19:23" diff --git a/src/libgame/misc.c b/src/libgame/misc.c index ae4b5d78..38c062de 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -708,7 +708,7 @@ char *getPath3(char *path1, char *path2, char *path3) return getStringCat3WithSeparator(path1, path2, path3, STRING_PATH_SEPARATOR); } -char *getStringCopy(char *s) +char *getStringCopy(const char *s) { char *s_copy; @@ -721,7 +721,7 @@ char *getStringCopy(char *s) return s_copy; } -char *getStringCopyN(char *s, int n) +char *getStringCopyN(const char *s, int n) { char *s_copy; int s_len = MAX(0, n); @@ -736,7 +736,18 @@ char *getStringCopyN(char *s, int n) return s_copy; } -char *getStringToLower(char *s) +char *getStringCopyNStatic(const char *s, int n) +{ + static char *s_copy = NULL; + + checked_free(s_copy); + + s_copy = getStringCopyN(s, n); + + return s_copy; +} + +char *getStringToLower(const char *s) { char *s_copy = checked_malloc(strlen(s) + 1); char *s_ptr = s_copy; @@ -1057,15 +1068,17 @@ void GetOptions(char *argv[], void (*print_usage_function)(void)) /* error handling functions */ /* ------------------------------------------------------------------------- */ +#define MAX_INTERNAL_ERROR_SIZE 1024 + /* used by SetError() and GetError() to store internal error messages */ -static char internal_error[1024]; /* this is bad */ +static char internal_error[MAX_INTERNAL_ERROR_SIZE]; void SetError(char *format, ...) { va_list ap; va_start(ap, format); - vsprintf(internal_error, format, ap); + vsnprintf(internal_error, MAX_INTERNAL_ERROR_SIZE, format, ap); va_end(ap); } diff --git a/src/libgame/misc.h b/src/libgame/misc.h index b2d84573..98cc3fe1 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -154,9 +154,10 @@ char *getStringCat2(char *, char *); char *getStringCat3(char *, char *, char *); char *getPath2(char *, char *); char *getPath3(char *, char *, char*); -char *getStringCopy(char *); -char *getStringCopyN(char *, int); -char *getStringToLower(char *); +char *getStringCopy(const char *); +char *getStringCopyN(const char *, int); +char *getStringCopyNStatic(const char *, int); +char *getStringToLower(const char *); void setString(char **, char *); boolean strEqual(char *, char *); boolean strEqualN(char *, char *, int); diff --git a/src/screens.c b/src/screens.c index d3cb7b1f..6543e168 100644 --- a/src/screens.c +++ b/src/screens.c @@ -2992,19 +2992,17 @@ void DrawInfoScreen_Version() int ystart1 = mSY - SY + 100; int ystart2 = mSY - SY + 150; int ybottom = mSY - SY + SYSIZE - 20; - int xstart1 = mSX + 2 * xstep; - int xstart2 = mSX + 19 * xstep; + int xstart1 = mSX - SX + 2 * xstep; + int xstart2 = mSX - SX + 18 * xstep; #if defined(TARGET_SDL) - int xstart3 = mSX + 29 * xstep; + int xstart3 = mSX - SX + 28 * xstep; SDL_version sdl_version_compiled; -#if defined(TARGET_SDL2) - SDL_version sdl_version_linked_ext; -#endif const SDL_version *sdl_version_linked; + int driver_name_len = 10; #if defined(TARGET_SDL2) + SDL_version sdl_version_linked_ext; const char *driver_name = NULL; #else - int driver_name_len = 8; char driver_name[driver_name_len]; #endif #endif @@ -3112,7 +3110,7 @@ void DrawInfoScreen_Version() DrawTextF(xstart3, ystart2, font_header, "Used"); #if defined(TARGET_SDL2) - driver_name = SDL_GetVideoDriver(0); + driver_name = getStringCopyNStatic(SDL_GetVideoDriver(0), driver_name_len); #else SDL_VideoDriverName(driver_name, driver_name_len); #endif @@ -3123,7 +3121,7 @@ void DrawInfoScreen_Version() DrawTextF(xstart3, ystart2, font_text, "%s", driver_name); #if defined(TARGET_SDL2) - driver_name = SDL_GetAudioDriver(0); + driver_name = getStringCopyNStatic(SDL_GetAudioDriver(0), driver_name_len); #else SDL_AudioDriverName(driver_name, driver_name_len); #endif -- 2.34.1