fixed board orientation
authormatthew <matthew@owens.tech>
Sun, 29 Jul 2018 22:09:41 +0000 (22:09 +0000)
committermatthew <matthew@owens.tech>
Sun, 29 Jul 2018 22:09:41 +0000 (22:09 +0000)
common/board.c
nogl/main.c

index 7b37abd..c8feac7 100644 (file)
@@ -16,16 +16,10 @@ Board *board_init(int sizex, int sizey)
        b->dimensions.y = sizey;
        b->tiles = malloc(sizet * sizeof(Tile));
 
-       //for(int x = 0; x < sizex; ++x){
-       //      b->tiles[x] = malloc(sizey * sizeof(Tile));
-       //      for(int y = 0; y < sizey; ++y){
-       //              b->tiles[x][y] = tile_init(point3i(x,y,1), PLAINS);
-       //      }
-       //}
        for(int x = 0; x < sizex; ++x){
                for(int y = 0; y < sizey; ++y){
 
-                       b->tiles[x + (y * sizey)] =
+                       b->tiles[y * sizex + x] =
                        tile_init(point3i(x,y,1), PLAINS);
                }
        }
index 6a30f67..902f4d9 100644 (file)
@@ -34,13 +34,13 @@ int main()
        Point2i loc;
        Tile* sel = NULL;
 
-       for(int x = 0; x < 5; ++x){
-               for(int y = 0; y < 3; ++y){
+       for(int y = 0; y < 3; ++y){
+               for(int x = 0; x < 5; ++x){
                        loc.x = x;
                        loc.y = y;
                        sel = board_tile_at(board, loc);
                        if(sel == NULL){
-                               printf("N");
+                               printf("X");
                        } else {
                                printf("#");
                        }