X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame_bd%2Fbd_cavedb.c;h=804cd06e42599fb6ee863de5ed59c1319a8a2f6c;hb=8abd6e132e135415854a5776593f6585084d3c9e;hp=177f38acbff4279a102cd9df5e0a2e5ffca42906;hpb=bdda8328c686949f91cf2ce84cd719eb259ba94e;p=rocksndiamonds.git diff --git a/src/game_bd/bd_cavedb.c b/src/game_bd/bd_cavedb.c index 177f38ac..804cd06e 100644 --- a/src/game_bd/bd_cavedb.c +++ b/src/game_bd/bd_cavedb.c @@ -930,7 +930,7 @@ GdElement gd_element_get_hammered(GdElement elem) void gd_cave_db_init(void) { int i; - GHashTable *pointers; + struct hashtable *pointers; boolean lowercase_names = TRUE; /* TRANSLATORS: some languages (for example, german) do not have lowercase nouns. */ @@ -967,13 +967,13 @@ void gd_cave_db_init(void) } /* we do not like generated pixbufs for games. only those that are in the png. */ - if (ABS(gd_elements[i].image_game)>GD_NUM_OF_CELLS_X*GD_NUM_OF_CELLS_Y) + if (ABS(gd_elements[i].image_game) > GD_NUM_OF_CELLS_X * GD_NUM_OF_CELLS_Y) Error("game pixbuf for element %x (%s) bigger than png size", i, gd_elements[i].name); if (gd_elements[i].image < 0) Error("editor pixbuf for element %x (%s) should not be animated", i, gd_elements[i].name); - if (gd_elements[i].properties&P_CAN_BE_HAMMERED && gd_element_get_hammered((GdElement) i) == O_NONE) + if (gd_elements[i].properties & P_CAN_BE_HAMMERED && gd_element_get_hammered((GdElement) i) == O_NONE) Error("element %x (%s) can be hammered, but get_hammered_element does not define another one", i, gd_elements[i].name); } @@ -1000,7 +1000,7 @@ void gd_cave_db_init(void) */ /* check the cave property database for faults. */ - pointers = g_hash_table_new(g_direct_hash, g_direct_equal); + pointers = create_hashtable(get_hash_from_integer, hash_key_integers_are_equal, NULL, NULL); for (i = 0; gd_cave_properties[i].identifier != NULL; i++) { @@ -1072,13 +1072,14 @@ void gd_cave_db_init(void) /* other types */ /* check if its pointer is not the same as another one's */ /* +1 is added so it is never zero */ - if (!(gd_cave_properties[i].flags&GD_DONT_SAVE) && strcmp(gd_cave_properties[i].identifier, "") == 0) + if (!(gd_cave_properties[i].flags & GD_DONT_SAVE) && strcmp(gd_cave_properties[i].identifier, "") == 0) { Error ("property should have a bdcff identifier: line %d, name %s", i, gd_cave_properties[i].name); } - another_prop = g_hash_table_lookup(pointers, GINT_TO_POINTER(gd_cave_properties[i].offset + 1)); + another_prop = hashtable_search(pointers, INT_TO_PTR(gd_cave_properties[i].offset + 1)); + if (another_prop != NULL) { Error("property %s has the same pointer as property %s", @@ -1087,11 +1088,11 @@ void gd_cave_db_init(void) else { /* value is the identifier, so we can report the OLD one if the check fails */ - g_hash_table_insert(pointers, GINT_TO_POINTER(gd_cave_properties[i].offset + 1), - gd_cave_properties[i].identifier); + hashtable_insert(pointers, INT_TO_PTR(gd_cave_properties[i].offset + 1), + gd_cave_properties[i].identifier); } } } - g_hash_table_destroy(pointers); + hashtable_destroy(pointers); }