src/network/network_client.cpp
branchgamebalance
changeset 9913 e79cd19772dd
parent 9911 0b8b245a2391
child 7556 de5c6eb5465d
--- a/src/network/network_client.cpp	Wed Jun 13 12:05:56 2007 +0000
+++ b/src/network/network_client.cpp	Tue Jun 19 07:21:01 2007 +0000
@@ -21,6 +21,7 @@
 #include "../variables.h"
 #include "../ai/ai.h"
 #include "../helpers.hpp"
+#include "../fileio.h"
 
 // This file handles all the client-commands
 
@@ -269,7 +270,7 @@
 //   DEF_CLIENT_RECEIVE_COMMAND has parameter: Packet *p
 // **********
 
-extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
+extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm, Subdirectory subdir);
 
 DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_FULL)
 {
@@ -489,7 +490,6 @@
 
 DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP)
 {
-	static char filename[256];
 	static FILE *file_pointer;
 
 	byte maptype;
@@ -500,10 +500,7 @@
 
 	// First packet, init some stuff
 	if (maptype == MAP_PACKET_START) {
-		// The name for the temp-map
-		snprintf(filename, lengthof(filename), "%s%snetwork_client.tmp",  _paths.autosave_dir, PATHSEP);
-
-		file_pointer = fopen(filename, "wb");
+		file_pointer = FioFOpenFile("network_client.tmp", "wb", AUTOSAVE_DIR);;
 		if (file_pointer == NULL) {
 			_switch_mode_errorstr = STR_NETWORK_ERR_SAVEGAMEERROR;
 			return NETWORK_RECV_STATUS_SAVEGAME;
@@ -545,7 +542,7 @@
 		InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
 
 		/* The map is done downloading, load it */
-		if (!SafeSaveOrLoad(filename, SL_LOAD, GM_NORMAL)) {
+		if (!SafeSaveOrLoad("network_client.tmp", SL_LOAD, GM_NORMAL, AUTOSAVE_DIR)) {
 			DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 			_switch_mode_errorstr = STR_NETWORK_ERR_SAVEGAMEERROR;
 			return NETWORK_RECV_STATUS_SAVEGAME;