21 lines
401 B
C
21 lines
401 B
C
|
#include "grid.h"
|
||
|
#include "tiles.h"
|
||
|
|
||
|
enum Tile
|
||
|
grid_get(struct Grid grid, int x, int y)
|
||
|
{
|
||
|
if (x >= grid.width || y >= grid.height || x < 0 || y < 0)
|
||
|
return TILE_OOB;
|
||
|
|
||
|
return grid.data[x + y * grid.width];
|
||
|
}
|
||
|
|
||
|
void
|
||
|
grid_set(struct Grid *restrict grid, int x, int y, enum Tile new)
|
||
|
{
|
||
|
if (x >= grid->width || y >= grid->height || x < 0 || y < 0)
|
||
|
return;
|
||
|
|
||
|
grid->data[x + y * grid->width] = new;
|
||
|
}
|