reorganizing tileset handling
[vrlugburz] / src / level.c
index ced5b69..e741667 100644 (file)
@@ -109,16 +109,16 @@ int load_level(struct level *lvl, const char *fname)
                        node = (struct ts_node*)cell->next;
                        cell->next = 0;
 
-                       if(j <= 0 || cell[-1].type == CELL_SOLID) {
+                       if(i >= lvl->height - 1 || cell[lvl->width].type == CELL_SOLID) {
                                cell->wall[0] = TILE_STRAIGHT;
                        }
-                       if(i <= 0 || cell[-lvl->width].type == CELL_SOLID) {
+                       if(j >= lvl->width - 1 || cell[1].type == CELL_SOLID) {
                                cell->wall[1] = TILE_STRAIGHT;
                        }
-                       if(j >= lvl->width - 1 || cell[1].type == CELL_SOLID) {
+                       if(i <= 0 || cell[-lvl->width].type == CELL_SOLID) {
                                cell->wall[2] = TILE_STRAIGHT;
                        }
-                       if(i >= lvl->height - 1 || cell[lvl->width].type == CELL_SOLID) {
+                       if(j <= 0 || cell[-1].type == CELL_SOLID) {
                                cell->wall[3] = TILE_STRAIGHT;
                        }
 
@@ -216,7 +216,9 @@ err:
 
 static int load_tileset(struct level *lvl, struct ts_node *tsn)
 {
-       static const char *tile_types[] = {"empty", "straight", "corner", "door", 0};
+       static const char *tile_types[] = {
+               "open", "straight", "corner", "tee", "cross", "str2open", 0
+       };
 
        int i;
        char *path;