summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-09-17 20:08:35 +0000
committerdominik <dominik@openttd.org>2004-09-17 20:08:35 +0000
commit7e882e8fa38185ea0ad782a7d3a034a0c1a006de (patch)
tree180c10f697353b459f0bf877456c5eeaaa7d7008
parent9d1bf52ce37badc1d52c4798282c776b375516fc (diff)
downloadopenttd-7e882e8fa38185ea0ad782a7d3a034a0c1a006de.tar.xz
(svn r285) Fix: networkc.tmp will be created in user's homedir (Loki|muh)
-rw-r--r--network.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/network.c b/network.c
index 3bb19907c..318338ce5 100644
--- a/network.c
+++ b/network.c
@@ -671,6 +671,8 @@ static void HandleAckPacket(AckPacket * ap)
static void HandleFilePacket(FilePacketHdr *fp)
{
int n = fp->packet_length - sizeof(FilePacketHdr);
+ char *tempfile = str_fmt("%s/networkc.tmp", _path.personal_dir);
+
if (n == 0) {
assert(_networking_queuing);
assert(!_networking_sync);
@@ -679,7 +681,7 @@ static void HandleFilePacket(FilePacketHdr *fp)
// attempt loading the game.
_game_mode = GM_NORMAL;
- if (SaveOrLoad("networkc.tmp", SL_LOAD) != SL_OK) {
+ if (SaveOrLoad(tempfile, SL_LOAD) != SL_OK) {
NetworkCoreDisconnect();
NetworkHandleSaveGameError();
return;
@@ -703,7 +705,7 @@ static void HandleFilePacket(FilePacketHdr *fp)
} else {
if(!_recv_file) {
- _recv_file = fopen("networkc.tmp", "wb");
+ _recv_file = fopen(tempfile, "wb");
if (!_recv_file) error("can't open savefile");
}
fwrite( (char*)fp + sizeof(*fp), n, 1, _recv_file);