summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-11 13:34:23 +0000
committerrubidium <rubidium@openttd.org>2010-12-11 13:34:23 +0000
commit71e3562f760183497e5d484f7f7bd0ac4fa581ec (patch)
tree3427e691dbb3e48b403eaa7484227a34d4df1ae3 /src
parent0d32cd3cc83fda6ad3726b3dedc5ad096beaac9d (diff)
downloadopenttd-71e3562f760183497e5d484f7f7bd0ac4fa581ec.tar.xz
(svn r21463) -Fix [FS#4296] (r21405): when packets are filled their pos and size aren't the same as when they're read. As a check was incorrect.
Diffstat (limited to 'src')
-rw-r--r--src/network/network_udp.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 0711ecbcd..7ed8cae8a 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -144,15 +144,15 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_DETAIL_INFO)
static const uint MIN_CI_SIZE = 54;
uint max_cname_length = NETWORK_COMPANY_NAME_LENGTH;
- if (Company::GetNumItems() * (MIN_CI_SIZE + NETWORK_COMPANY_NAME_LENGTH) >= (uint)packet.size - packet.pos) {
+ if (Company::GetNumItems() * (MIN_CI_SIZE + NETWORK_COMPANY_NAME_LENGTH) >= (uint)SEND_MTU - packet.size) {
/* Assume we can at least put the company information in the packets. */
- assert(Company::GetNumItems() * MIN_CI_SIZE < (uint)packet.size - packet.pos);
+ assert(Company::GetNumItems() * MIN_CI_SIZE < (uint)SEND_MTU - packet.size);
/* At this moment the company names might not fit in the
* packet. Check whether that is really the case. */
for (;;) {
- int free = packet.size - packet.pos;
+ int free = SEND_MTU - packet.size;
Company *company;
FOR_ALL_COMPANIES(company) {
char company_name[NETWORK_COMPANY_NAME_LENGTH];