summaryrefslogtreecommitdiff
path: root/network_data.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-27 21:25:53 +0000
committertron <tron@openttd.org>2006-06-27 21:25:53 +0000
commit772fbda3e37488c2bf7beb96d35b2cbe001d9eda (patch)
tree1bfdb9c99b43fdc3b07ac13cbed4259a06d34f6f /network_data.c
parent7fa72c5e2f224243a8c89096f0b07259e05e44cf (diff)
downloadopenttd-772fbda3e37488c2bf7beb96d35b2cbe001d9eda.tar.xz
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
Diffstat (limited to 'network_data.c')
-rw-r--r--network_data.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/network_data.c b/network_data.c
index 43ed7c769..ac011f22a 100644
--- a/network_data.c
+++ b/network_data.c
@@ -178,8 +178,9 @@ bool NetworkSend_Packets(NetworkClientState *cs)
cs->packet_queue = p->next;
free(p);
p = cs->packet_queue;
- } else
+ } else {
return true;
+ }
}
return true;
@@ -192,8 +193,7 @@ bool NetworkSend_Packets(NetworkClientState *cs)
uint8 NetworkRecv_uint8(NetworkClientState *cs, Packet *packet)
{
/* Don't allow reading from a closed socket */
- if (cs->quited)
- return 0;
+ if (cs->quited) return 0;
/* Check if variable is within packet-size */
if (packet->pos + 1 > packet->size) {
@@ -209,8 +209,7 @@ uint16 NetworkRecv_uint16(NetworkClientState *cs, Packet *packet)
uint16 n;
/* Don't allow reading from a closed socket */
- if (cs->quited)
- return 0;
+ if (cs->quited) return 0;
/* Check if variable is within packet-size */
if (packet->pos + 2 > packet->size) {
@@ -228,8 +227,7 @@ uint32 NetworkRecv_uint32(NetworkClientState *cs, Packet *packet)
uint32 n;
/* Don't allow reading from a closed socket */
- if (cs->quited)
- return 0;
+ if (cs->quited) return 0;
/* Check if variable is within packet-size */
if (packet->pos + 4 > packet->size) {
@@ -249,8 +247,7 @@ uint64 NetworkRecv_uint64(NetworkClientState *cs, Packet *packet)
uint64 n;
/* Don't allow reading from a closed socket */
- if (cs->quited)
- return 0;
+ if (cs->quited) return 0;
/* Check if variable is within packet-size */
if (packet->pos + 8 > packet->size) {
@@ -388,13 +385,13 @@ Packet *NetworkRecv_Packet(NetworkClientState *cs, NetworkRecvStatus *status)
// Add a command to the local command queue
void NetworkAddCommandQueue(NetworkClientState *cs, CommandPacket *cp)
{
- CommandPacket *new_cp = malloc(sizeof(CommandPacket));
+ CommandPacket* new_cp = malloc(sizeof(*new_cp));
*new_cp = *cp;
- if (cs->command_queue == NULL)
+ if (cs->command_queue == NULL) {
cs->command_queue = new_cp;
- else {
+ } else {
CommandPacket *c = cs->command_queue;
while (c->next != NULL) c = c->next;
c->next = new_cp;
@@ -443,9 +440,7 @@ void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, Comma
// And we queue it for delivery to the clients
FOR_ALL_CLIENTS(cs) {
- if (cs->status > STATUS_AUTH) {
- NetworkAddCommandQueue(cs, c);
- }
+ if (cs->status > STATUS_AUTH) NetworkAddCommandQueue(cs, c);
}
// Only the server gets the callback, because clients should not get them