… | |
… | |
187 | flag = 0; |
187 | flag = 0; |
188 | for_all_players (pl) |
188 | for_all_players (pl) |
189 | { |
189 | { |
190 | pl->refcnt_chk (); |
190 | pl->refcnt_chk (); |
191 | |
191 | |
192 | if (expect_false (!pl->ob || !pl->ns || !pl->ob->active)) |
192 | if (ecb_expect_false (!pl->ob || !pl->ns || !pl->ob->active)) |
193 | continue; |
193 | continue; |
194 | |
194 | |
195 | if (handle_newcs_player (pl->ob)) |
195 | if (handle_newcs_player (pl->ob)) |
196 | flag = 1; |
196 | flag = 1; |
197 | } |
197 | } |
… | |
… | |
202 | object *ob = pl->ob; |
202 | object *ob = pl->ob; |
203 | |
203 | |
204 | // process_objects destroys the speed_left value |
204 | // process_objects destroys the speed_left value |
205 | pl->speed_left_save = ob->speed_left; |
205 | pl->speed_left_save = ob->speed_left; |
206 | |
206 | |
207 | if (expect_false (!ob || !pl->ns || !ob->active)) |
207 | if (ecb_expect_false (!ob || !pl->ns || !ob->active)) |
208 | continue; |
208 | continue; |
209 | |
209 | |
210 | do_some_living (ob); |
210 | do_some_living (ob); |
211 | } |
211 | } |
212 | } |
212 | } |
… | |
… | |
245 | ecb_prefetch (&next->anim_speed, 0, 1); |
245 | ecb_prefetch (&next->anim_speed, 0, 1); |
246 | ecb_prefetch (&next->contr , 0, 1); |
246 | ecb_prefetch (&next->contr , 0, 1); |
247 | } |
247 | } |
248 | |
248 | |
249 | /* Now process op */ |
249 | /* Now process op */ |
250 | if (expect_false (op->flag [FLAG_FREED])) |
250 | if (ecb_expect_false (op->flag [FLAG_FREED])) |
251 | { |
251 | { |
252 | LOG (llevError, "BUG: process_events(): Free object on list (%s)\n", op->debug_desc ()); |
252 | LOG (llevError, "BUG: process_events(): Free object on list (%s)\n", op->debug_desc ()); |
253 | op->set_speed (0); |
253 | op->set_speed (0); |
254 | continue; |
254 | continue; |
255 | } |
255 | } |
256 | |
256 | |
257 | if (expect_false (!op->has_active_speed ())) |
257 | if (ecb_expect_false (!op->has_active_speed ())) |
258 | { |
258 | { |
259 | LOG (llevError, "BUG: process_events(): Object %s has no speed (%f), " |
259 | LOG (llevError, "BUG: process_events(): Object %s has no speed (%f), " |
260 | "but is on active list\n", op->debug_desc (), op->speed); |
260 | "but is on active list\n", op->debug_desc (), op->speed); |
261 | op->set_speed (0); |
261 | op->set_speed (0); |
262 | continue; |
262 | continue; |
263 | } |
263 | } |
264 | |
264 | |
265 | if (expect_false (op->flag [FLAG_REMOVED])) |
265 | if (ecb_expect_false (op->flag [FLAG_REMOVED])) |
266 | { |
266 | { |
267 | LOG (llevError, "BUG: process_events(): removed object is on active list: %s\n", |
267 | LOG (llevError, "BUG: process_events(): removed object is on active list: %s\n", |
268 | op->debug_desc ()); |
268 | op->debug_desc ()); |
269 | op->set_speed (0); |
269 | op->set_speed (0); |
270 | continue; |
270 | continue; |
… | |
… | |
279 | op->last_anim = 1; |
279 | op->last_anim = 1; |
280 | } |
280 | } |
281 | else |
281 | else |
282 | ++op->last_anim; |
282 | ++op->last_anim; |
283 | |
283 | |
284 | if (expect_false (op->speed_left > 0.f)) |
284 | if (ecb_expect_false (op->speed_left > 0.f)) |
285 | { |
285 | { |
286 | --op->speed_left; |
286 | --op->speed_left; |
287 | process_object (op); |
287 | process_object (op); |
288 | } |
288 | } |
289 | |
289 | |
… | |
… | |
388 | do_specials () |
388 | do_specials () |
389 | { |
389 | { |
390 | shstr::gc (); |
390 | shstr::gc (); |
391 | archetype::gc (); |
391 | archetype::gc (); |
392 | |
392 | |
393 | if (expect_false (!(server_tick % TICKS_PER_HOUR))) |
393 | if (ecb_expect_false (!(server_tick % TICKS_PER_HOUR))) |
394 | maptile::adjust_daylight (); |
394 | maptile::adjust_daylight (); |
395 | |
395 | |
396 | if (expect_false (!(server_tick % 2503))) |
396 | if (ecb_expect_false (!(server_tick % 2503))) |
397 | fix_weight (); /* Hack to fix weightproblems caused by bugs */ |
397 | fix_weight (); /* Hack to fix weightproblems caused by bugs */ |
398 | |
398 | |
399 | if (expect_false (!(server_tick % 5003))) |
399 | if (ecb_expect_false (!(server_tick % 5003))) |
400 | write_book_archive (); |
400 | write_book_archive (); |
401 | |
401 | |
402 | if (expect_false (!(server_tick % 5009))) |
402 | if (ecb_expect_false (!(server_tick % 5009))) |
403 | clean_friendly_list (); |
403 | clean_friendly_list (); |
404 | |
404 | |
405 | if (expect_false (!(server_tick % 5011))) |
405 | if (ecb_expect_false (!(server_tick % 5011))) |
406 | obsolete_parties (); |
406 | obsolete_parties (); |
407 | |
407 | |
408 | if (expect_false (!(server_tick % 12503))) |
408 | if (ecb_expect_false (!(server_tick % 12503))) |
409 | fix_luck (); |
409 | fix_luck (); |
410 | } |
410 | } |
411 | |
411 | |
412 | void |
412 | void |
413 | one_tick () |
413 | one_tick () |