mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
use const where possible for game_writeToStream and others it calls.
No other code changes.
This commit is contained in:
parent
2a728ce4b0
commit
f51c0b39e6
8 changed files with 26 additions and 25 deletions
|
@ -288,7 +288,7 @@ board_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
|
||||||
} /* board_makeFromStream */
|
} /* board_makeFromStream */
|
||||||
|
|
||||||
void
|
void
|
||||||
board_writeToStream( BoardCtxt* board, XWStreamCtxt* stream )
|
board_writeToStream( const BoardCtxt* board, XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
XP_U16 nPlayers, ii;
|
XP_U16 nPlayers, ii;
|
||||||
XP_U16 nColsNBits;
|
XP_U16 nColsNBits;
|
||||||
|
@ -319,8 +319,8 @@ board_writeToStream( BoardCtxt* board, XWStreamCtxt* stream )
|
||||||
nPlayers = board->gi->nPlayers;
|
nPlayers = board->gi->nPlayers;
|
||||||
|
|
||||||
for ( ii = 0; ii < nPlayers; ++ii ) {
|
for ( ii = 0; ii < nPlayers; ++ii ) {
|
||||||
PerTurnInfo* pti = &board->pti[ii];
|
const PerTurnInfo* pti = &board->pti[ii];
|
||||||
BoardArrow* arrow = &pti->boardArrow;
|
const BoardArrow* arrow = &pti->boardArrow;
|
||||||
stream_putBits( stream, nColsNBits, arrow->col );
|
stream_putBits( stream, nColsNBits, arrow->col );
|
||||||
stream_putBits( stream, nColsNBits, arrow->row );
|
stream_putBits( stream, nColsNBits, arrow->row );
|
||||||
stream_putBits( stream, 1, arrow->vert );
|
stream_putBits( stream, 1, arrow->vert );
|
||||||
|
|
|
@ -67,7 +67,7 @@ BoardCtxt* board_makeFromStream( MPFORMAL XWStreamCtxt* stream,
|
||||||
|
|
||||||
void board_destroy( BoardCtxt* board );
|
void board_destroy( BoardCtxt* board );
|
||||||
|
|
||||||
void board_writeToStream( BoardCtxt* board, XWStreamCtxt* stream );
|
void board_writeToStream( const BoardCtxt* board, XWStreamCtxt* stream );
|
||||||
|
|
||||||
void board_setPos( BoardCtxt* board, XP_U16 left, XP_U16 top,
|
void board_setPos( BoardCtxt* board, XP_U16 left, XP_U16 top,
|
||||||
XP_U16 width, XP_U16 height, XP_U16 maxCellSize,
|
XP_U16 width, XP_U16 height, XP_U16 maxCellSize,
|
||||||
|
|
|
@ -333,7 +333,7 @@ mem_stream_close( XWStreamCtxt* p_sctx )
|
||||||
static XP_U16
|
static XP_U16
|
||||||
mem_stream_getSize( const XWStreamCtxt* p_sctx )
|
mem_stream_getSize( const XWStreamCtxt* p_sctx )
|
||||||
{
|
{
|
||||||
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
|
const MemStreamCtxt* stream = (const MemStreamCtxt*)p_sctx;
|
||||||
XP_U16 size = stream->nBytesWritten - stream->curReadPos;
|
XP_U16 size = stream->nBytesWritten - stream->curReadPos;
|
||||||
return size;
|
return size;
|
||||||
} /* mem_stream_getSize */
|
} /* mem_stream_getSize */
|
||||||
|
@ -341,14 +341,14 @@ mem_stream_getSize( const XWStreamCtxt* p_sctx )
|
||||||
static const XP_U8*
|
static const XP_U8*
|
||||||
mem_stream_getPtr( const XWStreamCtxt* p_sctx )
|
mem_stream_getPtr( const XWStreamCtxt* p_sctx )
|
||||||
{
|
{
|
||||||
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
|
const MemStreamCtxt* stream = (const MemStreamCtxt*)p_sctx;
|
||||||
return stream->buf;
|
return stream->buf;
|
||||||
} /* mem_stream_getPtr */
|
} /* mem_stream_getPtr */
|
||||||
|
|
||||||
static XP_PlayerAddr
|
static XP_PlayerAddr
|
||||||
mem_stream_getAddress( XWStreamCtxt* p_sctx )
|
mem_stream_getAddress( const XWStreamCtxt* p_sctx )
|
||||||
{
|
{
|
||||||
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
|
const MemStreamCtxt* stream = (const MemStreamCtxt*)p_sctx;
|
||||||
return stream->channelNo;
|
return stream->channelNo;
|
||||||
} /* mem_stream_getAddress */
|
} /* mem_stream_getAddress */
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ mem_stream_setAddress( XWStreamCtxt* p_sctx, XP_PlayerAddr channelNo )
|
||||||
{
|
{
|
||||||
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
|
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
|
||||||
stream->channelNo = channelNo;
|
stream->channelNo = channelNo;
|
||||||
} /* mem_stream_getAddress */
|
} /* mem_stream_setAddress */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mem_stream_setVersion( XWStreamCtxt* p_sctx, XP_U16 vers )
|
mem_stream_setVersion( XWStreamCtxt* p_sctx, XP_U16 vers )
|
||||||
|
@ -367,9 +367,9 @@ mem_stream_setVersion( XWStreamCtxt* p_sctx, XP_U16 vers )
|
||||||
} /* mem_stream_setVersion */
|
} /* mem_stream_setVersion */
|
||||||
|
|
||||||
static XP_U16
|
static XP_U16
|
||||||
mem_stream_getVersion( XWStreamCtxt* p_sctx )
|
mem_stream_getVersion( const XWStreamCtxt* p_sctx )
|
||||||
{
|
{
|
||||||
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
|
const MemStreamCtxt* stream = (const MemStreamCtxt*)p_sctx;
|
||||||
return stream->version;
|
return stream->version;
|
||||||
} /* mem_stream_getVersion */
|
} /* mem_stream_getVersion */
|
||||||
|
|
||||||
|
@ -381,10 +381,10 @@ mem_stream_setOnCloseProc( XWStreamCtxt* p_sctx, MemStreamCloseCallback proc )
|
||||||
}
|
}
|
||||||
|
|
||||||
static XWStreamPos
|
static XWStreamPos
|
||||||
mem_stream_getPos( XWStreamCtxt* p_sctx, PosWhich which )
|
mem_stream_getPos( const XWStreamCtxt* p_sctx, PosWhich which )
|
||||||
{
|
{
|
||||||
XWStreamPos result;
|
XWStreamPos result;
|
||||||
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
|
const MemStreamCtxt* stream = (const MemStreamCtxt*)p_sctx;
|
||||||
|
|
||||||
if ( which == POS_WRITE ) {
|
if ( which == POS_WRITE ) {
|
||||||
result = (stream->curWritePos << 3) | stream->nWriteBits;
|
result = (stream->curWritePos << 3) | stream->nWriteBits;
|
||||||
|
|
|
@ -74,7 +74,7 @@ static void setPendingCounts( ModelCtxt* model, XP_S16 turn );
|
||||||
static void loadPlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
static void loadPlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
||||||
XP_U16 version, PlayerCtxt* pc );
|
XP_U16 version, PlayerCtxt* pc );
|
||||||
static void writePlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
static void writePlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
||||||
PlayerCtxt* pc );
|
const PlayerCtxt* pc );
|
||||||
static XP_U16 model_getRecentPassCount( ModelCtxt* model );
|
static XP_U16 model_getRecentPassCount( ModelCtxt* model );
|
||||||
static XP_Bool recordWord( const XP_UCHAR* word, XP_Bool isLegal,
|
static XP_Bool recordWord( const XP_UCHAR* word, XP_Bool isLegal,
|
||||||
#ifdef XWFEATURE_BOARDWORDS
|
#ifdef XWFEATURE_BOARDWORDS
|
||||||
|
@ -179,7 +179,7 @@ model_makeFromStream( MPFORMAL XWStreamCtxt* stream, DictionaryCtxt* dict,
|
||||||
} /* model_makeFromStream */
|
} /* model_makeFromStream */
|
||||||
|
|
||||||
void
|
void
|
||||||
model_writeToStream( ModelCtxt* model, XWStreamCtxt* stream )
|
model_writeToStream( const ModelCtxt* model, XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
XP_U16 ii;
|
XP_U16 ii;
|
||||||
#ifdef STREAM_VERS_BIGBOARD
|
#ifdef STREAM_VERS_BIGBOARD
|
||||||
|
@ -2376,10 +2376,11 @@ loadPlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream, XP_U16 version,
|
||||||
} /* loadPlayerCtxt */
|
} /* loadPlayerCtxt */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
writePlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream, PlayerCtxt* pc )
|
writePlayerCtxt( const ModelCtxt* model, XWStreamCtxt* stream,
|
||||||
|
const PlayerCtxt* pc )
|
||||||
{
|
{
|
||||||
XP_U16 nTiles;
|
XP_U16 nTiles;
|
||||||
PendingTile* pt;
|
const PendingTile* pt;
|
||||||
XP_U16 nColsNBits;
|
XP_U16 nColsNBits;
|
||||||
#ifdef STREAM_VERS_BIGBOARD
|
#ifdef STREAM_VERS_BIGBOARD
|
||||||
nColsNBits = 16 <= model_numCols( model ) ? NUMCOLS_NBITS_5
|
nColsNBits = 16 <= model_numCols( model ) ? NUMCOLS_NBITS_5
|
||||||
|
|
|
@ -106,7 +106,7 @@ ModelCtxt* model_makeFromStream( MPFORMAL XWStreamCtxt* stream,
|
||||||
DictionaryCtxt* dict, const PlayerDicts* dicts,
|
DictionaryCtxt* dict, const PlayerDicts* dicts,
|
||||||
XW_UtilCtxt* util );
|
XW_UtilCtxt* util );
|
||||||
|
|
||||||
void model_writeToStream( ModelCtxt* model, XWStreamCtxt* stream );
|
void model_writeToStream( const ModelCtxt* model, XWStreamCtxt* stream );
|
||||||
|
|
||||||
#ifdef TEXT_MODEL
|
#ifdef TEXT_MODEL
|
||||||
void model_writeToTextStream( const ModelCtxt* model, XWStreamCtxt* stream );
|
void model_writeToTextStream( const ModelCtxt* model, XWStreamCtxt* stream );
|
||||||
|
|
|
@ -305,7 +305,7 @@ getNV( XWStreamCtxt* stream, ServerNonvolatiles* nv, XP_U16 nPlayers )
|
||||||
} /* getNV */
|
} /* getNV */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
putNV( XWStreamCtxt* stream, ServerNonvolatiles* nv, XP_U16 nPlayers )
|
putNV( XWStreamCtxt* stream, const ServerNonvolatiles* nv, XP_U16 nPlayers )
|
||||||
{
|
{
|
||||||
XP_U16 ii;
|
XP_U16 ii;
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ server_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
|
||||||
} /* server_makeFromStream */
|
} /* server_makeFromStream */
|
||||||
|
|
||||||
void
|
void
|
||||||
server_writeToStream( ServerCtxt* server, XWStreamCtxt* stream )
|
server_writeToStream( const ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
XP_U16 nPlayers = server->vol.gi->nPlayers;
|
XP_U16 nPlayers = server->vol.gi->nPlayers;
|
||||||
|
@ -414,7 +414,7 @@ server_writeToStream( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0; i < nPlayers; ++i ) {
|
for ( i = 0; i < nPlayers; ++i ) {
|
||||||
ServerPlayer* player = &server->players[i];
|
const ServerPlayer* player = &server->players[i];
|
||||||
|
|
||||||
stream_putU8( stream, player->deviceIndex );
|
stream_putU8( stream, player->deviceIndex );
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ ServerCtxt* server_makeFromStream( MPFORMAL XWStreamCtxt* stream,
|
||||||
ModelCtxt* model, CommsCtxt* comms,
|
ModelCtxt* model, CommsCtxt* comms,
|
||||||
XW_UtilCtxt* util, XP_U16 nPlayers );
|
XW_UtilCtxt* util, XP_U16 nPlayers );
|
||||||
|
|
||||||
void server_writeToStream( ServerCtxt* server, XWStreamCtxt* stream );
|
void server_writeToStream( const ServerCtxt* server, XWStreamCtxt* stream );
|
||||||
|
|
||||||
void server_reset( ServerCtxt* server, CommsCtxt* comms );
|
void server_reset( ServerCtxt* server, CommsCtxt* comms );
|
||||||
void server_destroy( ServerCtxt* server );
|
void server_destroy( ServerCtxt* server );
|
||||||
|
|
|
@ -61,7 +61,7 @@ typedef struct StreamCtxVTable {
|
||||||
void (*m_stream_getFromStream)( XWStreamCtxt* dctx, XWStreamCtxt* src,
|
void (*m_stream_getFromStream)( XWStreamCtxt* dctx, XWStreamCtxt* src,
|
||||||
XP_U16 nBytes );
|
XP_U16 nBytes );
|
||||||
|
|
||||||
XWStreamPos (*m_stream_getPos)( XWStreamCtxt* dctx, PosWhich which );
|
XWStreamPos (*m_stream_getPos)( const XWStreamCtxt* dctx, PosWhich which );
|
||||||
XWStreamPos (*m_stream_setPos)( XWStreamCtxt* dctx, PosWhich which,
|
XWStreamPos (*m_stream_setPos)( XWStreamCtxt* dctx, PosWhich which,
|
||||||
XWStreamPos newpos );
|
XWStreamPos newpos );
|
||||||
|
|
||||||
|
@ -75,11 +75,11 @@ typedef struct StreamCtxVTable {
|
||||||
/* void (*m_stream_makeReturnAddr)( XWStreamCtxt* dctx, XP_PlayerAddr* addr, */
|
/* void (*m_stream_makeReturnAddr)( XWStreamCtxt* dctx, XP_PlayerAddr* addr, */
|
||||||
/* XP_U16* addrLen ); */
|
/* XP_U16* addrLen ); */
|
||||||
|
|
||||||
XP_PlayerAddr (*m_stream_getAddress)( XWStreamCtxt* dctx );
|
XP_PlayerAddr (*m_stream_getAddress)( const XWStreamCtxt* dctx );
|
||||||
void (*m_stream_setAddress)( XWStreamCtxt* dctx, XP_PlayerAddr channelNo );
|
void (*m_stream_setAddress)( XWStreamCtxt* dctx, XP_PlayerAddr channelNo );
|
||||||
|
|
||||||
void (*m_stream_setVersion)( XWStreamCtxt* dctx, XP_U16 vers );
|
void (*m_stream_setVersion)( XWStreamCtxt* dctx, XP_U16 vers );
|
||||||
XP_U16 (*m_stream_getVersion)( XWStreamCtxt* dctx );
|
XP_U16 (*m_stream_getVersion)( const XWStreamCtxt* dctx );
|
||||||
|
|
||||||
void (*m_stream_setOnCloseProc)( XWStreamCtxt* dctx,
|
void (*m_stream_setOnCloseProc)( XWStreamCtxt* dctx,
|
||||||
MemStreamCloseCallback proc );
|
MemStreamCloseCallback proc );
|
||||||
|
|
Loading…
Reference in a new issue