summaryrefslogtreecommitdiff
path: root/src/network/network_client.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-17 15:48:57 +0000
committerrubidium <rubidium@openttd.org>2007-06-17 15:48:57 +0000
commit347c28b71ac754aee20f8eeeae1df1a3b9a49d10 (patch)
tree8bc2a050b44170ed785af66e6e9045d429c789db /src/network/network_client.cpp
parent5fdde681c2aff0976eef8cea59422332527b3a65 (diff)
downloadopenttd-347c28b71ac754aee20f8eeeae1df1a3b9a49d10.tar.xz
(svn r10182) -Codechange: rewrite most part of the file loading/searching to be more flexible.
-Codechange: add support for personal directories on Windows. -Fix [FS#153, FS#193, FS#502, FS#816, FS#854]: fix issues related to fixed names, fixed places of files/directories and application bundles.
Diffstat (limited to 'src/network/network_client.cpp')
-rw-r--r--src/network/network_client.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 1bfaa0402..d7865beef 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -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_SEND_COMMAND_PARAM(PACKET_CLIENT_RCON)(const char *pass, const char *
// 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_WAIT)
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP)
{
- static char filename[256];
static FILE *file_pointer;
byte maptype;
@@ -500,10 +500,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP)
// 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 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MAP)
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;