X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_bd%2Fbd_bdcff.c;h=a620fbc5a2f2c8e94b7187a916bcd054cad3be2d;hb=96626a07ae084d613fd85fa9eb87fd8b3495af59;hp=9972b7f2b9a4e0309002690d4ede7cccc2aa9da7;hpb=ec529b5df69b376a1d55e38862975b7d9a26ea97;p=rocksndiamonds.git diff --git a/src/game_bd/bd_bdcff.c b/src/game_bd/bd_bdcff.c index 9972b7f2..a620fbc5 100644 --- a/src/game_bd/bd_bdcff.c +++ b/src/game_bd/bd_bdcff.c @@ -107,17 +107,17 @@ static boolean attrib_is_valid_for_cave(const char *attrib) int i; /* bdcff engine flag............ */ - if (strcasecmp(attrib, "Engine")==0) + if (strcasecmp(attrib, "Engine") == 0) return TRUE; /* old flags - for compatibility */ - if (strcasecmp(attrib, "BD1Scheduling")==0) + if (strcasecmp(attrib, "BD1Scheduling") == 0) return TRUE; - if (strcasecmp(attrib, "SnapExplosions")==0) + if (strcasecmp(attrib, "SnapExplosions") == 0) return TRUE; - if (strcasecmp(attrib, "AmoebaProperties")==0) + if (strcasecmp(attrib, "AmoebaProperties") == 0) return TRUE; /* search in property database */ @@ -151,7 +151,7 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_ boolean was_string; params = getSplitStringArray(param, " ", -1); - paramcount = g_strv_length(params); + paramcount = getStringArrayLength(params); identifier_found = FALSE; /* check all known tags. do not exit this loop if identifier_found == true... @@ -188,12 +188,10 @@ static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_ if (prop_desc[i].type == GD_TYPE_LONGSTRING) { - GString *str = *(GString **)value; - char *compressed; + char **str = (char **)value; - compressed = g_strcompress(param); - g_string_assign(str, compressed); - free(compressed); + checked_free(*str); + *str = getUnescapedString(param); /* remember this to skip checking the number of parameters at the end of the function */ was_string = TRUE; @@ -495,7 +493,7 @@ static void cave_report_and_copy_unknown_tags_func(char *attrib, char *param, gp Warn("unknown tag '%s'", attrib); - g_hash_table_insert(cave->tags, g_strdup(attrib), g_strdup(param)); + g_hash_table_insert(cave->tags, getStringCopy(attrib), getStringCopy(param)); } /* having read all strings belonging to the cave, process it. */ @@ -676,7 +674,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) default_cave = gd_cave_new(); cave = default_cave; - linenum = g_strv_length(lines); + linenum = getStringArrayLength(lines); for (lineno = 0; lineno < linenum; lineno++) { @@ -958,7 +956,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) /* own tag: not too much thinking :P */ if (reading_replay) { - g_hash_table_insert(replay_tags, g_strdup(attrib), g_strdup(param)); + g_hash_table_insert(replay_tags, getStringCopy(attrib), getStringCopy(param)); } else if (reading_mapcodes) { @@ -1051,7 +1049,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) params = getSplitStringArray(param, " ", -1); /* an effect command has two parameters */ - if (g_strv_length(params) == 2) + if (getStringArrayLength(params) == 2) { int i; @@ -1113,7 +1111,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) { /* it must be a default setting for all caves. is it a valid identifier? */ /* yes, it is. add to the hash table, which will be copied for all caves. */ - g_hash_table_insert(tags, g_strdup(attrib), g_strdup(param)); + g_hash_table_insert(tags, getStringCopy(attrib), getStringCopy(param)); } else /* unknown setting - report. */ @@ -1124,7 +1122,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) /* we are reading a [cave] */ /* cave settings are immediately added to cave hash table. */ /* if it is unknown, we have to remember it, and save it again. */ - g_hash_table_insert(tags, g_strdup(attrib), g_strdup(param)); + g_hash_table_insert(tags, getStringCopy(attrib), getStringCopy(param)); } }