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.
This commit is contained in:
Andy2 2011-11-14 20:18:09 -08:00
parent 86d5778ec3
commit 379e5f1d96

View file

@ -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;
}
}