renamed functions
authorHolger Schemel <info@artsoft.org>
Wed, 21 Feb 2024 18:43:39 +0000 (19:43 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 21 Feb 2024 18:47:18 +0000 (19:47 +0100)
src/anim.c
src/files.c
src/game.c
src/libgame/setup.c
src/libgame/setup.h
src/tools.c

index 1389dc4e8815451aaa2a49d6d78190f841871e22..53435a97a71f660a6c5c62c904220ed3890f0fa3 100644 (file)
@@ -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)
index d3031fafb1dad2ee066f0f46cd90817bc394896f..1cb235ced68f5daa059138da80c795251f411423 100644 (file)
@@ -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"))
   {
index 1b16a6f995ad6f7313d1aebb0de762f5cbd299b4..b050950d7ff899a5894b31fcef21b98f9bc42aa9 100644 (file)
@@ -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)
index b419875a580e8fd1f87eab476ec4b496f232db7c..5fb6ecfcea7127a345d3d0024a95519923d0d1ef 100644 (file)
@@ -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");
index 59700cf9cf70011ed01b71ed1e224d313ccc85e6..99167ea16f42c3e563966d5905324f4a0427a130 100644 (file)
@@ -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);
index d181501ef101fac3a68dd1ece8097a9af4730d24..0b0b7e2ee1e2b5938dfb2e9bb4e7854087019e19 100644 (file)
@@ -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;