--- deliantra/server/include/network.h 2007/07/28 12:02:58 1.15 +++ deliantra/server/include/network.h 2007/07/29 19:11:47 1.17 @@ -47,10 +47,10 @@ /* Maximum size of any packet we expect. * - * The size must be the same in the server and the client (stupid), and its also NOT - * the maximum buffer size as one would expect, but the maximum buffer size + 1. + * The size must be the same in the server and the client (stupid). + * TODO: make the actual network configurable per clietn and use 2**16. */ -#define MAXSOCKBUF 10240 +#define MAXSOCKBUF 10239 #define CS_QUERY_YESNO 0x1 /* Yes/no question */ #define CS_QUERY_SINGLECHAR 0x2 /* Single character response expected */ @@ -269,6 +269,15 @@ uint32 val; ber32 (uint32 val) : val (val) { } + + static int encoded_size (uint32 val) + { + if (val >= (1 << 7*4)) return 5; + if (val >= (1 << 7*3)) return 4; + if (val >= (1 << 7*2)) return 3; + if (val >= (1 << 7*1)) return 2; + return 1; + } }; /* Contains the base information we use to make up a packet we want to send. */