From 379e5f1d96837e00bf08ae92e04f240ecbb95807 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Mon, 14 Nov 2011 20:18:09 -0800 Subject: [PATCH] use actual rather than max possible board dimensions to apportion space, fixing crashes when max upped to 32. Will still fail as actual size approaches that number. --- xwords4/linux/cursesmain.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index 798236efe..11af9250b 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -1569,15 +1569,16 @@ positionSizeStuff( CursesAppGlobals* globals, int width, int height ) XP_U16 cellWidth, cellHt, scoreLeft, scoreWidth; BoardCtxt* board = globals->cGlobals.game.board; int remWidth = width; + int nRows = globals->cGlobals.params->gi.boardSize; cellWidth = CURSES_CELL_WIDTH; cellHt = CURSES_CELL_HT; board_setPos( board, BOARD_OFFSET, BOARD_OFFSET, - cellWidth * MAX_COLS, cellHt * MAX_ROWS, + cellWidth * nRows, cellHt * nRows, cellWidth, XP_FALSE ); /* board_setScale( board, cellWidth, cellHt ); */ - scoreLeft = (cellWidth * MAX_COLS);// + BOARD_SCORE_PADDING; - remWidth -= cellWidth * MAX_COLS; + scoreLeft = (cellWidth * nRows);// + BOARD_SCORE_PADDING; + remWidth -= cellWidth * nRows; /* If the scoreboard will right of the board, put it there. Otherwise try to fit it below the boards. */ @@ -1591,8 +1592,9 @@ positionSizeStuff( CursesAppGlobals* globals, int width, int height ) trayTop = 8; } else { trayLeft = BOARD_OFFSET; - trayTop = BOARD_OFFSET + (cellHt * MAX_ROWS); + trayTop = BOARD_OFFSET + (cellHt * nRows); if ( trayTop + trayHt > height ) { + XP_ASSERT( height > trayTop ); trayHt = height - trayTop; } }