add bonus squares for 21x21 board (linux only)

This commit is contained in:
Eric House 2022-03-10 15:21:36 -08:00
parent b150ef471b
commit cb2d847e6d
4 changed files with 35 additions and 7 deletions

View file

@ -212,6 +212,8 @@ typedef enum {
BONUS_DOUBLE_WORD,
BONUS_TRIPLE_LETTER,
BONUS_TRIPLE_WORD,
BONUS_QUAD_LETTER,
BONUS_QUAD_WORD,
BONUS_LAST
} XWBonusType;

View file

@ -391,7 +391,7 @@ model_setSquareBonuses( ModelCtxt* model, XWBonusType* bonuses, XP_U16 nBonuses
XP_FREE( model->vol.mpool, model->vol.bonuses );
}
model->vol.bonuses = XP_MALLOC( model->vol.mpool,
nBonuses * sizeof(model->vol.bonuses[0]) );
nBonuses * sizeof(model->vol.bonuses[0]) );
XP_MEMCPY( model->vol.bonuses, bonuses,
nBonuses * sizeof(model->vol.bonuses[0]) );
model->vol.nBonuses = nBonuses;

View file

@ -620,6 +620,8 @@ word_multiplier( const ModelCtxt* model, XWEnv xwe, XP_U16 col, XP_U16 row )
return 2;
case BONUS_TRIPLE_WORD:
return 3;
case BONUS_QUAD_WORD:
return 4;
default:
return 1;
}
@ -634,6 +636,8 @@ tile_multiplier( const ModelCtxt* model, XWEnv xwe, XP_U16 col, XP_U16 row )
return 2;
case BONUS_TRIPLE_LETTER:
return 3;
case BONUS_QUAD_LETTER:
return 4;
default:
return 1;
}

View file

@ -115,11 +115,13 @@ linux_util_makeEmptyDict( XW_UtilCtxt* XP_UNUSED_DBG(uctx), XWEnv xwe )
#define DW BONUS_DOUBLE_WORD
#define TL BONUS_TRIPLE_LETTER
#define TW BONUS_TRIPLE_WORD
#define QL BONUS_QUAD_LETTER
#define QW BONUS_QUAD_WORD
static XWBonusType*
bonusesFor( XP_U16 boardSize, XP_U16* len )
{
static XWBonusType scrabbleBoard[] = {
static XWBonusType scrabbleBoard[] = {
TW,//EM,EM,DL,EM,EM,EM,TW,
EM,DW,//EM,EM,EM,TL,EM,EM,
@ -133,7 +135,7 @@ bonusesFor( XP_U16 boardSize, XP_U16* len )
TW,EM,EM,DL,EM,EM,EM,DW,
}; /* scrabbleBoard */
static XWBonusType seventeen[] = {
static XWBonusType seventeen[] = {
TW,//EM,EM,DL,EM,EM,EM,TW,
EM,DW,//EM,EM,EM,TL,EM,EM,
@ -146,17 +148,37 @@ bonusesFor( XP_U16 boardSize, XP_U16* len )
EM,EM,DL,EM,EM,EM,DL,//EM,
TW,EM,EM,DL,EM,EM,EM,DW,
TW,EM,EM,DL,EM,EM,EM,DW,DW,
}; /* scrabbleBoard */
}; /* seventeen */
static XWBonusType twentyOne[] = {
QW,
EM, DW,
EM, EM, DW,
DL, EM, EM, TW,
EM, TL, EM, EM, DW,
EM, EM, QL, EM, EM, DW,
EM, EM, EM, DL, EM, EM, DW,
TW, EM, EM, EM, EM, EM, EM, DW,
EM, DW, EM, EM, TL, EM, EM, EM, TL,
EM, EM, DW, EM, EM, DL, EM, EM, EM, DL,
DL, EM, EM, TW, EM, EM, DL, EM, EM, EM, DW,
}; /* twentyOne */
XWBonusType* result = NULL;
if ( boardSize == 15 ) {
switch ( boardSize ) {
case 15:
result = scrabbleBoard;
*len = VSIZE(scrabbleBoard);
} else if ( boardSize == 17 ) {
break;
case 17:
result = seventeen;
*len = VSIZE(seventeen);
break;
case 21:
result = twentyOne;
*len = VSIZE(twentyOne);
break;
}
return result;
}