From 2e9b81c595b0150da80f8bf5ee56a74240fda6c1 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 22 Sep 2002 02:34:29 +0200 Subject: [PATCH] rnd-20020922-1-src --- src/conftime.h | 2 +- src/init.c | 2 ++ src/libgame/misc.c | 2 ++ src/libgame/setup.c | 24 ++++++++++++++++++++++++ src/main.c | 37 ++++++++++++++++++------------------- src/main.h | 37 ++++++++++++++++++------------------- src/tools.c | 4 ++-- 7 files changed, 67 insertions(+), 41 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 23b21eca..f0425dde 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2002-09-21 23:08]" +#define COMPILE_DATE_STRING "[2002-09-22 02:29]" diff --git a/src/init.c b/src/init.c index 54a6436e..97c52c16 100644 --- a/src/init.c +++ b/src/init.c @@ -985,6 +985,7 @@ void InitElementInfo() i++; } #else + i = 0; while (element_to_graphic[i].element > -1) { @@ -1010,6 +1011,7 @@ void InitElementInfo() i++; } + #endif } diff --git a/src/libgame/misc.c b/src/libgame/misc.c index f140d460..757872e8 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1478,6 +1478,8 @@ static void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) if (value != NULL) file_list[i].parameter[j] = atoi(value); + + free(token); } } diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 614bb613..aeb115ef 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -462,10 +462,14 @@ char *getCustomImageFilename(char *basename) if (fileExists(filename)) return filename; + free(filename); + /* 2nd try: look for special artwork in current level series directory */ filename = getPath3(getCurrentLevelDir(), GRAPHICS_DIRECTORY, basename); if (fileExists(filename)) return filename; + + free(filename); } /* 3rd try: look for special artwork in configured artwork directory */ @@ -473,11 +477,15 @@ char *getCustomImageFilename(char *basename) if (fileExists(filename)) return filename; + free(filename); + /* 4th try: look for default artwork in new default artwork directory */ filename = getPath2(getDefaultGraphicsDir(GRAPHICS_SUBDIR), basename); if (fileExists(filename)) return filename; + free(filename); + /* 5th try: look for default artwork in old default artwork directory */ filename = getPath2(options.graphics_directory, basename); if (fileExists(filename)) @@ -500,10 +508,14 @@ char *getCustomSoundFilename(char *basename) if (fileExists(filename)) return filename; + free(filename); + /* 2nd try: look for special artwork in current level series directory */ filename = getPath3(getCurrentLevelDir(), SOUNDS_DIRECTORY, basename); if (fileExists(filename)) return filename; + + free(filename); } /* 3rd try: look for special artwork in configured artwork directory */ @@ -511,11 +523,15 @@ char *getCustomSoundFilename(char *basename) if (fileExists(filename)) return filename; + free(filename); + /* 4th try: look for default artwork in new default artwork directory */ filename = getPath2(getDefaultSoundsDir(SOUNDS_SUBDIR), basename); if (fileExists(filename)) return filename; + free(filename); + /* 5th try: look for default artwork in old default artwork directory */ filename = getPath2(options.sounds_directory, basename); if (fileExists(filename)) @@ -553,10 +569,14 @@ char *getCustomMusicDirectory(void) if (fileExists(directory)) return directory; + free(directory); + /* 2nd try: look for special artwork in current level series directory */ directory = getPath2(getCurrentLevelDir(), MUSIC_DIRECTORY); if (fileExists(directory)) return directory; + + free(directory); } /* 3rd try: look for special artwork in configured artwork directory */ @@ -564,11 +584,15 @@ char *getCustomMusicDirectory(void) if (fileExists(directory)) return directory; + free(directory); + /* 4th try: look for default artwork in new default artwork directory */ directory = getStringCopy(getDefaultMusicDir(MUSIC_SUBDIR)); if (fileExists(directory)) return directory; + free(directory); + /* 5th try: look for default artwork in old default artwork directory */ directory = getStringCopy(options.music_directory); if (fileExists(directory)) diff --git a/src/main.c b/src/main.c index da3239df..8a6dd77e 100644 --- a/src/main.c +++ b/src/main.c @@ -139,25 +139,24 @@ char *sound_name[NUM_SOUNDS] = /* this is used to reduce memory usage of the different animation types */ int graphics_action_mapping[] = { - 0, /* GFX_ACTION_UNKNOWN (0) */ - 0, /* GFX_ACTION_DEFAULT (1) */ - 0, /* GFX_ACTION_WAITING (2) */ - - 1, /* GFX_ACTION_FALLING (3) */ - 2, /* GFX_ACTION_MOVING (4) */ - 3, /* GFX_ACTION_DIGGING (5) */ - 4, /* GFX_ACTION_SNAPPING (6) */ - 5, /* GFX_ACTION_COLLECTING (7) */ - 6, /* GFX_ACTION_PUSHING (8) */ - - 7, /* GFX_ACTION_PASSING (9) */ - 7, /* GFX_ACTION_IMPACT (10) */ - 7, /* GFX_ACTION_CRACKING (11) */ - 7, /* GFX_ACTION_ACTIVATING (12) */ - 7, /* GFX_ACTION_EATING (13) */ - 7, /* GFX_ACTION_ATTACKING (14) */ - 7, /* GFX_ACTION_GROWING (15) */ - 7 /* GFX_ACTION_OTHER (14) */ + 0, /* GFX_ACTION_DEFAULT (0) */ + 0, /* GFX_ACTION_WAITING (1) */ + + 1, /* GFX_ACTION_FALLING (2) */ + 2, /* GFX_ACTION_MOVING (3) */ + 3, /* GFX_ACTION_DIGGING (4) */ + 4, /* GFX_ACTION_SNAPPING (5) */ + 5, /* GFX_ACTION_COLLECTING (6) */ + 6, /* GFX_ACTION_PUSHING (7) */ + + 7, /* GFX_ACTION_PASSING (8) */ + 7, /* GFX_ACTION_IMPACT (9) */ + 7, /* GFX_ACTION_CRACKING (10) */ + 7, /* GFX_ACTION_ACTIVATING (11) */ + 7, /* GFX_ACTION_EATING (12) */ + 7, /* GFX_ACTION_ATTACKING (13) */ + 7, /* GFX_ACTION_GROWING (14) */ + 7 /* GFX_ACTION_OTHER (15) */ }; struct ConfigInfo image_config_suffix[] = diff --git a/src/main.h b/src/main.h index edac5c48..08463a8c 100644 --- a/src/main.h +++ b/src/main.h @@ -1310,25 +1310,24 @@ /* values for animation action types */ -#define GFX_ACTION_UNKNOWN 0 -#define GFX_ACTION_DEFAULT 1 -#define GFX_ACTION_WAITING 2 -#define GFX_ACTION_FALLING 3 -#define GFX_ACTION_MOVING 4 -#define GFX_ACTION_DIGGING 5 -#define GFX_ACTION_SNAPPING 6 -#define GFX_ACTION_COLLECTING 7 -#define GFX_ACTION_PUSHING 8 -#define GFX_ACTION_PASSING 9 -#define GFX_ACTION_IMPACT 10 -#define GFX_ACTION_CRACKING 11 -#define GFX_ACTION_ACTIVATING 12 -#define GFX_ACTION_EATING 13 -#define GFX_ACTION_ATTACKING 14 -#define GFX_ACTION_GROWING 15 -#define GFX_ACTION_OTHER 16 - -#define NUM_GFX_ACTIONS 17 +#define GFX_ACTION_DEFAULT 0 +#define GFX_ACTION_WAITING 1 +#define GFX_ACTION_FALLING 2 +#define GFX_ACTION_MOVING 3 +#define GFX_ACTION_DIGGING 4 +#define GFX_ACTION_SNAPPING 5 +#define GFX_ACTION_COLLECTING 6 +#define GFX_ACTION_PUSHING 7 +#define GFX_ACTION_PASSING 8 +#define GFX_ACTION_IMPACT 9 +#define GFX_ACTION_CRACKING 10 +#define GFX_ACTION_ACTIVATING 11 +#define GFX_ACTION_EATING 12 +#define GFX_ACTION_ATTACKING 13 +#define GFX_ACTION_GROWING 14 +#define GFX_ACTION_OTHER 15 + +#define NUM_GFX_ACTIONS 16 #define NUM_GFX_ACTIONS_MAPPED 8 diff --git a/src/tools.c b/src/tools.c index 74d003cd..3015b1ad 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3369,7 +3369,7 @@ int el_dir2img(int element, int direction) if (element_info[element].has_direction_graphic[action]) { - int direction = MV_DIR_BIT(direction); + direction = MV_DIR_BIT(direction); return element_info[element].direction_graphic[action][direction]; } @@ -3381,7 +3381,7 @@ int el_dir_act2img(int element, int direction, int action) { if (element_info[element].has_direction_graphic[action]) { - int direction = MV_DIR_BIT(direction); + direction = MV_DIR_BIT(direction); return element_info[element].direction_graphic[action][direction]; } -- 2.34.1