diff --git a/xwords4/common/model.c b/xwords4/common/model.c index 8aeb265eb..2bcb06c38 100644 --- a/xwords4/common/model.c +++ b/xwords4/common/model.c @@ -1,6 +1,6 @@ /* -*- compile-command: "cd ../linux && make -j3 MEMDEBUG=TRUE"; -*- */ /* - * Copyright 2000 - 2017 by Eric House (xwords@eehouse.org). All rights + * Copyright 2000 - 2022 by Eric House (xwords@eehouse.org). All rights * reserved. * * This program is free software; you can redistribute it and/or @@ -1124,17 +1124,16 @@ model_undoLatestMoves( ModelCtxt* model, XWEnv xwe, PoolContext* pool, } /* model_undoLatestMoves */ void -model_trayToStream( ModelCtxt* model, XP_S16 turn, XWStreamCtxt* stream ) +model_trayToStream( const ModelCtxt* model, XP_S16 turn, XWStreamCtxt* stream ) { - PlayerCtxt* player; XP_ASSERT( turn >= 0 ); - player = &model->players[turn]; + const PlayerCtxt* player = &model->players[turn]; traySetToStream( stream, &player->trayTiles ); } /* model_trayToStream */ void -model_currentMoveToMoveInfo( ModelCtxt* model, XP_S16 turn, +model_currentMoveToMoveInfo( const ModelCtxt* model, XP_S16 turn, MoveInfo* moveInfo ) { XP_ASSERT( turn >= 0 ); @@ -1178,7 +1177,7 @@ model_currentMoveToMoveInfo( ModelCtxt* model, XP_S16 turn, } void -model_currentMoveToStream( ModelCtxt* model, XP_S16 turn, +model_currentMoveToStream( const ModelCtxt* model, XP_S16 turn, XWStreamCtxt* stream ) { #ifdef STREAM_VERS_BIGBOARD @@ -1431,22 +1430,20 @@ model_getCurrentMoveIsVertical( const ModelCtxt* model, XP_S16 turn, } void -model_getCurrentMoveTile( ModelCtxt* model, XP_S16 turn, XP_S16* index, +model_getCurrentMoveTile( const ModelCtxt* model, XP_S16 turn, XP_S16* index, Tile* tile, XP_U16* col, XP_U16* row, XP_Bool* isBlank ) { - PlayerCtxt* player; - PendingTile* pt; XP_ASSERT( turn >= 0 ); - player = &model->players[turn]; + const PlayerCtxt* player = &model->players[turn]; XP_ASSERT( *index < player->nPending ); if ( *index < 0 ) { *index = player->nPending - 1; } - pt = &player->pendingTiles[*index]; + const PendingTile* pt = &player->pendingTiles[*index]; *col = pt->col; *row = pt->row; diff --git a/xwords4/common/model.h b/xwords4/common/model.h index bc40ef157..1058d56f4 100644 --- a/xwords4/common/model.h +++ b/xwords4/common/model.h @@ -166,7 +166,7 @@ XP_U16 model_getCurrentMoveCount( const ModelCtxt* model, XP_S16 turn ); XP_Bool model_getCurrentMoveIsVertical( const ModelCtxt* model, XP_S16 turn, XP_Bool* isHorizontal ); -void model_getCurrentMoveTile( ModelCtxt* model, XP_S16 turn, XP_S16* index, +void model_getCurrentMoveTile( const ModelCtxt* model, XP_S16 turn, XP_S16* index, Tile* tile, XP_U16* col, XP_U16* row, XP_Bool* isBlank ); @@ -193,11 +193,11 @@ XP_Bool model_undoLatestMoves( ModelCtxt* model, XWEnv xwe, PoolContext* pool, void model_rejectPreviousMove( ModelCtxt* model, XWEnv xwe, PoolContext* pool, XP_U16* turn ); -void model_trayToStream( ModelCtxt* model, XP_S16 turn, +void model_trayToStream( const ModelCtxt* model, XP_S16 turn, XWStreamCtxt* stream ); -void model_currentMoveToStream( ModelCtxt* model, XP_S16 turn, +void model_currentMoveToStream( const ModelCtxt* model, XP_S16 turn, XWStreamCtxt* stream ); -void model_currentMoveToMoveInfo( ModelCtxt* model, XP_S16 turn, +void model_currentMoveToMoveInfo( const ModelCtxt* model, XP_S16 turn, MoveInfo* moveInfo ); XP_Bool model_makeTurnFromStream( ModelCtxt* model, XWEnv xwe, XP_U16 playerNum, XWStreamCtxt* stream );