… | |
… | |
24 | #ifndef CLIENT_H |
24 | #ifndef CLIENT_H |
25 | #define CLIENT_H |
25 | #define CLIENT_H |
26 | |
26 | |
27 | #include <deque> |
27 | #include <deque> |
28 | #include <bitset> |
28 | #include <bitset> |
29 | #include <list> |
29 | #include <tr1/unordered_set> |
30 | |
30 | |
31 | // (possibly) max. number of objects "per page" in the ground container |
31 | // (possibly) max. number of objects "per page" in the ground container |
32 | #define FLOORBOX_PAGESIZE 50 |
32 | #define FLOORBOX_PAGESIZE 50 |
33 | |
33 | |
34 | struct MapCell |
34 | struct MapCell |
… | |
… | |
76 | * instead of having a bunch of different fields that needed to |
76 | * instead of having a bunch of different fields that needed to |
77 | * get toggled. |
77 | * get toggled. |
78 | */ |
78 | */ |
79 | enum MapMode { Map0Cmd = 0, Map1Cmd = 1, Map1aCmd = 2 }; |
79 | enum MapMode { Map0Cmd = 0, Map1Cmd = 1, Map1aCmd = 2 }; |
80 | |
80 | |
81 | /* The following is the setup for a ring buffer for storing outbut |
81 | /* The following is the setup for a ring buffer for storing output |
82 | * data that the OS can't handle right away. |
82 | * data that the OS can't handle right away. |
83 | */ |
83 | */ |
84 | |
84 | |
85 | struct Buffer |
85 | struct Buffer |
86 | { |
86 | { |
… | |
… | |
113 | { |
113 | { |
114 | sfree<char> (data, datalen + 1); |
114 | sfree<char> (data, datalen + 1); |
115 | } |
115 | } |
116 | }; |
116 | }; |
117 | |
117 | |
|
|
118 | struct refitem |
|
|
119 | { |
|
|
120 | object_ptr op; |
|
|
121 | }; |
|
|
122 | |
118 | // this represents a container on the client side. |
123 | // this represents a container on the client side. |
119 | // right now, there are only ever two of them: |
124 | // right now, there are only ever two of them: |
120 | // the inventory and the floor/open container |
125 | // the inventory and the floor/open container |
121 | //TODO: unused as of yet |
126 | //TODO: unused as of yet |
122 | struct client_container |
127 | struct client_container : vector< refitem, slice_allocator<refitem> > |
123 | { |
128 | { |
|
|
129 | client *ns; |
124 | enum { CC_NONE, CC_INVENTORY, CC_MAPSPACE, CC_CONTAINER } type; |
130 | enum { CC_NONE, CC_INVENTORY, CC_MAPSPACE, CC_CONTAINER } type; |
125 | |
131 | |
|
|
132 | bool item_changed; // one of the items in here possibly changed |
|
|
133 | |
126 | // for mapspace and container |
134 | // for mapspace and container |
127 | sint16 x, y; |
135 | int x, y; |
128 | maptile *map; |
136 | maptile *map; |
129 | |
137 | |
130 | // for container |
138 | // for container |
131 | object *env; |
139 | object *env; |
|
|
140 | |
|
|
141 | client_container (client *ns) |
|
|
142 | : ns (ns), type (CC_NONE) { } |
|
|
143 | |
|
|
144 | tag_t tag () const; |
|
|
145 | |
|
|
146 | inline iterator merge_item (iterator i, object *op); |
|
|
147 | |
|
|
148 | void clear (); |
|
|
149 | void update (); |
|
|
150 | |
|
|
151 | void set_mapspace (maptile *map, int x, int y); |
|
|
152 | void set_container (object *env); |
132 | }; |
153 | }; |
133 | |
154 | |
134 | /* how many times we are allowed to give the wrong password before being kicked. */ |
155 | /* how many times we are allowed to give the wrong password before being kicked. */ |
135 | #define MAX_PASSWORD_FAILURES 5 |
156 | #define MAX_PASSWORD_FAILURES 5 |
136 | |
157 | |