#include "tile.h"
+#include "err.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdbool.h>
        enum Terrain terrain;
 } Tile_t;
 
-static const char repr[] = {'X', '.', '^', '\'', '~', '#', '*', '|', '0'};
 
 Tile *tile_init(Point3i pos, enum Terrain ter)
 {
        Tile_t *t = malloc(sizeof(Tile_t));
        bool clamped = false;
+       char msg[80];
 
        t->position = pos;
        t->terrain = ter;
                t->position.z = 9;
        }
        if(clamped == true){
-               //TODO: err output
-               //fprintf(stderr, CLAMPERR, t->position.z);
+               sprintf(msg, CLAMPERR, t->position.z);
+               err_output(msg);
        }
 
        return (Tile *) t;
 
        MOUNTAIN,
        S_WATER,
        D_WATER,
-       WALL,
        FLOOR,
        ROAD,
        LAST
 void tile_cleanup(Tile *t);
 Point3i tile_position(Tile *t);
 enum Terrain tile_terrain(Tile *t);
-
-// TODO: move to nogl output c file
-char tile_repr(enum Terrain t);
 #endif//TILE_H
 
--- /dev/null
+#include "tile_renderer.h"
+#include "board.h"
+
+static Board *b = NULL;
+static const char repr[] = {'X', '.', '^', '\'', '~', '*', '|', '0'};
+const static char col_repr = '#';
+const static char air_repr = ' ';
+const static char unk_repr = '?';
+
+char trndr_repr(Tile *t, int dlayer)
+{
+       if(b == NULL || t == NULL)
+               return unk_repr;
+
+       int tlayer = tile_position(t).z;
+       int terrain;
+
+       if(t < 0; || t > LAST){
+               return unk_repr;
+       } else {
+               if(tlayer < dlayer) { return col_repr; }
+               else if(tlayer > dlayer) { return air_repr; }
+               else return repr[tile_terrain(t)];
+       }
+}
+
+void trendr_set_board(Board *board) { b = board; }
 
--- /dev/null
+#ifndef TILE_RENDERER
+#define TILE_RENDERER
+#include "tile.h"
+
+char trndr_repr(enum Terrain t, int layer);
+void trenr_set_board(Board *board);
+#endif//TILE_RENDERER