aboutsummaryrefslogtreecommitdiff
path: root/gst/map.c
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-02-18 14:14:23 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-02-18 14:14:23 +0100
commit5f0fce4191309e9526b7109a0d87c092ce6a4193 (patch)
tree105257f876551814aa74a0760ec116bd1bf307a5 /gst/map.c
parentead78d51e662057467b79d3a65b20c4ba83cbf07 (diff)
main
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