diff options
author | rubidium <rubidium@openttd.org> | 2010-11-26 22:25:02 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-11-26 22:25:02 +0000 |
commit | 67f74559fc886f6d5afdd3cdd1475fad46d2b4f9 (patch) | |
tree | d7359217a2bf80cd45094f500fe647b4f6ef18d7 /src/network/network_server.cpp | |
parent | c9a186c9fffdb885209f5ecde79565d8fc05dbe7 (diff) | |
download | openttd-67f74559fc886f6d5afdd3cdd1475fad46d2b4f9.tar.xz |
(svn r21334) -Fix [FS#4271]: make (more) sure that the savegame and transferred file are the same file and not different ones
Diffstat (limited to 'src/network/network_server.cpp')
-rw-r--r-- | src/network/network_server.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 42de4cd2f..9ccd4399d 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -371,22 +371,23 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap() } if (this->status == STATUS_AUTHORIZED) { - const char *filename = "network_server.tmp"; - Packet *p; + char filename[MAX_PATH]; + FioGetDirectory(filename, lengthof(filename), AUTOSAVE_DIR); + strecat(filename, "network_server.tmp", lastof(filename)); /* Make a dump of the current game */ - if (SaveOrLoad(filename, SL_SAVE, AUTOSAVE_DIR) != SL_OK) usererror("network savedump failed"); + if (SaveOrLoad(filename, SL_SAVE, NO_DIRECTORY) != SL_OK) usererror("network savedump failed"); if (file_pointer != NULL) fclose(file_pointer); - file_pointer = FioFOpenFile(filename, "rb", AUTOSAVE_DIR); + file_pointer = FioFOpenFile(filename, "rb", NO_DIRECTORY); if (file_pointer == NULL) usererror("network savedump failed - could not open just saved dump"); fseek(file_pointer, 0, SEEK_END); if (ftell(file_pointer) == 0) usererror("network savedump failed - zero sized savegame?"); /* Now send the _frame_counter and how many packets are coming */ - p = new Packet(PACKET_SERVER_MAP_BEGIN); + Packet *p = new Packet(PACKET_SERVER_MAP_BEGIN); p->Send_uint32(_frame_counter); p->Send_uint32(ftell(file_pointer)); this->Send_Packet(p); |