diff options
| author | Kevin Lyles <kevinlyles@gmail.com> | 2015-05-16 13:51:34 -0500 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2015-05-22 08:18:45 +0100 |
| commit | 7c52202bc4b3c9c9353cae9c53bfc8772dca1a5d (patch) | |
| tree | 9638ea464de86ce71483fc463ef1fa31959a76d0 | |
| parent | a614347a3e5fe106e69fd697fb08d50cda81f83b (diff) | |
| download | puzzles-7c52202bc4b3c9c9353cae9c53bfc8772dca1a5d.zip puzzles-7c52202bc4b3c9c9353cae9c53bfc8772dca1a5d.tar.gz puzzles-7c52202bc4b3c9c9353cae9c53bfc8772dca1a5d.tar.bz2 puzzles-7c52202bc4b3c9c9353cae9c53bfc8772dca1a5d.tar.xz | |
Split out the text color portion of draw_tile
| -rw-r--r-- | towers.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -1598,14 +1598,23 @@ static void draw_tile(drawing *dr, game_drawstate *ds, struct clues *clues, /* new number needs drawing? */ if (tile & DF_DIGIT_MASK) { + int color; + str[1] = '\0'; str[0] = (tile & DF_DIGIT_MASK) + '0'; + + if (tile & DF_ERROR) + color = COL_ERROR; + else if (x < 0 || y < 0 || x >= w || y >= w) + color = COL_GRID; + else if (tile & DF_IMMUTABLE) + color = COL_GRID; + else + color = COL_USER; + draw_text(dr, tx + TILESIZE/2, ty + TILESIZE/2, FONT_VARIABLE, (tile & DF_PLAYAREA ? TILESIZE/2 : TILESIZE*2/5), - ALIGN_VCENTRE | ALIGN_HCENTRE, - (tile & DF_ERROR) ? COL_ERROR : - (x < 0 || y < 0 || x >= w || y >= w) ? COL_GRID : - (tile & DF_IMMUTABLE) ? COL_GRID : COL_USER, str); + ALIGN_VCENTRE | ALIGN_HCENTRE, color, str); } else { int i, j, npencil; int pl, pr, pt, pb; |