MCPcopy Create free account
hub / github.com/crawl/crawl / update_level

Function update_level

crawl-ref/source/timed-effects.cc:607–643  ·  view source on GitHub ↗

* Update the level upon the player's return. * * @param elapsedTime how long the player was away. */

Source from the content-addressed store, hash-verified

605 * @param elapsedTime how long the player was away.
606 */
607void update_level(int elapsedTime)
608{
609 ASSERT(!crawl_state.game_is_arena());
610
611 // Simulate up to 10 turns on the floor, then merely update durations and
612 // effects for the remaining time.
613 const int sim_turns = min(10, elapsedTime / 10);
614 elapsedTime -= sim_turns * 10;
615 const int quick_turns = (elapsedTime - (sim_turns * 10)) / 10;
616
617 delete_all_clouds();
618
619 // First, simulate up to 10 turns of monster movement and activity.
620 simulate_time_passing(sim_turns);
621
622 // Then simply time out effects for the remaining time.
623 rot_corpses(elapsedTime);
624 shoals_apply_tides(quick_turns, true);
625 timeout_tombs(elapsedTime);
626 timeout_terrain_changes(elapsedTime);
627
628 if (env.sanctuary_time)
629 {
630 // XX this doesn't guarantee that the final FPROP will be removed?
631 if (quick_turns >= env.sanctuary_time)
632 remove_sanctuary();
633 else
634 env.sanctuary_time -= quick_turns;
635 }
636
637 dungeon_events.fire_event(
638 dgn_event(DET_TURN_ELAPSED, coord_def(0, 0), (sim_turns + quick_turns) * 10));
639
640 for (monster_iterator mi; mi; ++mi)
641 if (!update_monster(**mi, elapsedTime))
642 continue;
643}
644
645/**
646 * Update the monster upon the player's return

Callers 2

cheibriados_time_stepFunction · 0.85
load_levelFunction · 0.85

Calls 12

delete_all_cloudsFunction · 0.85
simulate_time_passingFunction · 0.85
rot_corpsesFunction · 0.85
shoals_apply_tidesFunction · 0.85
timeout_tombsFunction · 0.85
timeout_terrain_changesFunction · 0.85
remove_sanctuaryFunction · 0.85
update_monsterFunction · 0.85
game_is_arenaMethod · 0.80
fire_eventMethod · 0.80
dgn_eventClass · 0.70
coord_defClass · 0.70

Tested by

no test coverage detected