X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=25df21ca234f94b882d895c1b59c2ffd32efff84;hb=9233f6cfc90e72b7cc168c570fdd2e545f698674;hp=7a780511fde0a6743c6c00c74cede00d30dde723;hpb=5c94351c5b8a12d8615b447b6275dd2f68615be4;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 7a780511..25df21ca 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -584,6 +584,14 @@ boolean strEqual(char *s1, char *s2) strcmp(s1, s2) == 0); } +boolean strEqualN(char *s1, char *s2, int n) +{ + return (s1 == NULL && s2 == NULL ? TRUE : + s1 == NULL && s2 != NULL ? FALSE : + s1 != NULL && s2 == NULL ? FALSE : + strncmp(s1, s2, n) == 0); +} + /* ------------------------------------------------------------------------- */ /* command line option handling functions */ @@ -1829,7 +1837,7 @@ int get_parameter_value(char *value_raw, char *suffix, int type) string_has_parameter(value, "crossfade") ? FADE_MODE_CROSSFADE : FADE_MODE_DEFAULT); } - else if (strEqual(suffix, ".font")) + else if (strEqualN(suffix, ".font", 5)) /* (may also be ".font_xyz") */ { result = gfx.get_font_from_token_function(value); }