aboutsummaryrefslogtreecommitdiff
path: root/gst/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/map.c')
-rw-r--r--gst/map.c19
1 files changed, 19 insertions, 0 deletions
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 <stdlib.h>
+#include <stdio.h>
+#include <units.h>
+#include <string.h>
+
+#include <map.h>
+
+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