about summary refs log tree commit diff
path: root/src/engine/e_map.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2009-10-27 14:38:53 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2009-10-27 14:38:53 +0000
commit878ede3080ab2cfb627aca505c397d9765052996 (patch)
tree98bff371070e1dca0295f0ca58d64ac4ee8042ce /src/engine/e_map.cpp
parent9b99ec0e60b60134e46f2f71d707230948f7db03 (diff)
downloadzcatch-878ede3080ab2cfb627aca505c397d9765052996.tar.gz
zcatch-878ede3080ab2cfb627aca505c397d9765052996.zip
major update with stuff
Diffstat (limited to 'src/engine/e_map.cpp')
-rw-r--r--src/engine/e_map.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/engine/e_map.cpp b/src/engine/e_map.cpp
new file mode 100644
index 00000000..a2048310
--- /dev/null
+++ b/src/engine/e_map.cpp
@@ -0,0 +1,66 @@
+/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
+#include <base/system.h>
+#include "e_datafile.h"
+
+static DATAFILE *map = 0;
+
+void *map_get_data(int index)
+{
+	return datafile_get_data(map, index);
+}
+
+void *map_get_data_swapped(int index)
+{
+	return datafile_get_data_swapped(map, index);
+}
+
+void map_unload_data(int index)
+{
+	datafile_unload_data(map, index);
+}
+
+void *map_get_item(int index, int *type, int *id)
+{
+	return datafile_get_item(map, index, type, id);
+}
+
+void map_get_type(int type, int *start, int *num)
+{
+	datafile_get_type(map, type, start, num);
+}
+
+void *map_find_item(int type, int id)
+{
+	return datafile_find_item(map, type, id);
+}
+
+int map_num_items()
+{
+	return datafile_num_items(map);
+}
+
+void map_unload()
+{
+	datafile_unload(map);
+	map = 0x0;
+}
+
+int map_is_loaded()
+{
+	return map != 0;
+}
+
+int map_load(const char *mapname)
+{
+	char buf[512];
+	str_format(buf, sizeof(buf), "maps/%s.map", mapname);
+	map = datafile_load(buf);
+	return map != 0;
+}
+
+void map_set(void *m)
+{
+	if(map)
+		map_unload();
+	map = (DATAFILE*)m;
+}