From: Holger Schemel Date: Fri, 23 Feb 2024 17:24:14 +0000 (+0100) Subject: replaced glib function calls to g_list_*() X-Git-Tag: 4.4.0.0-test-1~304 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=01bf4018243f57cefbc0308e49f4dd2d40a0c054;p=rocksndiamonds.git replaced glib function calls to g_list_*() --- diff --git a/src/game_bd/bd_bdcff.c b/src/game_bd/bd_bdcff.c index 663d9778..bc8c8015 100644 --- a/src/game_bd/bd_bdcff.c +++ b/src/game_bd/bd_bdcff.c @@ -497,7 +497,7 @@ static void cave_report_and_copy_unknown_tags_func(char *attrib, char *param, gp } /* having read all strings belonging to the cave, process it. */ -static void cave_process_tags(GdCave *cave, HashTable *tags, GList *maplines) +static void cave_process_tags(GdCave *cave, HashTable *tags, List *maplines) { char *value; @@ -584,8 +584,8 @@ static void cave_process_tags(GdCave *cave, HashTable *tags, GList *maplines) /* some old bdcff files use smaller intermissions than the one specified. */ if (maplines) { - int x, y, length = g_list_length(maplines); - GList *iter; + int x, y, length = list_length(maplines); + List *iter; /* create map and fill with initial border, in case that map strings are shorter or somewhat */ cave->map = gd_cave_map_new(cave, GdElement); @@ -642,7 +642,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) char **lines; int lineno; GdCave *cave; - GList *iter; + List *iter; boolean reading_replay = FALSE; boolean reading_map = FALSE; boolean reading_mapcodes = FALSE; @@ -651,7 +651,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) boolean reading_bdcff_demo = FALSE; /* assume version to be 0.32, also when the file does not specify it explicitly */ GdString version_read = "0.32"; - GList *mapstrings = NULL; + List *mapstrings = NULL; int linenum; HashTable *tags, *replay_tags; GdObjectLevels levels = GD_OBJECT_LEVEL_ALL; @@ -701,7 +701,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) if (mapstrings) { Warn("incorrect file format: new [cave] section, but already read some map lines"); - g_list_free(mapstrings); + list_free(mapstrings); mapstrings = NULL; } @@ -710,12 +710,12 @@ boolean gd_caveset_load_from_bdcff(const char *contents) /* ... to be able to create a copy for a new cave. */ cave = gd_cave_new_from_cave(default_cave); - gd_caveset = g_list_append (gd_caveset, cave); + gd_caveset = list_append (gd_caveset, cave); } else if (strcasecmp(line, "[/cave]") == 0) { cave_process_tags(cave, tags, mapstrings); - g_list_free(mapstrings); + list_free(mapstrings); mapstrings = NULL; hashtable_foreach(tags, (hashtable_fn)cave_report_and_copy_unknown_tags_func, cave); @@ -730,7 +730,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) if (mapstrings != NULL) { Warn("incorrect file format: new [map] section, but already read some map lines"); - g_list_free(mapstrings); + list_free(mapstrings); mapstrings = NULL; } } @@ -773,7 +773,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) replay = gd_replay_new(); replay->saved = TRUE; replay->success = TRUE; /* we think that it is a successful demo */ - cave->replays = g_list_append(cave->replays, replay); + cave->replays = list_append(cave->replays, replay); gd_strcpy(replay->player_name, "???"); /* name not saved */ } else @@ -812,7 +812,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) if (replay->movements->len != 0) { - cave->replays = g_list_append(cave->replays, replay); + cave->replays = list_append(cave->replays, replay); } else { @@ -877,7 +877,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) if (reading_map) { /* just append to the mapstrings list. we will process it later */ - mapstrings = g_list_append(mapstrings, line); + mapstrings = list_append(mapstrings, line); continue; } @@ -912,13 +912,13 @@ boolean gd_caveset_load_from_bdcff(const char *contents) if (reading_bdcff_demo) { GdReplay *replay; - GList *iter; + List *iter; /* demo must be in [cave] section. we already showed an error message for this. */ if (cave == default_cave) continue; - iter = g_list_last(cave->replays); + iter = list_last(cave->replays); replay = (GdReplay *)iter->data; replay_store_more_from_bdcff(replay, line); @@ -934,7 +934,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) if (new_object) { new_object->levels = levels; /* apply levels to new object */ - cave->objects = g_list_append(cave->objects, new_object); + cave->objects = list_append(cave->objects, new_object); } else { @@ -1135,7 +1135,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) if (mapstrings) { Warn("incorrect file format: end of file, but still have some map lines read"); - g_list_free(mapstrings); + list_free(mapstrings); mapstrings = NULL; } @@ -1163,7 +1163,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) if (strEqual(version_read, "0.32")) { - GList *iter; + List *iter; Warn("No BDCFF version, or 0.32. Using unspecified-intermission-size hack."); @@ -1194,12 +1194,12 @@ boolean gd_caveset_load_from_bdcff(const char *contents) object.element = cave->initial_border; object.fill_element = cave->initial_border; - cave->objects = g_list_prepend(cave->objects, getMemCopy(&object, sizeof(object))); + cave->objects = list_prepend(cave->objects, getMemCopy(&object, sizeof(object))); object.x1 = 19; object.y1 = 0; /* 19, as it is also the border */ - cave->objects = g_list_prepend(cave->objects, getMemCopy(&object, sizeof(object))); /* another */ + cave->objects = list_prepend(cave->objects, getMemCopy(&object, sizeof(object))); /* another */ } } } diff --git a/src/game_bd/bd_c64import.c b/src/game_bd/bd_c64import.c index 327de812..a88255d9 100644 --- a/src/game_bd/bd_c64import.c +++ b/src/game_bd/bd_c64import.c @@ -690,7 +690,7 @@ static int cave_copy_from_bd1(GdCave *cave, const guint8 *data, int remaining_by { int pos = x1 + y1 * 40 + y * dy * 40 + x * dx; - cave->objects = g_list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, pos % 40, pos / 40, elem)); + cave->objects = list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, pos % 40, pos / 40, elem)); } } @@ -710,7 +710,7 @@ static int cave_copy_from_bd1(GdCave *cave, const guint8 *data, int remaining_by if (x1 >= cave->w || y1 >= cave->h) Warn("invalid point coordinates %d,%d at byte %d", x1, y1, index); - cave->objects = g_list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); + cave->objects = list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); index += 3; break; @@ -742,7 +742,7 @@ static int cave_copy_from_bd1(GdCave *cave, const guint8 *data, int remaining_by y2 >= cave->h) Warn("invalid line coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); - cave->objects = g_list_append(cave->objects, gd_object_new_line(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); + cave->objects = list_append(cave->objects, gd_object_new_line(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); } index += 5; @@ -760,7 +760,7 @@ static int cave_copy_from_bd1(GdCave *cave, const guint8 *data, int remaining_by y2 >= cave->h) Warn("invalid filled rectangle coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); - cave->objects = g_list_append(cave->objects, gd_object_new_filled_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem, import_func(data[index + 5], index + 5))); + cave->objects = list_append(cave->objects, gd_object_new_filled_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem, import_func(data[index + 5], index + 5))); index += 6; break; @@ -777,7 +777,7 @@ static int cave_copy_from_bd1(GdCave *cave, const guint8 *data, int remaining_by y2 >= cave->h) Warn("invalid rectangle coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); - cave->objects = g_list_append(cave->objects, gd_object_new_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); + cave->objects = list_append(cave->objects, gd_object_new_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); index += 5; break; @@ -882,7 +882,7 @@ static int cave_copy_from_bd2(GdCave *cave, const guint8 *data, int remaining_by y2 >= cave->h) Warn("invalid line coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); - cave->objects = g_list_append(cave->objects, gd_object_new_line(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); + cave->objects = list_append(cave->objects, gd_object_new_line(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); index += 6; break; @@ -900,7 +900,7 @@ static int cave_copy_from_bd2(GdCave *cave, const guint8 *data, int remaining_by y2 >= cave->h) Warn("invalid rectangle coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); - cave->objects = g_list_append(cave->objects, gd_object_new_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); + cave->objects = list_append(cave->objects, gd_object_new_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); index += 6; break; @@ -918,7 +918,7 @@ static int cave_copy_from_bd2(GdCave *cave, const guint8 *data, int remaining_by y2 >= cave->h) Warn("invalid filled rectangle coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); - cave->objects = g_list_append(cave->objects, gd_object_new_filled_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem, bd1_import(data[index+6], index+6))); + cave->objects = list_append(cave->objects, gd_object_new_filled_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem, bd1_import(data[index+6], index+6))); index += 7; break; @@ -932,7 +932,7 @@ static int cave_copy_from_bd2(GdCave *cave, const guint8 *data, int remaining_by y1 >= cave->h) Warn("invalid point coordinates %d,%d at byte %d", x1, y1, index); - cave->objects = g_list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); + cave->objects = list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); index += 4; break; @@ -960,7 +960,7 @@ static int cave_copy_from_bd2(GdCave *cave, const guint8 *data, int remaining_by y2 >= cave->h) Warn("invalid raster coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); - cave->objects = g_list_append(cave->objects, gd_object_new_raster(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, dx, dy, elem)); + cave->objects = list_append(cave->objects, gd_object_new_raster(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, dx, dy, elem)); index += 8; break; @@ -995,7 +995,7 @@ static int cave_copy_from_bd2(GdCave *cave, const guint8 *data, int remaining_by { /* for (8 bits in a byte) */ if ((val & 1) != 0) /* convert to single points... */ - cave->objects = g_list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); + cave->objects = list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); val >>= 1; x1++; /* next cave pos */ @@ -1015,7 +1015,7 @@ static int cave_copy_from_bd2(GdCave *cave, const guint8 *data, int remaining_by case 6: /* JOIN */ dy = data[index + 3] / 40; dx = data[index + 3] % 40; /* same byte!!! */ - cave->objects = g_list_append(cave->objects, gd_object_new_join(GD_OBJECT_LEVEL_ALL, dx, dy, bd1_import(data[index+1], index+1), bd1_import(data[index+2], index+2))); + cave->objects = list_append(cave->objects, gd_object_new_join(GD_OBJECT_LEVEL_ALL, dx, dy, bd1_import(data[index+1], index+1), bd1_import(data[index+2], index+2))); index += 4; break; @@ -1752,7 +1752,7 @@ static int cave_copy_from_crdr_7(GdCave *cave, const guint8 *data, int remaining if (x1 >= cave->w || y1 >= cave->h) Warn("invalid point coordinates %d,%d at byte %d", x1, y1, index); - cave->objects = g_list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); + cave->objects = list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); index += 4; break; @@ -1770,7 +1770,7 @@ static int cave_copy_from_crdr_7(GdCave *cave, const guint8 *data, int remaining y2 >= cave->h) Warn("invalid rectangle coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); - cave->objects = g_list_append(cave->objects, gd_object_new_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); + cave->objects = list_append(cave->objects, gd_object_new_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); index += 6; break; @@ -1788,7 +1788,7 @@ static int cave_copy_from_crdr_7(GdCave *cave, const guint8 *data, int remaining Warn("invalid filled rectangle coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); /* border and inside of fill is the same element. */ - cave->objects = g_list_append(cave->objects, gd_object_new_filled_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, crazydream_import_table[data[index + 1]], crazydream_import_table[data[index + 1]])); + cave->objects = list_append(cave->objects, gd_object_new_filled_rectangle(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, crazydream_import_table[data[index + 1]], crazydream_import_table[data[index + 1]])); index += 6; break; @@ -1812,7 +1812,7 @@ static int cave_copy_from_crdr_7(GdCave *cave, const guint8 *data, int remaining { for (i = 0; i < length; i++) { - cave->objects = g_list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); + cave->objects = list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, x1, y1, elem)); x1 += nx; y1 += ny; } @@ -1826,7 +1826,7 @@ static int cave_copy_from_crdr_7(GdCave *cave, const guint8 *data, int remaining y2 >= cave->h) Warn("invalid line coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index - 5); - cave->objects = g_list_append(cave->objects, gd_object_new_line(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); + cave->objects = list_append(cave->objects, gd_object_new_line(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, elem)); } index += 6; @@ -1863,7 +1863,7 @@ static int cave_copy_from_crdr_7(GdCave *cave, const guint8 *data, int remaining dy + ch > cave->h) Warn("invalid paste coordinates %d,%d at byte %d", dx, dy, index); - cave->objects = g_list_append(cave->objects, gd_object_new_copy_paste(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, dx, dy, FALSE, FALSE)); + cave->objects = list_append(cave->objects, gd_object_new_copy_paste(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, dx, dy, FALSE, FALSE)); index += 3; break; @@ -1890,7 +1890,7 @@ static int cave_copy_from_crdr_7(GdCave *cave, const guint8 *data, int remaining y2 >= cave->h) Warn("invalid raster coordinates %d,%d %d,%d at byte %d", x1, y1, x2, y2, index); - cave->objects = g_list_append(cave->objects, gd_object_new_raster(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, dx, dy, elem)); + cave->objects = list_append(cave->objects, gd_object_new_raster(GD_OBJECT_LEVEL_ALL, x1, y1, x2, y2, dx, dy, elem)); index += 8; break; @@ -1933,7 +1933,7 @@ static void crazy_dream_9_add_specials(GdCave *cave, const guint8 *buf, const in gint32 prob[4] = { 37, 32, 2, 0 }; gint32 seeds[5] = { -1, -1, -1, -1, -1 }; - cave->objects = g_list_append(cave->objects, gd_object_new_random_fill(GD_OBJECT_LEVEL_ALL, 0, 0, 39, 21, seeds, O_DIRT, rand, prob, O_BLADDER_SPENDER, FALSE)); + cave->objects = list_append(cave->objects, gd_object_new_random_fill(GD_OBJECT_LEVEL_ALL, 0, 0, 39, 21, seeds, O_DIRT, rand, prob, O_BLADDER_SPENDER, FALSE)); } if (strEqual(cave->name, "Roll dice now!") && checksum == 235) @@ -1942,13 +1942,13 @@ static void crazy_dream_9_add_specials(GdCave *cave, const guint8 *buf, const in gint32 prob[4] = { 0x18, 0x08, 0, 0 }; gint32 seeds[5] = { -1, -1, -1, -1, -1 }; - cave->objects = g_list_append(cave->objects, gd_object_new_random_fill(GD_OBJECT_LEVEL_ALL, 0, 0, 39, 21, seeds, O_DIRT, rand, prob, O_BLADDER_SPENDER, FALSE)); + cave->objects = list_append(cave->objects, gd_object_new_random_fill(GD_OBJECT_LEVEL_ALL, 0, 0, 39, 21, seeds, O_DIRT, rand, prob, O_BLADDER_SPENDER, FALSE)); } if (strEqual(cave->name, "Random maze") && checksum == 24) { gint32 seeds[5] = { -1, -1, -1, -1, -1 }; - cave->objects = g_list_append(cave->objects, gd_object_new_maze(GD_OBJECT_LEVEL_ALL, 1, 4, 35, 20, 1, 1, O_NONE, O_DIRT, 50, seeds)); + cave->objects = list_append(cave->objects, gd_object_new_maze(GD_OBJECT_LEVEL_ALL, 1, 4, 35, 20, 1, 1, O_NONE, O_DIRT, 50, seeds)); } if (strEqual(cave->name, "Metamorphosis") && checksum == 53) @@ -1957,8 +1957,8 @@ static void crazy_dream_9_add_specials(GdCave *cave, const guint8 *buf, const in GdElement rand[4] = { O_STONE, O_DIRT, O_DIRT, O_DIRT }; gint32 prob[4] = { 0x18, 0, 0, 0 }; - cave->objects = g_list_append(cave->objects, gd_object_new_maze(GD_OBJECT_LEVEL_ALL, 4, 1, 38, 19, 1, 3, O_NONE, O_BLADDER_SPENDER, 50, seeds)); - cave->objects = g_list_append(cave->objects, gd_object_new_random_fill(GD_OBJECT_LEVEL_ALL, 4, 1, 38, 19, seeds, O_DIRT, rand, prob, O_BLADDER_SPENDER, FALSE)); + cave->objects = list_append(cave->objects, gd_object_new_maze(GD_OBJECT_LEVEL_ALL, 4, 1, 38, 19, 1, 3, O_NONE, O_BLADDER_SPENDER, 50, seeds)); + cave->objects = list_append(cave->objects, gd_object_new_random_fill(GD_OBJECT_LEVEL_ALL, 4, 1, 38, 19, seeds, O_DIRT, rand, prob, O_BLADDER_SPENDER, FALSE)); cave->creatures_backwards = TRUE; /* for some reason, this level worked like that */ } @@ -1966,10 +1966,10 @@ static void crazy_dream_9_add_specials(GdCave *cave, const guint8 *buf, const in { gint32 seeds[5] = { -1, -1, -1, -1, -1 }; - cave->objects = g_list_append(cave->objects, gd_object_new_maze_unicursal(GD_OBJECT_LEVEL_ALL, 1, 1, 35, 19, 1, 1, O_BRICK, O_PRE_DIA_1, 50, seeds)); + cave->objects = list_append(cave->objects, gd_object_new_maze_unicursal(GD_OBJECT_LEVEL_ALL, 1, 1, 35, 19, 1, 1, O_BRICK, O_PRE_DIA_1, 50, seeds)); /* a point which "breaks" the unicursal maze, making it one very long path */ - cave->objects = g_list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, 35, 18, O_BRICK)); + cave->objects = list_append(cave->objects, gd_object_new_point(GD_OBJECT_LEVEL_ALL, 35, 18, O_BRICK)); } } @@ -2295,14 +2295,14 @@ GdCavefileFormat gd_caveset_imported_get_format(const guint8 *buf) /* Load caveset from memory buffer. Loads the caveset from a memory buffer. - returns: GList * of caves. + returns: List * of caves. */ -GList *gd_caveset_import_from_buffer (const guint8 *buf, gsize length) +List *gd_caveset_import_from_buffer (const guint8 *buf, gsize length) { boolean numbering; int cavenum, intermissionnum, num; int cavelength, bufp; - GList *caveset = NULL, *iter; + List *caveset = NULL, *iter; guint32 encodedlength; GdCavefileFormat format; @@ -2335,7 +2335,7 @@ GList *gd_caveset_import_from_buffer (const guint8 *buf, gsize length) while (bufp < length) { GdCave *newcave; - /* default is to append cave to caveset; g_list_insert appends when pos = -1 */ + /* default is to append cave to caveset; list_insert appends when pos = -1 */ int insertpos = -1; newcave = gd_cave_new(); @@ -2441,7 +2441,7 @@ GList *gd_caveset_import_from_buffer (const guint8 *buf, gsize length) } else { - caveset = g_list_insert(caveset, newcave, insertpos); + caveset = list_insert(caveset, newcave, insertpos); } cavenum++; @@ -2463,11 +2463,11 @@ GList *gd_caveset_import_from_buffer (const guint8 *buf, gsize length) if ((buf[2 + 0x1f0] != buf[2 + 0x1f1] - 1) || (buf[2 + 0x1f0] != 0x19 && buf[2 + 0x1f0] != 0x0e)) { - GList *iter; + List *iter; int n; boolean standard; - standard = (g_list_length(caveset)%5) == 0; /* cave count % 5 != 0 -> nonstandard */ + standard = (list_length(caveset)%5) == 0; /* cave count % 5 != 0 -> nonstandard */ for (n = 0, iter = caveset; iter != NULL; n++, iter = iter->next) { @@ -2496,7 +2496,7 @@ GList *gd_caveset_import_from_buffer (const guint8 *buf, gsize length) /* use numbering instead of letters, if following formats or too many caves (as we would run out of letters) */ - numbering = format == GD_FORMAT_PLC || format == GD_FORMAT_CRLI || g_list_length(caveset) > 26; + numbering = format == GD_FORMAT_PLC || format == GD_FORMAT_CRLI || list_length(caveset) > 26; for (iter = caveset; iter != NULL; iter = iter->next) { diff --git a/src/game_bd/bd_c64import.h b/src/game_bd/bd_c64import.h index 936f2127..a130c4b7 100644 --- a/src/game_bd/bd_c64import.h +++ b/src/game_bd/bd_c64import.h @@ -59,7 +59,7 @@ typedef enum _gd_engine extern const char *gd_engines[]; GdCavefileFormat gd_caveset_imported_get_format(const guint8 *buf); -GList* gd_caveset_import_from_buffer (const guint8 *buf, gsize length); +List* gd_caveset_import_from_buffer (const guint8 *buf, gsize length); void gd_cave_set_engine_defaults(GdCave *cave, GdEngine engine); GdEngine gd_cave_get_engine_from_string(const char *param); diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index 197bec5e..b138a37b 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -556,12 +556,12 @@ void gd_cave_free(GdCave *cave) gd_cave_map_free(cave->hammered_reappear); /* free objects */ - g_list_foreach(cave->objects, (GFunc) free, NULL); - g_list_free (cave->objects); + list_foreach(cave->objects, (list_fn) free, NULL); + list_free(cave->objects); /* free replays */ - g_list_foreach(cave->replays, (GFunc) gd_replay_free, NULL); - g_list_free(cave->replays); + list_foreach(cave->replays, (list_fn) gd_replay_free, NULL); + list_free(cave->replays); /* freeing main pointer */ free (cave); @@ -601,21 +601,21 @@ void gd_cave_copy(GdCave *dest, const GdCave *src) /* copy objects list */ if (src->objects) { - GList *iter; + List *iter; dest->objects = NULL; /* new empty list */ for (iter = src->objects; iter != NULL; iter = iter->next) /* do a deep copy */ - dest->objects = g_list_append(dest->objects, getMemCopy (iter->data, sizeof (GdObject))); + dest->objects = list_append(dest->objects, getMemCopy (iter->data, sizeof (GdObject))); } /* copy replays */ if (src->replays) { - GList *iter; + List *iter; dest->replays = NULL; for (iter = src->replays; iter != NULL; iter = iter->next) /* do a deep copy */ - dest->replays = g_list_append(dest->replays, gd_replay_new_from_replay(iter->data)); + dest->replays = list_append(dest->replays, gd_replay_new_from_replay(iter->data)); } /* copy random number generator */ diff --git a/src/game_bd/bd_cave.h b/src/game_bd/bd_cave.h index f0421849..ca0721ef 100644 --- a/src/game_bd/bd_cave.h +++ b/src/game_bd/bd_cave.h @@ -380,8 +380,8 @@ typedef struct _gd_cave HashTable *tags; /* stores read-but-not-understood strings from bdcff, so we can save them later. */ GdElement **map; /* pointer to data for map, non-null if has a map */ - GList *objects; - GList *replays; + List *objects; + List *replays; boolean intermission; /* is this cave an intermission? */ boolean intermission_instantlife; /* one life extra, if the intermission is reached */ diff --git a/src/game_bd/bd_caveobject.c b/src/game_bd/bd_caveobject.c index 054235a9..d7617906 100644 --- a/src/game_bd/bd_caveobject.c +++ b/src/game_bd/bd_caveobject.c @@ -1321,7 +1321,7 @@ GdCave *gd_cave_new_rendered(const GdCave *data, const int level, const guint32 GdCave *cave; GdElement element; int x, y; - GList *iter; + List *iter; /* make a copy */ cave = gd_cave_new_from_cave(data); @@ -1425,7 +1425,7 @@ GdCave *gd_cave_new_rendered(const GdCave *data, const int level, const guint32 } /* render cave objects above random data or map */ - for (iter = data->objects; iter; iter = g_list_next(iter)) + for (iter = data->objects; iter; iter = list_next(iter)) { GdObject *object = (GdObject *)iter->data; @@ -1475,6 +1475,6 @@ void gd_flatten_cave(GdCave *cave, const int level) gd_cave_free(rendered); /* forget objects */ - g_list_foreach(cave->objects, (GFunc) free, NULL); + list_foreach(cave->objects, (list_fn) free, NULL); cave->objects = NULL; } diff --git a/src/game_bd/bd_caveset.c b/src/game_bd/bd_caveset.c index 40078e32..49b6e100 100644 --- a/src/game_bd/bd_caveset.c +++ b/src/game_bd/bd_caveset.c @@ -22,7 +22,7 @@ /* this stores the caves. */ -GList *gd_caveset; +List *gd_caveset; /* the data of the caveset: name, highscore, max number of lives, etc. */ GdCavesetData *gd_caveset_data; @@ -115,8 +115,8 @@ void gd_caveset_clear(void) { if (gd_caveset) { - g_list_foreach(gd_caveset, (GFunc) gd_cave_free, NULL); - g_list_free(gd_caveset); + list_foreach(gd_caveset, (list_fn) gd_cave_free, NULL); + list_free(gd_caveset); gd_caveset = NULL; } @@ -135,13 +135,13 @@ void gd_caveset_clear(void) /* return number of caves currently in memory. */ int gd_caveset_count(void) { - return g_list_length(gd_caveset); + return list_length(gd_caveset); } /* return index of first selectable cave */ static int caveset_first_selectable_cave_index(void) { - GList *iter; + List *iter; int i; for (i = 0, iter = gd_caveset; iter != NULL; i++, iter = iter->next) @@ -161,7 +161,7 @@ static int caveset_first_selectable_cave_index(void) /* return a cave identified by its index */ GdCave *gd_return_nth_cave(const int cave) { - return g_list_nth_data(gd_caveset, cave); + return list_nth_data(gd_caveset, cave); } /* get a selected cave from the loaded caveset (original, unmodified cave) */ @@ -469,7 +469,7 @@ static void brc_import(guint8 *data) /* append to caveset or forget it. */ if (!only_dirt) - gd_caveset = g_list_append(gd_caveset, cave); + gd_caveset = list_append(gd_caveset, cave); else gd_cave_free(cave); } @@ -508,7 +508,7 @@ boolean gd_caveset_load_from_file(char *filename) gsize length; char *buf; boolean read; - GList *new_caveset; + List *new_caveset; struct stat st; if (g_stat(filename, &st) != 0) @@ -606,7 +606,7 @@ boolean gd_caveset_load_from_file(char *filename) int gd_cave_check_replays(GdCave *cave, boolean report, boolean remove, boolean repair) { - GList *riter; + List *riter; int wrong = 0; riter = cave->replays; @@ -615,7 +615,7 @@ int gd_cave_check_replays(GdCave *cave, boolean report, boolean remove, boolean GdReplay *replay = (GdReplay *)riter->data; guint32 checksum; GdCave *rendered; - GList *next = riter->next; + List *next = riter->next; rendered = gd_cave_new_rendered(cave, replay->level, replay->seed); checksum = gd_cave_adler_checksum(rendered); @@ -646,7 +646,7 @@ int gd_cave_check_replays(GdCave *cave, boolean report, boolean remove, boolean if (remove) { /* may remove */ - cave->replays = g_list_remove_link(cave->replays, riter); + cave->replays = list_remove_link(cave->replays, riter); gd_replay_free(replay); } } @@ -661,7 +661,7 @@ int gd_cave_check_replays(GdCave *cave, boolean report, boolean remove, boolean boolean gd_caveset_has_replays(void) { - GList *citer; + List *citer; /* for all caves */ for (citer = gd_caveset; citer != NULL; citer = citer->next) diff --git a/src/game_bd/bd_caveset.h b/src/game_bd/bd_caveset.h index e5a5a7e6..f191b17b 100644 --- a/src/game_bd/bd_caveset.h +++ b/src/game_bd/bd_caveset.h @@ -52,7 +52,7 @@ typedef struct _gd_caveset_data extern const GdStructDescriptor gd_caveset_properties[]; extern GdCavesetData *gd_caveset_data; -extern GList *gd_caveset; +extern List *gd_caveset; extern boolean gd_caveset_edited; extern int gd_caveset_last_selected; extern int gd_caveset_last_selected_level; diff --git a/src/game_bd/main_bd.c b/src/game_bd/main_bd.c index d637acc8..68f0ec40 100644 --- a/src/game_bd/main_bd.c +++ b/src/game_bd/main_bd.c @@ -137,7 +137,7 @@ boolean LoadNativeLevel_BD(char *filename, int level_pos, boolean level_info_onl // check if this cave has any replays if (native_bd_level.cave->replays != NULL) { - GList *item = native_bd_level.cave->replays; + List *item = native_bd_level.cave->replays; // try to find replay that was recorded for this difficulty level while (item != NULL &&