diff options
author | alberth <alberth@openttd.org> | 2010-07-24 10:14:39 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-07-24 10:14:39 +0000 |
commit | be6c0584240caf420b2475a0be036391e842e8af (patch) | |
tree | 6111751cf5526e1eb41176782d84766c4e9ed185 /src/network | |
parent | 645b6ce77345867fa96861843197481131566c46 (diff) | |
download | openttd-be6c0584240caf420b2475a0be036391e842e8af.tar.xz |
(svn r20211) -Codechange: Indented code should have curly braces around it.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network.cpp | 4 | ||||
-rw-r--r-- | src/network/network_server.cpp | 16 | ||||
-rw-r--r-- | src/network/network_udp.cpp | 10 |
3 files changed, 16 insertions, 14 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp index aad7e7ae6..32f4a70e6 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -264,9 +264,9 @@ uint NetworkCalculateLag(const NetworkClientSocket *cs) /* This client has missed his ACK packet after 1 DAY_TICKS.. * so we increase his lag for every frame that passes! * The packet can be out by a max of _net_frame_freq */ - if (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq < _frame_counter) + if (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq < _frame_counter) { lag += _frame_counter - (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq); - + } return lag; } diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 64b86c151..3178df8d2 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -166,9 +166,9 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_ERROR)(NetworkClientSocket *cs, Netw if (new_cs->status > STATUS_AUTHORIZED && new_cs != cs) { /* Some errors we filter to a more general error. Clients don't have to know the real * reason a joining failed. */ - if (error == NETWORK_ERROR_NOT_AUTHORIZED || error == NETWORK_ERROR_NOT_EXPECTED || error == NETWORK_ERROR_WRONG_REVISION) + if (error == NETWORK_ERROR_NOT_AUTHORIZED || error == NETWORK_ERROR_NOT_EXPECTED || error == NETWORK_ERROR_WRONG_REVISION) { error = NETWORK_ERROR_ILLEGAL_PACKET; - + } SEND_COMMAND(PACKET_SERVER_ERROR_QUIT)(new_cs, cs->client_id, error); } } @@ -274,8 +274,9 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_WELCOME) /* Transmit info about all the active clients */ FOR_ALL_CLIENT_SOCKETS(new_cs) { - if (new_cs != cs && new_cs->status > STATUS_AUTHORIZED) + if (new_cs != cs && new_cs->status > STATUS_AUTHORIZED) { SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, new_cs->GetInfo()); + } } /* Also send the info of the server */ return SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER)); @@ -1076,8 +1077,9 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co if ((ClientID)dest == CLIENT_ID_SERVER) { ci = NetworkFindClientInfoFromClientID(from_id); /* Display the text locally, and that is it */ - if (ci != NULL) + if (ci != NULL) { NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data); + } } else { /* Else find the client to send the message to */ FOR_ALL_CLIENT_SOCKETS(cs) { @@ -1093,8 +1095,9 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co if (from_id == CLIENT_ID_SERVER) { ci = NetworkFindClientInfoFromClientID(from_id); ci_to = NetworkFindClientInfoFromClientID((ClientID)dest); - if (ci != NULL && ci_to != NULL) + if (ci != NULL && ci_to != NULL) { NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), true, ci_to->client_name, msg, data); + } } else { FOR_ALL_CLIENT_SOCKETS(cs) { if (cs->client_id == from_id) { @@ -1156,8 +1159,9 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, from_id, false, msg, data); } ci = NetworkFindClientInfoFromClientID(from_id); - if (ci != NULL) + if (ci != NULL) { NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data); + } break; } } diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp index eb4f8b99b..9d5ce98a2 100644 --- a/src/network/network_udp.cpp +++ b/src/network/network_udp.cpp @@ -532,8 +532,7 @@ static void NetworkUDPAdvertiseThread(void *pntr) void NetworkUDPAdvertise() { /* Check if we should send an advertise */ - if (!_networking || !_network_server || !_network_udp_server || !_settings_client.network.server_advertise) - return; + if (!_networking || !_network_server || !_network_udp_server || !_settings_client.network.server_advertise) return; if (_network_need_advertise) { _network_need_advertise = false; @@ -541,13 +540,12 @@ void NetworkUDPAdvertise() } else { /* Only send once every ADVERTISE_NORMAL_INTERVAL ticks */ if (_network_advertise_retries == 0) { - if ((_network_last_advertise_frame + ADVERTISE_NORMAL_INTERVAL) > _frame_counter) - return; + if ((_network_last_advertise_frame + ADVERTISE_NORMAL_INTERVAL) > _frame_counter) return; + _network_advertise_retries = ADVERTISE_RETRY_TIMES; } - if ((_network_last_advertise_frame + ADVERTISE_RETRY_INTERVAL) > _frame_counter) - return; + if ((_network_last_advertise_frame + ADVERTISE_RETRY_INTERVAL) > _frame_counter) return; } _network_advertise_retries--; |