diff options
author | rubidium <rubidium@openttd.org> | 2008-12-23 20:52:27 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-23 20:52:27 +0000 |
commit | 54f23ed0b3ff2ee72f36e8755b96ffd35e465f8a (patch) | |
tree | 5fc12b987e4ccf94d7c727fd7c3eccc1826b870a /src/network/network_type.h | |
parent | 258ebb81732d24f67b66978b12e74dd0d8855433 (diff) | |
download | openttd-54f23ed0b3ff2ee72f36e8755b96ffd35e465f8a.tar.xz |
(svn r14730) -Codechange: remove the need for networkclientsockets and networkclientinfo structs to be in a contiguous piece of memory and put them in a pool.
-Note: 255 should really be enough for now... making it any more means network protocol bumps.
Diffstat (limited to 'src/network/network_type.h')
-rw-r--r-- | src/network/network_type.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/network/network_type.h b/src/network/network_type.h index c04fd1f5a..2878819b5 100644 --- a/src/network/network_type.h +++ b/src/network/network_type.h @@ -13,12 +13,18 @@ #include "core/game.h" enum { + /** How many clients can we have */ + MAX_CLIENTS = 255, + + /** The number of bits per pool client block */ + NCI_BITS_PER_POOL_BLOCK = 3, // => 8 items per block /** - * How many clients can we have? Like.. MAX_COMPANIES is the amount of - * companies that can really play.. so.. a max of 3 spectators.. gives us.. - * MAX_COMPANIES + 3 + * The number of slots; must be a multiple of (1 << NCI_BITS_PER_POOL_BLOCK) + * and be at least 1 more than MAX_CLIENTS. It must furthermore be less than + * or equal to 256 as client indices (sent over the network) are 8 bits. + * It needs 1 more for the dedicated server. */ - MAX_CLIENTS = MAX_COMPANIES + 3, + MAX_CLIENT_SLOTS = 256, /** Maximum number of internet interfaces supported. */ MAX_INTERFACES = 9, @@ -36,10 +42,7 @@ enum ClientID { }; /** Indices into the client tables */ -enum ClientIndex { - /** Do not change this next line. It should _ALWAYS_ be MAX_CLIENTS + 1. This due to the (dedicated) server taking one slot. */ - MAX_CLIENT_SLOTS = MAX_CLIENTS + 1, -}; +typedef uint8 ClientIndex; /** Simple calculated statistics of a company */ struct NetworkCompanyStats { |