… | |
… | |
241 | flag = 0; |
241 | flag = 0; |
242 | for_all_players (pl) |
242 | for_all_players (pl) |
243 | { |
243 | { |
244 | pl->refcnt_chk (); |
244 | pl->refcnt_chk (); |
245 | |
245 | |
246 | if (!pl->ob || !pl->ns || !pl->ob->active) |
246 | if (expect_false (!pl->ob || !pl->ns || !pl->ob->active)) |
247 | continue; |
247 | continue; |
248 | |
248 | |
249 | if (handle_newcs_player (pl->ob)) |
249 | if (handle_newcs_player (pl->ob)) |
250 | flag = 1; |
250 | flag = 1; |
251 | } |
251 | } |
… | |
… | |
253 | |
253 | |
254 | for_all_players (pl) |
254 | for_all_players (pl) |
255 | { |
255 | { |
256 | object *ob = pl->ob; |
256 | object *ob = pl->ob; |
257 | |
257 | |
258 | if (!ob || !pl->ns || !ob->active) |
258 | if (expect_false (!ob || !pl->ns || !ob->active)) |
259 | continue; |
259 | continue; |
260 | |
260 | |
261 | do_some_living (ob); |
261 | do_some_living (ob); |
262 | } |
262 | } |
263 | } |
263 | } |
… | |
… | |
279 | process_players1 (); |
279 | process_players1 (); |
280 | |
280 | |
281 | for_all_actives (op) |
281 | for_all_actives (op) |
282 | { |
282 | { |
283 | /* Now process op */ |
283 | /* Now process op */ |
284 | if (QUERY_FLAG (op, FLAG_FREED)) |
284 | if (expect_false (QUERY_FLAG (op, FLAG_FREED))) |
285 | { |
285 | { |
286 | LOG (llevError, "BUG: process_events(): Free object on list\n"); |
286 | LOG (llevError, "BUG: process_events(): Free object on list\n"); |
287 | op->set_speed (0); |
287 | op->set_speed (0); |
288 | continue; |
288 | continue; |
289 | } |
289 | } |
290 | |
290 | |
291 | if (!op->has_active_speed ()) |
291 | if (expect_false (!op->has_active_speed ())) |
292 | { |
292 | { |
293 | LOG (llevError, "BUG: process_events(): Object %s has no speed (%f), " |
293 | LOG (llevError, "BUG: process_events(): Object %s has no speed (%f), " |
294 | "but is on active list\n", op->debug_desc (), op->speed); |
294 | "but is on active list\n", op->debug_desc (), op->speed); |
295 | op->set_speed (0); |
295 | op->set_speed (0); |
296 | continue; |
296 | continue; |
297 | } |
297 | } |
298 | |
298 | |
299 | if (op->flag [FLAG_REMOVED]) |
299 | if (expect_false (op->flag [FLAG_REMOVED])) |
300 | { |
300 | { |
301 | LOG (llevError, "BUG: process_events(): removed object is on active list: %s\n", |
301 | LOG (llevError, "BUG: process_events(): removed object is on active list: %s\n", |
302 | op->debug_desc ()); |
302 | op->debug_desc ()); |
303 | op->set_speed (0); |
303 | op->set_speed (0); |
304 | continue; |
304 | continue; |
… | |
… | |
471 | * doing the various things. |
471 | * doing the various things. |
472 | */ |
472 | */ |
473 | void |
473 | void |
474 | do_specials (void) |
474 | do_specials (void) |
475 | { |
475 | { |
476 | if (!(pticks % TICKS_PER_HOUR)) |
476 | if (expect_false (!(pticks % TICKS_PER_HOUR))) |
477 | adjust_daylight (); |
477 | adjust_daylight (); |
478 | |
478 | |
479 | if (!(pticks % 7)) |
479 | if (expect_false (!(pticks % 7))) |
480 | shstr::gc (); |
480 | shstr::gc (); |
481 | |
481 | |
482 | if (!(pticks % 2503)) |
482 | if (expect_false (!(pticks % 2503))) |
483 | fix_weight (); /* Hack to fix weightproblems caused by bugs */ |
483 | fix_weight (); /* Hack to fix weightproblems caused by bugs */ |
484 | |
484 | |
485 | if (!(pticks % 5003)) |
485 | if (expect_false (!(pticks % 5003))) |
486 | write_book_archive (); |
486 | write_book_archive (); |
487 | |
487 | |
488 | if (!(pticks % 5009)) |
488 | if (expect_false (!(pticks % 5009))) |
489 | clean_friendly_list (); |
489 | clean_friendly_list (); |
490 | |
490 | |
491 | if (!(pticks % 5011)) |
491 | if (expect_false (!(pticks % 5011))) |
492 | obsolete_parties (); |
492 | obsolete_parties (); |
493 | |
493 | |
494 | if (!(pticks % 12503)) |
494 | if (expect_false (!(pticks % 12503))) |
495 | fix_luck (); |
495 | fix_luck (); |
496 | } |
496 | } |
497 | |
497 | |
498 | void |
498 | void |
499 | server_tick () |
499 | server_tick () |