about summary refs log tree commit diff
path: root/src/engine/client/ec_client.c
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-10-21 18:05:06 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-10-21 18:05:06 +0000
commit9acb3e5e713d1ab6b2312aa4cdc7946f85f875d0 (patch)
tree93189cbe6fc70c2ca1b5e374a2114156d55e371a /src/engine/client/ec_client.c
parent142b5ad5143ddcfc9d7fee2563bee753a968f011 (diff)
downloadzcatch-9acb3e5e713d1ab6b2312aa4cdc7946f85f875d0.tar.gz
zcatch-9acb3e5e713d1ab6b2312aa4cdc7946f85f875d0.zip
continued on ban support. cleaned up settings a bit. reworked the datadir autodetection. introduced engine_openfile, engine_getpath and engine_listdir. never use fs_listdir or io_open directly
Diffstat (limited to 'src/engine/client/ec_client.c')
-rw-r--r--src/engine/client/ec_client.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c
index 8ef6cf51..1c499e85 100644
--- a/src/engine/client/ec_client.c
+++ b/src/engine/client/ec_client.c
@@ -727,7 +727,6 @@ static const char *client_load_map_search(const char *mapname, int wanted_crc)
 {
 	const char *error = 0;
 	char buf[512];
-	char buf2[512];
 	dbg_msg("client", "loading map, map=%s wanted crc=%08x", mapname, wanted_crc);
 	client_set_state(CLIENTSTATE_LOADING);
 	
@@ -738,8 +737,7 @@ static const char *client_load_map_search(const char *mapname, int wanted_crc)
 		return error;
 
 	/* try the downloaded maps */
-	str_format(buf2, sizeof(buf2), "maps/%s_%8x.map", mapname, wanted_crc);
-	engine_savepath(buf2, buf, sizeof(buf));
+	str_format(buf, sizeof(buf), "maps/%s_%8x.map", mapname, wanted_crc);
 	error = client_load_map(mapname, buf, wanted_crc);
 	return error;
 }
@@ -896,15 +894,13 @@ static void client_process_packet(NETCHUNK *packet)
 					}
 					else
 					{
-						char buf[512];
-						str_format(buf, sizeof(buf), "maps/%s_%08x.map", map, map_crc);
-						engine_savepath(buf, mapdownload_filename, sizeof(mapdownload_filename));
+						str_format(mapdownload_filename, sizeof(mapdownload_filename), "maps/%s_%08x.map", map, map_crc);
 
 						dbg_msg("client/network", "starting to download map to '%s'", mapdownload_filename);
 						
 						mapdownload_chunk = 0;
 						str_copy(mapdownload_name, map, sizeof(mapdownload_name));
-						mapdownload_file = io_open(mapdownload_filename, IOFLAG_WRITE);
+						mapdownload_file = engine_openfile(mapdownload_filename, IOFLAG_WRITE);
 						mapdownload_crc = map_crc;
 						mapdownload_totalsize = -1;
 						mapdownload_amount = 0;
@@ -1857,14 +1853,9 @@ int main(int argc, char **argv)
 	
 	/* parse the command line arguments */
 	engine_parse_arguments(argc, argv);
-	
-	/* change into data-dir */
-	if (!engine_chdir_datadir(argv[0]))
-	{
-		dbg_msg("client", "fatal error: data-dir cannot be found");
-		gui_messagebox("Error", "The data-dir cannot be found.");
-		return -1;
-	}
+
+	/* execute config file */
+	console_execute_file("settings.cfg");
 	
 	/* run the client*/
 	client_run();