duncan
Mom and Dad were wrong!
/home/malcolm/tmp/duncan/prototype/0/network/network.h
00001 #ifndef NET_NETWORK_H_
00002 #define NET_NETWORK_H_
00003 
00004 #include <enet/enet.h>
00005 
00013 namespace net {
00015         typedef enet_uint16 port_t;
00016 
00018         typedef enet_uint16 index_t;
00019 
00021         typedef enet_uint8  data_t;
00022 
00024         typedef enet_uint16 pos_t;
00025 
00027         typedef enet_uint8 dir_t;
00028 
00030         typedef enet_uint32 maphash_t;
00031 
00033         const size_t kMaxUsers = 1337;
00034 
00036         const size_t kMaxCharacters = 1337;
00037 
00039         const size_t kNumChannels = 1;
00040 
00042         const bool kReliable = true;
00043 
00045         const port_t kPort = 13370;
00046 
00048         const enet_uint32 kConnectTimeout = 5000;
00049 
00051         const size_t kMaxPacketSize = 2048;
00052 
00054         const size_t kViewRange = 10;
00055 
00060         const size_t kMaxFrameSize = 3000; // for 60 Hz this would be a bit under 1.5 Mbit/sec
00061 
00063         const double kTolerance = 0.8;
00064 
00065         namespace mnum {
00066                 typedef data_t t;
00067                 
00069                 const t name = 0;
00070         
00072                 const t chat = 1;
00073 
00075                 const t playernames = 2;
00076 
00078                 const t playerpositions = 3;
00079 
00081                 const t playerdisconnected = 4;
00082 
00084                 const t direction = 5;
00085 
00087                 const t canchange = 6;
00088 
00090                 const t curlurl = 7;
00091 
00093                 const t requestchangeworld = 8;
00094 
00096                 const t changeworld = 9;
00097 
00099                 const t path = 10;
00100 
00102                 const t morespam = 254;
00103                 const t spam = 255;
00104         };
00105 
00106         namespace direction {
00107                 typedef dir_t t;
00108 
00110                 const t up = 1;
00111 
00113                 const t down = 2;
00114 
00116                 const t left = 4;
00117 
00119                 const t right = 8;
00120         };
00121 
00123         struct Packet {
00125                 data_t data[kMaxPacketSize];
00126 
00128                 size_t size;
00129 
00131                 bool reliable;
00132         };
00133 };
00134 
00135 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations