… | |
… | |
134 | #ifdef CS_LOGSTATS |
134 | #ifdef CS_LOGSTATS |
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 | for (sockvec::iterator i = clients.begin (); i != clients.end (); ) |
140 | for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i) |
140 | { |
141 | { |
141 | client *s = *i; |
142 | client *s = *i; |
142 | |
143 | |
143 | if (s->destroyed ()) |
|
|
144 | { |
|
|
145 | clients.erase (i); |
|
|
146 | delete s; |
|
|
147 | } |
|
|
148 | else |
|
|
149 | ++i; |
|
|
150 | } |
|
|
151 | |
|
|
152 | /* We need to do some of the processing below regardless */ |
|
|
153 | |
|
|
154 | /* Check for any input on the sockets */ |
|
|
155 | for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i) |
|
|
156 | { |
|
|
157 | client *s = *i; |
|
|
158 | player *pl = s->pl; |
144 | if (player *pl = s->pl) |
159 | |
|
|
160 | //TODO: should not be done here, either |
|
|
161 | if (!s->destroyed () && pl) |
|
|
162 | { |
145 | { |
163 | /* Update the players stats once per tick. More efficient than |
146 | /* Update the players stats once per tick. More efficient than |
164 | * sending them whenever they change, and probably just as useful |
147 | * sending them whenever they change, and probably just as useful |
165 | */ |
148 | */ |
166 | esrv_update_stats (pl); |
149 | esrv_update_stats (pl); |
… | |
… | |
176 | draw_client_map (pl->ob); |
159 | draw_client_map (pl->ob); |
177 | |
160 | |
178 | if (s->update_look) |
161 | if (s->update_look) |
179 | esrv_draw_look (pl->ob); |
162 | esrv_draw_look (pl->ob); |
180 | } |
163 | } |
|
|
164 | |
|
|
165 | s->refcnt_chk (); |
181 | } |
166 | } |
182 | } |
167 | } |
183 | |
168 | |