… | |
… | |
899 | |
899 | |
900 | /* Basically, we keep looping until all the players have done their actions. */ |
900 | /* Basically, we keep looping until all the players have done their actions. */ |
901 | for (flag = 1; flag != 0;) |
901 | for (flag = 1; flag != 0;) |
902 | { |
902 | { |
903 | flag = 0; |
903 | flag = 0; |
904 | for (player *plnext, *pl = first_player; pl; pl = plnext) |
904 | for_all_players (pl) |
905 | { |
905 | { |
906 | plnext = pl->next; /* In case a player exits the game in handle_player() */ |
906 | pl->refcnt_chk (); |
907 | |
907 | |
908 | if (!pl->ob) |
908 | if (!pl->ob || !pl->ns) |
909 | continue; |
909 | continue; |
910 | |
910 | |
911 | if (pl->ob->speed_left > 0) |
911 | if (pl->ob->speed_left > 0) |
912 | { |
|
|
913 | if (handle_newcs_player (pl->ob)) |
912 | if (handle_newcs_player (pl->ob)) |
914 | flag = 1; |
913 | flag = 1; |
915 | } /* end if player has speed left */ |
|
|
916 | |
914 | |
917 | /* If the player is not actively playing, don't make a |
915 | /* If the player is not actively playing, don't make a |
918 | * backup save - nothing to save anyway. Plus, the |
916 | * backup save - nothing to save anyway. Plus, the |
919 | * map may not longer be valid. This can happen when the |
917 | * map may not longer be valid. This can happen when the |
920 | * player quits - they exist for purposes of tracking on the map, |
918 | * player quits - they exist for purposes of tracking on the map, |
… | |
… | |
936 | } /* end of for loop for all the players */ |
934 | } /* end of for loop for all the players */ |
937 | } /* for flag */ |
935 | } /* for flag */ |
938 | |
936 | |
939 | for_all_players (pl) |
937 | for_all_players (pl) |
940 | { |
938 | { |
|
|
939 | if (!pl->ob || !pl->ns) |
|
|
940 | continue; |
|
|
941 | |
941 | if (settings.casting_time) |
942 | if (settings.casting_time) |
942 | { |
943 | { |
943 | if (pl->ob->casting_time > 0) |
944 | if (pl->ob->casting_time > 0) |
944 | { |
945 | { |
945 | pl->ob->casting_time--; |
946 | pl->ob->casting_time--; |
… | |
… | |
985 | void |
986 | void |
986 | process_events () |
987 | process_events () |
987 | { |
988 | { |
988 | object *op; |
989 | object *op; |
989 | |
990 | |
990 | static object *marker; |
991 | static object_ptr marker_; |
991 | |
992 | |
992 | if (!marker) |
993 | if (!marker_) |
993 | marker = object::create (); |
994 | marker_ = object::create (); |
|
|
995 | |
|
|
996 | object *marker = marker_; |
994 | |
997 | |
995 | process_players1 (); |
998 | process_players1 (); |
996 | |
999 | |
997 | marker->active_next = active_objects; |
1000 | marker->active_next = active_objects; |
998 | |
1001 | |
999 | if (marker->active_next) |
1002 | if (marker->active_next) |
1000 | marker->active_next->active_prev = marker; |
1003 | marker->active_next->active_prev = marker; |
1001 | |
1004 | |
1002 | marker->active_prev = NULL; |
1005 | marker->active_prev = 0; |
1003 | active_objects = marker; |
1006 | active_objects = marker; |
1004 | |
1007 | |
1005 | while (marker->active_next) |
1008 | while (marker->active_next) |
1006 | { |
1009 | { |
1007 | op = marker->active_next; |
1010 | op = marker->active_next; |
… | |
… | |
1324 | flush_sockets (); |
1327 | flush_sockets (); |
1325 | |
1328 | |
1326 | // then do some bookkeeping, should not really be here |
1329 | // then do some bookkeeping, should not really be here |
1327 | check_active_maps (); /* Removes unused maps after a certain timeout */ |
1330 | check_active_maps (); /* Removes unused maps after a certain timeout */ |
1328 | do_specials (); /* Routines called from time to time. */ |
1331 | do_specials (); /* Routines called from time to time. */ |
1329 | object::free_mortals (); |
1332 | attachable::check_mortals (); |
1330 | |
1333 | |
1331 | ++pticks; |
1334 | ++pticks; |
1332 | } |
1335 | } |
1333 | |
1336 | |
1334 | int |
1337 | int |