From: Holger Schemel Date: Wed, 21 Feb 2024 18:43:39 +0000 (+0100) Subject: renamed functions X-Git-Tag: 4.4.0.0-test-1~324 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=fd72fbf3b83fc7215347e131aa6fc3c87ad7b4d5;p=rocksndiamonds.git renamed functions --- diff --git a/src/anim.c b/src/anim.c index 1389dc4e..53435a97 100644 --- a/src/anim.c +++ b/src/anim.c @@ -599,7 +599,7 @@ static void InitGlobalAnimControls(void) } // apply special settings to pointer-style animations - if (part->control_info.class == get_hash_from_key("pointer")) + if (part->control_info.class == get_hash_from_string("pointer")) { // force pointer-style animations to be checked for clicks first part->control_info.draw_order = 1000000; @@ -987,7 +987,7 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part boolean changed = FALSE; if (part->last_anim_status == global.anim_status && - part->control_info.class != get_hash_from_key("pointer")) + part->control_info.class != get_hash_from_string("pointer")) return FALSE; part->last_anim_status = global.anim_status; @@ -996,8 +996,8 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part part->class_playfield_or_door = FALSE; - if (part->control_info.class == get_hash_from_key("window") || - part->control_info.class == get_hash_from_key("border")) + if (part->control_info.class == get_hash_from_string("window") || + part->control_info.class == get_hash_from_string("border")) { viewport_x = 0; viewport_y = 0; @@ -1006,7 +1006,7 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part part->drawing_stage = DRAW_GLOBAL_ANIM_STAGE_2; } - else if (part->control_info.class == get_hash_from_key("pointer")) + else if (part->control_info.class == get_hash_from_string("pointer")) { int mx = MIN(MAX(0, gfx.mouse_x), WIN_XSIZE - 1); int my = MIN(MAX(0, gfx.mouse_y), WIN_YSIZE - 1); @@ -1027,7 +1027,7 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part if (global.anim_status != GAME_MODE_LOADING) gfx.cursor_mode_override = CURSOR_NONE; } - else if (part->control_info.class == get_hash_from_key("door_1")) + else if (part->control_info.class == get_hash_from_string("door_1")) { viewport_x = DX; viewport_y = DY; @@ -1036,7 +1036,7 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part part->class_playfield_or_door = TRUE; } - else if (part->control_info.class == get_hash_from_key("door_2")) + else if (part->control_info.class == get_hash_from_string("door_2")) { if (part->mode_nr == GAME_MODE_EDITOR) { @@ -1075,7 +1075,7 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part part->viewport_width = viewport_width; part->viewport_height = viewport_height; - if (part->control_info.class != get_hash_from_key("pointer")) + if (part->control_info.class != get_hash_from_string("pointer")) changed = TRUE; } @@ -1613,7 +1613,7 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, part->step_yoffset = 0; } - if (part->control_info.class != get_hash_from_key("pointer")) + if (part->control_info.class != get_hash_from_string("pointer")) { if (c->x != ARG_UNDEFINED_VALUE) part->x = c->x; @@ -2076,7 +2076,7 @@ static boolean InitGlobalAnim_Clicked(int mx, int my, int clicked_event) // if request dialog is active, only handle pointer-style animations if (game.request_active && - part->control_info.class != get_hash_from_key("pointer")) + part->control_info.class != get_hash_from_string("pointer")) continue; if (clicked_event == ANIM_CLICKED_RESET) diff --git a/src/files.c b/src/files.c index d3031faf..1cb235ce 100644 --- a/src/files.c +++ b/src/files.c @@ -11982,7 +11982,7 @@ static int get_anim_action_parameter_value(char *token) { if (isURL(token)) { - result = get_hash_from_key(token); // unsigned int => int + result = get_hash_from_string(token); // unsigned int => int result = ABS(result); // may be negative now result += (result < MAX_IMAGE_FILES ? MAX_IMAGE_FILES : 0); @@ -12084,7 +12084,7 @@ int get_parameter_value(char *value_raw, char *suffix, int type) else if (strEqual(suffix, ".class")) { result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE : - get_hash_from_key(value)); + get_hash_from_string(value)); } else if (strEqual(suffix, ".style")) { diff --git a/src/game.c b/src/game.c index 1b16a6f9..b050950d 100644 --- a/src/game.c +++ b/src/game.c @@ -2722,7 +2722,7 @@ static void DisplayGameControlValues(void) if (PANEL_DEACTIVATED(pos)) continue; - if (pos->class == get_hash_from_key("extra_panel_items") && + if (pos->class == get_hash_from_string("extra_panel_items") && !setup.prefer_extra_panel_items) continue; @@ -2814,7 +2814,7 @@ static void DisplayGameControlValues(void) int width, height; int dst_x = PANEL_XPOS(pos); int dst_y = PANEL_YPOS(pos); - boolean skip = (pos->class == get_hash_from_key("mm_engine_only") && + boolean skip = (pos->class == get_hash_from_string("mm_engine_only") && level.game_engine_type != GAME_ENGINE_TYPE_MM); if (graphic != IMG_UNDEFINED && !skip) diff --git a/src/libgame/setup.c b/src/libgame/setup.c index b419875a..5fb6ecfc 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -725,7 +725,7 @@ char *getScoreTapeBasename(char *name) sprintf(timestamp, "%s", getCurrentTimestamp()); sprintf(basename_raw, "%s-%s", timestamp, name); - sprintf(basename, "%s-%08x", timestamp, get_hash_from_key(basename_raw)); + sprintf(basename, "%s-%08x", timestamp, get_hash_from_string(basename_raw)); return basename; } @@ -2281,7 +2281,7 @@ DEFINE_HASHTABLE_REMOVE(remove_hash_entry, char, char); #define remove_hash_entry hashtable_remove #endif -unsigned int get_hash_from_key(void *key) +unsigned int get_hash_from_string(void *key) { /* djb2 @@ -2311,7 +2311,7 @@ unsigned int get_hash_from_key(void *key) return hash; } -int hash_keys_are_equal(void *key1, void *key2) +int hash_key_strings_are_equal(void *key1, void *key2) { return (strEqual((char *)key1, (char *)key2)); } @@ -2319,7 +2319,7 @@ int hash_keys_are_equal(void *key1, void *key2) SetupFileHash *newSetupFileHash(void) { SetupFileHash *new_hash = - create_hashtable(16, 0.75, get_hash_from_key, hash_keys_are_equal); + create_hashtable(16, 0.75, get_hash_from_string, hash_key_strings_are_equal); if (new_hash == NULL) Fail("create_hashtable() failed -- out of memory"); diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 59700cf9..99167ea1 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -371,8 +371,8 @@ void setSetupInfo(struct TokenInfo *, int, char *); char *getSetupValue(int, void *); char *getSetupLine(struct TokenInfo *, char *, int); -unsigned int get_hash_from_key(void *); -int hash_keys_are_equal(void *, void *); +unsigned int get_hash_from_string(void *); +int hash_key_strings_are_equal(void *, void *); int GetZipFileTreeType(char *); char *ExtractZipFileIntoDirectory(char *, char *, int); diff --git a/src/tools.c b/src/tools.c index d181501e..0b0b7e2e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -11317,9 +11317,9 @@ static unsigned int test_uuid_random_function_better(int max) static void TestGeneratingUUIDs_RunTest(int nr, int always_seed, int num_uuids) { struct hashtable *hash_seeds = - create_hashtable(16, 0.75, get_hash_from_key, hash_keys_are_equal); + create_hashtable(16, 0.75, get_hash_from_string, hash_key_strings_are_equal); struct hashtable *hash_uuids = - create_hashtable(16, 0.75, get_hash_from_key, hash_keys_are_equal); + create_hashtable(16, 0.75, get_hash_from_string, hash_key_strings_are_equal); static char message[100]; int i;