Mercurial > hg > openttd
changeset 5810:def1d64f59a9 draft
(svn r8372) -Fix (8361): NUM_LANDSCAPE comes (via some detour) from openttd.h, which does not exist in the masterserver/updater.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 23 Jan 2007 14:47:38 +0000 |
parents | 4a851f2ffc18 |
children | a9392e4b4610 |
files | src/network/core/config.h src/network/core/udp.cpp src/network/network.cpp |
diffstat | 3 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/network/core/config.h +++ b/src/network/core/config.h @@ -42,6 +42,15 @@ NETWORK_MAX_GRF_COUNT = 55, NETWORK_NUM_LANGUAGES = 4, ///< Number of known languages (to the network protocol) + 1 for 'any'. + /** + * The number of landscapes in OpenTTD. + * This number must be equal to NUM_LANDSCAPE, but as this number is used + * within the network code and that the network code is shared with the + * masterserver/updater, it has to be declared in here too. In network.cpp + * there is a compile assertion to check that this NUM_LANDSCAPE is equal + * to NETWORK_NUM_LANDSCAPES. + */ + NETWORK_NUM_LANDSCAPES = 4, }; #endif /* ENABLE_NETWORK */
--- a/src/network/core/udp.cpp +++ b/src/network/core/udp.cpp @@ -300,8 +300,8 @@ info->map_set = NetworkRecv_uint8 (this, p); info->dedicated = (NetworkRecv_uint8(this, p) != 0); - if (info->server_lang >= NETWORK_NUM_LANGUAGES) info->server_lang = 0; - if (info->map_set >= NUM_LANDSCAPE) info->map_set = 0; + if (info->server_lang >= NETWORK_NUM_LANGUAGES) info->server_lang = 0; + if (info->map_set >= NETWORK_NUM_LANDSCAPES) info->map_set = 0; } }
--- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -38,6 +38,9 @@ #include <stdarg.h> /* va_list */ #include "../md5.h" +/* Check whether NETWORK_NUM_LANDSCAPES is still in sync with NUM_LANDSCAPE */ +assert_compile((int)NETWORK_NUM_LANDSCAPES == (int)NUM_LANDSCAPE); + // global variables (declared in network_data.h) CommandPacket *_local_command_queue;