From: Holger Schemel Date: Wed, 3 Oct 2018 22:34:49 +0000 (+0200) Subject: fixed problem when determining maximum word length in request text X-Git-Tag: 4.1.1.0~6 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=bfc32a480c54857e24987e9f38d12cd5139dde4b;p=rocksndiamonds.git fixed problem when determining maximum word length in request text --- diff --git a/src/libgame/text.c b/src/libgame/text.c index c7d8499b..0974481a 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -114,14 +114,16 @@ void getFontCharSource(int font_nr, char c, Bitmap **bitmap, int *x, int *y) /* text string helper functions */ /* ========================================================================= */ -int maxWordLengthInString(char *text) +int maxWordLengthInRequestString(char *text) { char *text_ptr; int word_len = 0, max_word_len = 0; for (text_ptr = text; *text_ptr; text_ptr++) { - word_len = (*text_ptr != ' ' ? word_len + 1 : 0); + word_len = (*text_ptr != ' ' && + *text_ptr != '?' && + *text_ptr != '!' ? word_len + 1 : 0); max_word_len = MAX(word_len, max_word_len); } diff --git a/src/libgame/text.h b/src/libgame/text.h index 0a45204e..cfc9e3f1 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -89,7 +89,7 @@ int getTextWidth(char *, int); void getFontCharSource(int, char, Bitmap **, int *, int *); -int maxWordLengthInString(char *); +int maxWordLengthInRequestString(char *); void DrawInitText(char *, int, int); diff --git a/src/tools.c b/src/tools.c index a49d312f..f89b2b25 100644 --- a/src/tools.c +++ b/src/tools.c @@ -4555,7 +4555,7 @@ static boolean RequestDoor(char *text, unsigned int req_state) int result; int ty; - if (maxWordLengthInString(text) > MAX_REQUEST_LINE_FONT1_LEN) + if (maxWordLengthInRequestString(text) > MAX_REQUEST_LINE_FONT1_LEN) { max_request_line_len = MAX_REQUEST_LINE_FONT2_LEN; font_nr = FONT_TEXT_1;