char *token, *value, *line_ptr;
void *setup_file_data, *insert_ptr = NULL;
boolean read_continued_line = FALSE;
+ boolean token_value_separator_found;
+#if 1
+ boolean token_value_separator_warning = FALSE;
+#endif
FILE *file;
if (!(file = fopen(filename, MODE_READ)))
/* start with empty value as reliable default */
value = "";
+ token_value_separator_found = FALSE;
+
/* find end of token to determine start of value */
for (line_ptr = token; *line_ptr; line_ptr++)
{
*line_ptr = '\0'; /* terminate token string */
value = line_ptr + 1; /* set beginning of value */
+ token_value_separator_found = TRUE;
+
break;
}
}
+#if 1
+ /* fallback: if no token/value separator found, also allow whitespaces */
+ if (!token_value_separator_found)
+ {
+ for (line_ptr = token; *line_ptr; line_ptr++)
+ {
+ if (*line_ptr == ' ' || *line_ptr == '\t')
+ {
+ *line_ptr = '\0'; /* terminate token string */
+ value = line_ptr + 1; /* set beginning of value */
+
+ token_value_separator_found = TRUE;
+
+ break;
+ }
+ }
+
+#if 1
+ if (token_value_separator_found)
+ {
+ if (!token_value_separator_warning)
+ {
+ Error(ERR_RETURN_LINE, "-");
+ Error(ERR_WARN, "no valid token/value separator in config file:");
+ Error(ERR_RETURN, "- config file: '%s'", filename);
+
+ token_value_separator_warning = TRUE;
+ }
+
+ Error(ERR_RETURN, "- no separator in line: '%s'", line);
+ }
+#endif
+ }
+#endif
+
/* cut trailing whitespaces from token */
for (line_ptr = &token[strlen(token)]; line_ptr >= token; line_ptr--)
if ((*line_ptr == ' ' || *line_ptr == '\t') && *(line_ptr + 1) == '\0')
fclose(file);
+#if 1
+ if (token_value_separator_warning)
+ Error(ERR_RETURN_LINE, "-");
+#endif
+
if (use_hash)
{
if (hashtable_count((SetupFileHash *)setup_file_data) == 0)
if (value == NULL)
{
#if 1
- printf("::: - WARNING: cache entry '%s' invalid\n", token);
+ Error(ERR_WARN, "cache entry '%s' invalid", token);
#endif
cached = FALSE;
char *level_directory,
char *directory_name)
{
+ static unsigned long progress_delay = 0;
+ unsigned long progress_delay_value = 100; /* (in milliseconds) */
char *directory_path = getPath2(level_directory, directory_name);
char *filename = getPath2(directory_path, LEVELINFO_FILENAME);
SetupFileHash *setup_file_hash;
leveldir_new->last_level : leveldir_new->first_level);
#if 1
- if (leveldir_new->level_group)
+ if (leveldir_new->level_group ||
+ DelayReached(&progress_delay, progress_delay_value))
DrawInitText(leveldir_new->name, 150, FC_YELLOW);
#else
DrawInitText(leveldir_new->name, 150, FC_YELLOW);
void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node,
LevelDirTree *level_node)
{
+ static unsigned long progress_delay = 0;
+ unsigned long progress_delay_value = 100; /* (in milliseconds) */
int type = (*artwork_node)->type;
/* recursively check all level directories for artwork sub-directories */
}
#if 1
- if (level_node->level_group)
+ if (level_node->level_group ||
+ DelayReached(&progress_delay, progress_delay_value))
DrawInitText(level_node->name, 150, FC_YELLOW);
#endif