We need to clean this up, so my proposal is that we define a "protocol extensions" mechanism.
Rather than bumping to a new protocol number every time, instead we implement a single "protocol 666" which tells the engine "I'm using something other than stock protocol 15 here, so watch out".
Each supported extension is a #define, so the items we need to standardise are (1) that this is the way we'll do it, and (2) the list of defines.
If using protocol 666, we read a series of ints from the server in CL_ParseServerInfo (it could be only one, but I prefer to build this to support more than 32 extensions from the outset) and store them in an extension flags member of the client struct.
The last thing we need is a way for the client to tell the server what extensions it supports. This can be set up in a similar manner to the above, and sent during CL_SignonReply.
So now we have a client which knows which extensions the server supports and a server which knows which extensions the client supports, so we take the common items which gives us which extensions we actually use. The server checks with a bitwise and when sending the data, and adjusts it's behaviour accordingly. The client checks with a bitwise and when reading the data and adjusts it's behaviour accordingly. Both can fall back to protocol 15 if any given extension is unsupported by both.
This then puts us in a position where the proposed "new standard protocol" can be implemented as quickly and easily as possible in as many engines as possible, doesn't have to be an "all or nothing" implementation (engines can pick and choose which features they want), preserves compatibility between protocol version numbers, and will always have a fallback to standard protocol 15 behaviour if something isn't there.
Comments welcome.
![Wink ;)](./images/smilies/icon_wink.gif)