fix to compile on palm: accomodate old compiler and new dict struct

fields.  Network play against relay works!
This commit is contained in:
ehouse 2009-09-12 15:35:03 +00:00
parent f1e27d4945
commit 86b560c441
3 changed files with 13 additions and 11 deletions

View file

@ -84,8 +84,9 @@ dict_getTileValue( const DictionaryCtxt* dict, Tile tile )
const XP_UCHAR*
dict_getTileString( const DictionaryCtxt* dict, Tile tile )
{
XP_U16 index;
XP_ASSERT( tile < dict->nFaces );
XP_U16 index = dict->faceIndices[tile];
index = dict->faceIndices[tile];
return &dict->faces[index];
}
@ -241,6 +242,8 @@ dict_writeToStream( const DictionaryCtxt* dict, XWStreamCtxt* stream )
XP_U16 maxValue = 0;
XP_U16 ii, nSpecials;
XP_U16 maxCountBits, maxValueBits;
XP_UCHAR buf[64];
XP_U16 nBytes;
stream_putBits( stream, 6, dict->nFaces );
@ -276,8 +279,7 @@ dict_writeToStream( const DictionaryCtxt* dict, XWStreamCtxt* stream )
* too new. And utf-8 dicts are flagged as newer by the sender.
*/
XP_UCHAR buf[64];
XP_U16 nBytes = sizeof(buf);
nBytes = sizeof(buf);
ucharsToNarrow( dict, buf, &nBytes );
stream_putU8( stream, nBytes );
stream_putBytes( stream, buf, nBytes );
@ -340,6 +342,7 @@ dict_loadFromStream( DictionaryCtxt* dict, XWStreamCtxt* stream )
XP_U16 maxCountBits, maxValueBits;
XP_U16 ii, nSpecials;
XP_UCHAR* localTexts[32];
XP_U8 utf8[MAX_UNIQUE_TILES];
XP_ASSERT( !dict->destructor );
dict->destructor = common_destructor;
@ -363,7 +366,7 @@ dict_loadFromStream( DictionaryCtxt* dict, XWStreamCtxt* stream )
}
nFaceBytes = (XP_U8)stream_getU8( stream );
XP_U8 utf8[nFaceBytes];
XP_ASSERT( nFaceBytes < VSIZE(utf8) );
stream_getBytes( stream, utf8, nFaceBytes );
dict->isUTF8 = XP_TRUE; /* need to communicate this in stream */
dict_splitFaces( dict, utf8, nFaceBytes, nFaces );

View file

@ -316,20 +316,20 @@ dict_splitFaces( DictionaryCtxt* dict, const XP_U8* bytes,
{
XP_U16 facesLen = nFaces * 2;
XP_UCHAR* faces = XP_MALLOC( dict->mpool, facesLen );
XP_UCHAR** starts = XP_MALLOC( dict->mpool, nFaces * sizeof(starts[0]));
XP_U16* indices = XP_MALLOC( dict->mpool, nFaces * sizeof(indices[0]));
XP_U16 ii;
XP_UCHAR* next = faces;
for ( ii = 0; ii < nFaces; ++ii ) {
starts[ii] = next;
indices[ii] = next - faces;
*next++ = *bytes++;
*next++ = '\0';
}
XP_ASSERT( next == faces + facesLen );
XP_ASSERT( !dict->faces );
dict->faces = faces;
XP_ASSERT( !dict->faceStarts );
dict->faceStarts = starts;
XP_ASSERT( !dict->faceIndices );
dict->faceIndices = indices;
} /* dict_splitFaces */
static XP_U16
@ -414,7 +414,7 @@ palm_dictionary_destroy( DictionaryCtxt* dict )
MemPtrUnlock( ctxt->super.countsAndValues - 2 );//sizeof(Xloc_header) );
XP_FREE( dict->mpool, ctxt->super.faceStarts );
XP_FREE( dict->mpool, ctxt->super.faceIndices );
XP_FREE( dict->mpool, ctxt->super.faces );
#ifdef XWFEATURE_COMBINEDAWG

View file

@ -1202,8 +1202,7 @@ startApplication( PalmAppGlobals** globalsP )
globals->isFirstLaunch = false;
} else {
DictListEntry* dlep;
XP_U32 gameID;
/* if we're here because dict missing, don't re-init all prefs! */
if ( !prefsFound ) {
palmInitPrefs( globals );