… | |
… | |
46 | #include <arpa/inet.h> |
46 | #include <arpa/inet.h> |
47 | |
47 | |
48 | #include <loader.h> |
48 | #include <loader.h> |
49 | |
49 | |
50 | #define MAX_QUEUE_DEPTH 500 //TODO |
50 | #define MAX_QUEUE_DEPTH 500 //TODO |
51 | #define MAX_QUEUE_BACKLOG 5. //TODO |
51 | #define MAX_QUEUE_BACKLOG 3. //TODO |
52 | |
52 | |
53 | void |
53 | void |
54 | client::reset_state () |
54 | client::reset_state () |
55 | { |
55 | { |
56 | if (!pl) |
56 | if (!pl) |
… | |
… | |
135 | if ((time (NULL) - cst_lst.time_start) >= CS_LOGTIME) |
135 | if ((time (NULL) - cst_lst.time_start) >= CS_LOGTIME) |
136 | write_cs_stats (); |
136 | write_cs_stats (); |
137 | #endif |
137 | #endif |
138 | |
138 | |
139 | //TODO: should not be done here, either |
139 | //TODO: should not be done here, either |
140 | for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i) |
140 | for (int i = 0; i < clients.size (); ++i) |
141 | { |
141 | { |
142 | client *s = *i; |
142 | client *s = clients [i]; |
|
|
143 | player *pl = s->pl; |
143 | |
144 | |
144 | if (player *pl = s->pl) |
145 | if (pl && pl->ns && !pl->ns->destroyed ()) |
145 | { |
146 | { |
146 | /* Update the players stats once per tick. More efficient than |
147 | /* Update the players stats once per tick. More efficient than |
147 | * sending them whenever they change, and probably just as useful |
148 | * sending them whenever they change, and probably just as useful |
148 | */ |
149 | */ |
149 | esrv_update_stats (pl); |
150 | esrv_update_stats (pl); |