projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed compiler warning on non-Unix systems
[rocksndiamonds.git]
/
src
/
network.c
diff --git
a/src/network.c
b/src/network.c
index 2730c7b01967842e533a1e2a5b26df25323e93b1..25108000ba44d12a0dd2d04925282b47a35d4cae 100644
(file)
--- a/
src/network.c
+++ b/
src/network.c
@@
-188,12
+188,9
@@
static void StartNetworkServer(int port)
static int p;
p = port;
static int p;
p = port;
-#if defined(TARGET_SDL2)
+
server_thread = SDL_CreateThread(NetworkServerThread,
"NetworkServerThread", &p);
server_thread = SDL_CreateThread(NetworkServerThread,
"NetworkServerThread", &p);
-#else
- server_thread = SDL_CreateThread(NetworkServerThread, &p);
-#endif
network_server = TRUE;
}
network_server = TRUE;
}
@@
-224,7
+221,7
@@
boolean ConnectToServer(char *hostname, int port)
Error(ERR_EXIT, "SDLNet_AllocSocketSet() failed: %s"), SDLNet_GetError();
udp = SDLNet_UDP_Open(0);
Error(ERR_EXIT, "SDLNet_AllocSocketSet() failed: %s"), SDLNet_GetError();
udp = SDLNet_UDP_Open(0);
- if(!udp)
+ if
(!udp)
Error(ERR_EXIT, "SDLNet_UDP_Open() failed: %s", SDLNet_GetError());
if (SDLNet_UDP_AddSocket(udp_socket_set, udp) == -1)
Error(ERR_EXIT, "SDLNet_UDP_Open() failed: %s", SDLNet_GetError());
if (SDLNet_UDP_AddSocket(udp_socket_set, udp) == -1)
@@
-873,7
+870,11
@@
static void Handle_OP_LEVEL_FILE(void)
if (hasPathSeparator(file_info->basename))
Error(ERR_EXIT, "protocol error: invalid filename from network client");
if (hasPathSeparator(file_info->basename))
Error(ERR_EXIT, "protocol error: invalid filename from network client");
- getNetworkBufferFile(read_buffer, file_info->filename);
+ int num_bytes = getNetworkBufferFile(read_buffer, file_info->filename);
+
+ // if received level file is empty, remove it (as being non-existent)
+ if (num_bytes == 0)
+ remove(file_info->filename);
use_custom_template = getNetworkBuffer8BitInteger(read_buffer);
if (use_custom_template)
use_custom_template = getNetworkBuffer8BitInteger(read_buffer);
if (use_custom_template)
@@
-887,6
+888,10
@@
static void Handle_OP_LEVEL_FILE(void)
Error(ERR_EXIT, "protocol error: invalid filename from network client");
getNetworkBufferFile(read_buffer, tmpl_info->filename);
Error(ERR_EXIT, "protocol error: invalid filename from network client");
getNetworkBufferFile(read_buffer, tmpl_info->filename);
+
+ // if received level file is empty, use level template file instead
+ if (num_bytes == 0)
+ setString(&file_info->filename, tmpl_info->filename);
}
network_level.leveldir_identifier = leveldir_identifier;
}
network_level.leveldir_identifier = leveldir_identifier;