+
+ *rot = 0;
+
+ switch(adj) {
+ case 0:
+ case 0757:
+ /* really we'd need a separate tile type for "all neighbors solid", but we
+ * probably never going to need that in practice, so fuck it.
+ */
+ return TILE_OPEN;
+
+ case 0555: /* N-S corridor */
+ *rot = 1;
+ case 0707: /* W-E corridor */
+ return TILE_STR;
+
+ case 0745: /* S-E corner */
+ *rot = 1;
+ case 0715: /* S-W corner */
+ return TILE_CORNER;
+ case 0547: /* N-E corner */
+ *rot = 2;
+ return TILE_CORNER;
+ case 0517: /* N-W corner */
+ *rot = 3;
+ return TILE_CORNER;
+
+ case 0507: /* N tee */
+ *rot = 3;
+ case 0515: /* W tee */
+ return TILE_TEE;
+ case 0705: /* S tee */
+ *rot = 1;
+ return TILE_TEE;
+ case 0545: /* E tee */
+ *rot = 2;
+ return TILE_TEE;
+
+ case 0505: /* cross */
+ return TILE_CROSS;
+
+ case 0700: /* S stropen */
+ case 0701:
+ case 0704:
+ return TILE_STROPEN;
+ case 0444: /* E stropen */
+ case 0445:
+ case 0544:
+ *rot = 1;
+ return TILE_STROPEN;
+ case 0007: /* N stropen */
+ case 0407:
+ case 0107:
+ *rot = 2;
+ return TILE_STROPEN;
+ case 0111: /* W stropen */
+ case 0511:
+ case 0115:
+ *rot = 3;
+ return TILE_STROPEN;
+
+ case 0404: /* E str2open */
+ return TILE_STR2OPEN;
+ case 0005: /* N str2open */
+ *rot = 1;
+ return TILE_STR2OPEN;
+ case 0101: /* W str2open */
+ *rot = 2;
+ return TILE_STR2OPEN;
+ case 0500: /* S str2open */
+ *rot = 3;
+ return TILE_STR2OPEN;
+ }
+
+ return TILE_OPEN;