+ int ox = COORD(x), oy = COORD(y);
+ unsigned long hdata, vdata;
+
+ clip(dr, ox, oy, TILE_SIZE, TILE_SIZE);
+ draw_rect(dr, ox, oy, TILE_SIZE, TILE_SIZE, COL_BACKGROUND);
+
+ /*
+ * We have to think about which of the horizontal and vertical
+ * line to draw first, if both exist.
+ *
+ * The rule is that hint lines are drawn at the bottom, then
+ * NOLINE crosses, then actual bridges. The enumeration in the
+ * DL_COUNTMASK field is set up so that this drops out of a
+ * straight comparison between the two.
+ *
+ * Since lines crossing in this type of square cannot both be
+ * actual bridges, there's no need to pass a nontrivial 'which'
+ * parameter to draw_[hv]line.
+ */
+ hdata = (data >> D_L_LINE_SHIFT_H) & DL_MASK;
+ vdata = (data >> D_L_LINE_SHIFT_V) & DL_MASK;
+ if ((hdata & DL_COUNTMASK) > (vdata & DL_COUNTMASK)) {
+ draw_hline(dr, ds, ox, oy, TILE_SIZE, hdata, 3);
+ draw_vline(dr, ds, ox, oy, TILE_SIZE, vdata, 3);
+ } else {
+ draw_vline(dr, ds, ox, oy, TILE_SIZE, vdata, 3);
+ draw_hline(dr, ds, ox, oy, TILE_SIZE, hdata, 3);
+ }
+
+ /*
+ * The islands drawn at the edges of a line tile don't need clue
+ * numbers.
+ */
+ draw_island(dr, ds, ox - TILE_SIZE, oy, -1,
+ (data >> D_L_ISLAND_SHIFT_L) & DI_MASK);
+ draw_island(dr, ds, ox + TILE_SIZE, oy, -1,
+ (data >> D_L_ISLAND_SHIFT_R) & DI_MASK);
+ draw_island(dr, ds, ox, oy - TILE_SIZE, -1,
+ (data >> D_L_ISLAND_SHIFT_U) & DI_MASK);
+ draw_island(dr, ds, ox, oy + TILE_SIZE, -1,
+ (data >> D_L_ISLAND_SHIFT_D) & DI_MASK);
+
+ unclip(dr);
+ draw_update(dr, ox, oy, TILE_SIZE, TILE_SIZE);
+}
+
+static void draw_edge_tile(drawing *dr, game_drawstate *ds,
+ int x, int y, int dx, int dy, unsigned long data)
+{
+ int ox = COORD(x), oy = COORD(y);
+ int cx = ox, cy = oy, cw = TILE_SIZE, ch = TILE_SIZE;
+
+ if (dy) {
+ if (dy > 0)
+ cy += TILE_SIZE/2;
+ ch -= TILE_SIZE/2;
+ } else {
+ if (dx > 0)
+ cx += TILE_SIZE/2;
+ cw -= TILE_SIZE/2;
+ }
+ clip(dr, cx, cy, cw, ch);
+ draw_rect(dr, cx, cy, cw, ch, COL_BACKGROUND);
+
+ draw_island(dr, ds, ox + TILE_SIZE*dx, oy + TILE_SIZE*dy, -1,
+ (data >> D_I_ISLAND_SHIFT) & DI_MASK);
+
+ unclip(dr);
+ draw_update(dr, cx, cy, cw, ch);
+}
+
+static void game_redraw(drawing *dr, game_drawstate *ds,
+ const game_state *oldstate, const game_state *state,
+ int dir, const game_ui *ui,
+ float animtime, float flashtime)
+{
+ int x, y, lv, lh;
+ grid_type v, flash = 0;