From: Holger Schemel Date: Wed, 22 Oct 2014 22:03:02 +0000 (+0200) Subject: added warnings for undefined element and graphic names in custom artwork X-Git-Tag: 4.0.0.0-rc1~323 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=c4ee7a7b7a3f7184e210895b21c811680eaf8e4d;p=rocksndiamonds.git added warnings for undefined element and graphic names in custom artwork --- diff --git a/ChangeLog b/ChangeLog index cab54d53..cb8b519f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-10-22 + * added warnings when using undefined element and graphic names in + custom artwork definitions (like ".crumbled_like" or ".clone_from") + 2014-10-20 * fixed using buttons on main screen with size other than 32x32 pixels * fixed some initialization bugs for scrollbars and main screen buttons diff --git a/src/conftime.h b/src/conftime.h index 97a2de1a..68a8d305 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2014-10-21 01:20" +#define COMPILE_DATE_STRING "2014-10-22 23:54" diff --git a/src/init.c b/src/init.c index 39f5c347..f431f5b8 100644 --- a/src/init.c +++ b/src/init.c @@ -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; + + 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) : IMG_UNDEFINED); + return (value != NULL ? atoi(value) : fallback_graphic); } return -1;