X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsetup.c;h=05978dd4a967e86f1d2eaf8ed6e1b8397737a324;hb=74c0f7de91268e40d15948f473eac51a9760b9c0;hp=00168642fb95fb9665f46805699c6194a560f7ea;hpb=891c39ca37c4fea5f6cc4ca40f913a56c68ef495;p=rocksndiamonds.git diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 00168642..05978dd4 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -417,14 +417,26 @@ char *getEditorSetupFilename() return filename; } -char *getElementInfoFilename() +char *getHelpAnimFilename() { static char *filename = NULL; if (filename != NULL) free(filename); - filename = getPath2(getCurrentLevelDir(), ELEMENTINFO_FILENAME); + filename = getPath2(getCurrentLevelDir(), HELPANIM_FILENAME); + + return filename; +} + +char *getHelpTextFilename() +{ + static char *filename = NULL; + + if (filename != NULL) + free(filename); + + filename = getPath2(getCurrentLevelDir(), HELPTEXT_FILENAME); return filename; } @@ -898,7 +910,7 @@ void dumpTreeInfo(TreeInfo *node, int depth) while (node) { - for (i=0; i<(depth + 1) * 3; i++) + for (i = 0; i < (depth + 1) * 3; i++) printf(" "); #if 1 @@ -944,7 +956,7 @@ void sortTreeInfo(TreeInfo **node_first, compare_function); /* update the linkage of list elements with the sorted node array */ - for (i=0; inext = sort_array[i + 1]; sort_array[num_nodes - 1]->next = NULL; @@ -1168,7 +1180,7 @@ char *getFormattedSetupEntry(char *token, char *value) /* start with the token and some spaces to format output line */ sprintf(entry, "%s:", token); - for (i=strlen(entry); i= line; line_ptr--) + if ((*line_ptr == '\n' || *line_ptr == '\r') && *(line_ptr + 1) == '\0') + *line_ptr = '\0'; + + if (read_continued_line) + { + /* cut leading whitespaces from input line */ + for (line_ptr = line; *line_ptr; line_ptr++) + if (*line_ptr != ' ' && *line_ptr != '\t') + break; + + /* append new line to existing line, if there is enough space */ + if (strlen(previous_line) + strlen(line_ptr) < MAX_LINE_LEN) + strcat(previous_line, line_ptr); + + strcpy(line, previous_line); /* copy storage buffer to line */ + + read_continued_line = FALSE; + } + + /* if the last character is '\', continue at next line */ + if (strlen(line) > 0 && line[strlen(line) - 1] == '\\') + { + line[strlen(line) - 1] = '\0'; /* cut off trailing backslash */ + strcpy(previous_line, line); /* copy line to storage buffer */ + + read_continued_line = TRUE; + + continue; + } + + /* cut trailing comment from input line */ for (line_ptr = line; *line_ptr; line_ptr++) { - if (*line_ptr == '#' || *line_ptr == '\n' || *line_ptr == '\r') + if (*line_ptr == '#') { *line_ptr = '\0'; break; @@ -1397,8 +1442,8 @@ static void *loadSetupFileData(char *filename, boolean use_hash) } /* cut trailing whitespaces from input line */ - for (line_ptr = &line[strlen(line)]; line_ptr > line; line_ptr--) - if ((*line_ptr == ' ' || *line_ptr == '\t') && line_ptr[1] == '\0') + for (line_ptr = &line[strlen(line)]; line_ptr >= line; line_ptr--) + if ((*line_ptr == ' ' || *line_ptr == '\t') && *(line_ptr + 1) == '\0') *line_ptr = '\0'; /* ignore empty lines */ @@ -1886,7 +1931,7 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, /* set all structure fields according to the token/value pairs */ ldi = *leveldir_new; - for (i=0; i