X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=dcef9e26dc253956421beea98ab050e15eb7f55d;hb=c6b89ec21b03182c40ae2eda40d861c09f179daf;hp=cb5e0661f67ca81ba7436e657e8b7ef9d2c3f4bd;hpb=eb09b9aa5521e286723c668030825cd0e3470c3c;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index cb5e0661..dcef9e26 100644 --- a/src/init.c +++ b/src/init.c @@ -183,6 +183,19 @@ static int getFontBitmapID(int font_nr) return font_nr; } +static int getFontFromToken(char *token) +{ + int i; + + /* !!! OPTIMIZE THIS BY USING HASH !!! */ + for (i = 0; i < NUM_FONTS; i++) + if (strEqual(token, font_info[i].token_name)) + return i; + + /* if font not found, use reliable default value */ + return FONT_INITIAL_1; +} + void InitFontGraphicInfo() { static struct FontBitmapInfo *font_bitmap_info = NULL; @@ -193,7 +206,8 @@ void InitFontGraphicInfo() if (graphic_info == NULL) /* still at startup phase */ { - InitFontInfo(font_initial, NUM_INITIAL_FONTS, getFontBitmapID); + InitFontInfo(font_initial, NUM_INITIAL_FONTS, + getFontBitmapID, getFontFromToken); return; } @@ -412,7 +426,8 @@ void InitFontGraphicInfo() } } - InitFontInfo(font_bitmap_info, num_font_bitmaps, getFontBitmapID); + InitFontInfo(font_bitmap_info, num_font_bitmaps, + getFontBitmapID, getFontFromToken); } void InitElementGraphicInfo()