about summary refs log tree commit diff
path: root/src/tools/map_resave.c
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-09-09 18:21:14 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-09-09 18:21:14 +0000
commit3f4587ede831760b2f6976960658d202c9d847ff (patch)
tree6c3a22251906673e5e7491dcd86faec23887691b /src/tools/map_resave.c
parent350e968f514a00d4a89395ed13e415103390b9d9 (diff)
downloadzcatch-3f4587ede831760b2f6976960658d202c9d847ff.tar.gz
zcatch-3f4587ede831760b2f6976960658d202c9d847ff.zip
a lot of changes. client side prediction added
Diffstat (limited to 'src/tools/map_resave.c')
-rw-r--r--src/tools/map_resave.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/tools/map_resave.c b/src/tools/map_resave.c
new file mode 100644
index 00000000..91ed09a1
--- /dev/null
+++ b/src/tools/map_resave.c
@@ -0,0 +1,35 @@
+#include <engine/datafile.h>
+
+int main(int argc, char **argv)
+{
+	int i, id, type, size;
+	void *ptr;
+	DATAFILE *df;
+	DATAFILE_OUT *df_out;
+
+	if(argc != 3)
+		return -1;
+
+	df = datafile_load(argv[1]);
+	df_out = datafile_create(argv[2]);
+
+	/* add all items */
+	for(i = 0; i < datafile_num_items(df); i++)
+	{
+		ptr = datafile_get_item(df, i, &type, &id);
+		size = datafile_get_itemsize(df, i);
+		datafile_add_item(df_out, type, id, size, ptr);
+	}
+
+	/* add all data */
+	for(i = 0; i < datafile_num_data(df); i++)
+	{
+		ptr = datafile_get_data(df, i);
+		size = datafile_get_datasize(df, i);
+		datafile_add_data(df_out, size, ptr);
+	}
+
+	datafile_unload(df);
+	datafile_finish(df_out);
+	return 0;
+}