From 554d6bc944c7d05ffeb1436c55932a74d2eac1d8 Mon Sep 17 00:00:00 2001 From: avolkov Date: Fri, 29 Aug 2003 02:58:45 +0000 Subject: [PATCH] Fixes counter overflow in lander reports; (MORE) is always printed when necessary. Bug #448 git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1141 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/planets/report.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sc2/src/sc2code/planets/report.c b/sc2/src/sc2code/planets/report.c index af6eb165f..f118a65fd 100644 --- a/sc2/src/sc2code/planets/report.c +++ b/sc2/src/sc2code/planets/report.c @@ -102,11 +102,22 @@ MakeReport (SOUND ReadOutSounds, UNICODE *pStr, COUNT StrLen) { COUNT col_cells; UNICODE *pLastStr; + UNICODE *pTempStr; + COUNT lf_pos; pLastStr = t.pStr; + // scan for LFs in the remaining string + // trailing LF will be ignored + for (lf_pos = StrLen, pTempStr = t.pStr; + lf_pos && *pTempStr != '\n'; + --lf_pos, ++pTempStr) + ; + col_cells = 0; - if (row_cells == NUM_CELL_ROWS - 1 && StrLen > NUM_CELL_COLS) + // check if the remaining text fits on current screen + if (row_cells == NUM_CELL_ROWS - 1 + && (StrLen > NUM_CELL_COLS || lf_pos > 1)) { col_cells = (NUM_CELL_COLS >> 1) - (end_page_len >> 1); t.pStr = end_page_buf;