added warnings for undefined element and graphic names in custom artwork
[rocksndiamonds.git] / src / init.c
index 8aef3415c1fc7c9c092d20b6d7cd6e301c9e801e..f431f5b88fe49b818687a01e085aaf6e40d15c87 100644 (file)
@@ -953,13 +953,36 @@ static int get_graphic_parameter_value(char *value_raw, char *suffix, int type)
   {
     char *value = getHashEntry(element_token_hash, value_raw);
 
+    if (value == NULL)
+    {
+      Error(ERR_INFO_LINE, "-");
+      Error(ERR_INFO, "warning: error found in config file:");
+      Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
+      Error(ERR_INFO, "error: invalid element token '%s'", value_raw);
+      Error(ERR_INFO, "custom graphic rejected for this element/action");
+      Error(ERR_INFO, "fallback done to undefined element for this graphic");
+      Error(ERR_INFO_LINE, "-");
+    }
+
     return (value != NULL ? atoi(value) : EL_UNDEFINED);
   }
   else if (type == TYPE_GRAPHIC)
   {
     char *value = getHashEntry(graphic_token_hash, value_raw);
+    int fallback_graphic = IMG_CHAR_EXCLAM;
 
-    return (value != NULL ? atoi(value) : IMG_UNDEFINED);
+    if (value == NULL)
+    {
+      Error(ERR_INFO_LINE, "-");
+      Error(ERR_INFO, "warning: error found in config file:");
+      Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
+      Error(ERR_INFO, "error: invalid graphic token '%s'", value_raw);
+      Error(ERR_INFO, "custom graphic rejected for this element/action");
+      Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
+      Error(ERR_INFO_LINE, "-");
+    }
+
+    return (value != NULL ? atoi(value) : fallback_graphic);
   }
 
   return -1;
@@ -1315,7 +1338,7 @@ static void set_cloned_graphic_parameters(int graphic)
     Error(ERR_INFO, "custom graphic rejected for this element/action");
 
     if (graphic == fallback_graphic)
-      Error(ERR_EXIT, "fatal error: no fallback graphic available");
+      Error(ERR_EXIT, "no fallback graphic available");
 
     Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
     Error(ERR_INFO_LINE, "-");
@@ -1461,7 +1484,7 @@ static void InitGraphicInfo()
       Error(ERR_INFO, "custom graphic rejected for this element/action");
 
       if (i == fallback_graphic)
-       Error(ERR_EXIT, "fatal error: no fallback graphic available");
+       Error(ERR_EXIT, "no fallback graphic available");
 
       Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
       Error(ERR_INFO_LINE, "-");
@@ -1490,7 +1513,7 @@ static void InitGraphicInfo()
       Error(ERR_INFO, "custom graphic rejected for this element/action");
 
       if (i == fallback_graphic)
-       Error(ERR_EXIT, "fatal error: no fallback graphic available");
+       Error(ERR_EXIT, "no fallback graphic available");
 
       Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
       Error(ERR_INFO_LINE, "-");
@@ -5576,6 +5599,9 @@ void DisplayExitMessage(char *format, va_list ap)
 
   redraw_mask = REDRAW_ALL;
 
+  /* force drawing exit message even if screen updates are currently limited */
+  LimitScreenUpdates(FALSE);
+
   BackToFront();
 
   /* deactivate toons on error message screen */