+static void set_cloned_graphic_parameters(int graphic)
+{
+ int fallback_graphic = IMG_CHAR_EXCLAM;
+ int max_num_images = getImageListSize();
+ int clone_graphic = graphic_info[graphic].clone_from;
+ int num_references_followed = 1;
+
+ while (graphic_info[clone_graphic].clone_from != -1 &&
+ num_references_followed < max_num_images)
+ {
+ clone_graphic = graphic_info[clone_graphic].clone_from;
+
+ num_references_followed++;
+ }
+
+ if (num_references_followed >= max_num_images)
+ {
+ Error(ERR_RETURN_LINE, "-");
+ Error(ERR_RETURN, "warning: error found in config file:");
+ Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename());
+ Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(graphic));
+ Error(ERR_RETURN, "error: loop discovered when resolving cloned graphics");
+ Error(ERR_RETURN, "custom graphic rejected for this element/action");
+
+ if (graphic == fallback_graphic)
+ Error(ERR_EXIT, "fatal error: no fallback graphic available");
+
+ Error(ERR_RETURN, "fallback done to 'char_exclam' for this graphic");
+ Error(ERR_RETURN_LINE, "-");
+
+ set_graphic_parameters(graphic, fallback_graphic);
+ }
+ else
+ {
+ graphic_info[graphic] = graphic_info[clone_graphic];
+ graphic_info[graphic].clone_from = clone_graphic;
+
+#if 0
+ printf("::: graphic %d ['%s'] is cloned from %d ['%s']\n",
+ i, getTokenFromImageID(i),
+ clone_graphic, getTokenFromImageID(clone_graphic));
+#endif
+ }
+}
+