equal
deleted
inserted
replaced
22 #include "../vehicle.h" |
22 #include "../vehicle.h" |
23 #include "../station.h" |
23 #include "../station.h" |
24 #include "../variables.h" |
24 #include "../variables.h" |
25 #include "../genworld.h" |
25 #include "../genworld.h" |
26 #include "../helpers.hpp" |
26 #include "../helpers.hpp" |
|
27 #include "../fileio.h" |
27 |
28 |
28 // This file handles all the server-commands |
29 // This file handles all the server-commands |
29 |
30 |
30 static void NetworkHandleCommandQueue(NetworkTCPSocketHandler* cs); |
31 static void NetworkHandleCommandQueue(NetworkTCPSocketHandler* cs); |
31 |
32 |
305 SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_AUTHORIZED); |
306 SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_AUTHORIZED); |
306 return; |
307 return; |
307 } |
308 } |
308 |
309 |
309 if (cs->status == STATUS_AUTH) { |
310 if (cs->status == STATUS_AUTH) { |
310 char filename[256]; |
311 const char *filename = "network_server.tmp"; |
311 Packet *p; |
312 Packet *p; |
312 |
313 |
313 // Make a dump of the current game |
314 // Make a dump of the current game |
314 snprintf(filename, lengthof(filename), "%s%snetwork_server.tmp", _paths.autosave_dir, PATHSEP); |
315 if (SaveOrLoad(filename, SL_SAVE, AUTOSAVE_DIR) != SL_OK) error("network savedump failed"); |
315 if (SaveOrLoad(filename, SL_SAVE) != SL_OK) error("network savedump failed"); |
316 |
316 |
317 file_pointer = FioFOpenFile(filename, "rb", AUTOSAVE_DIR); |
317 file_pointer = fopen(filename, "rb"); |
|
318 fseek(file_pointer, 0, SEEK_END); |
318 fseek(file_pointer, 0, SEEK_END); |
319 |
319 |
320 if (ftell(file_pointer) == 0) error("network savedump failed - zero sized savegame?"); |
320 if (ftell(file_pointer) == 0) error("network savedump failed - zero sized savegame?"); |
321 |
321 |
322 // Now send the _frame_counter and how many packets are coming |
322 // Now send the _frame_counter and how many packets are coming |