From 5f0fce4191309e9526b7109a0d87c092ce6a4193 Mon Sep 17 00:00:00 2001 From: jacopo grandi Date: Thu, 18 Feb 2021 14:14:23 +0100 Subject: main --- gst/map.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gst/map.c (limited to 'gst/map.c') diff --git a/gst/map.c b/gst/map.c new file mode 100644 index 0000000..59d1ad1 --- /dev/null +++ b/gst/map.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +#include + +int ptoi (map *m, int *p) { return p[0]+p[1]*m->sx; } +int xytoi (map *m, int x, int y) { return x+y*m->sx; } + +void map_init (map *m, int sx, int sy, int ts) { + m->t = (int*)malloc(sizeof(int)*sx*sy); + m->sx = sx; m->sy = sy; m->ts = ts; + memset(m->t, 0, sizeof(int)*sx*sy); +} + +void map_destroy (map *m) { + free(m->t); +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf