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

Function dgn_reset_player_data

crawl-ref/source/dungeon.cc:749–794  ·  view source on GitHub ↗

It's probably better in general to just reset `you` instead of calling this. But that's not so convenient for some users of this function, notably lua tests. This leaves some state uninitialized, and probably should be immediately followed by a call to `initial_dungeon_setup` and something that moves the player to a level or regenerates a level. */

Source from the content-addressed store, hash-verified

747player to a level or regenerates a level.
748*/
749void dgn_reset_player_data()
750{
751 // vaults and map stuff
752 you.uniq_map_tags.clear();
753 you.uniq_map_names.clear();
754 you.uniq_map_tags_abyss.clear();
755 you.uniq_map_names_abyss.clear();
756 for (auto branch : branch_uniq_map_tags)
757 branch.clear();
758
759 you.vault_list.clear();
760 you.branches_left.reset();
761 you.zigs_completed = 0;
762 you.zig_max = 0;
763 you.exploration = 0;
764 you.seen_portals = 0; // should be just cosmetic
765 reset_portal_entrances();
766 // would it be safe to just clear you.props?
767 you.props.erase(TEMPLE_SIZE_KEY);
768 you.props.erase(TEMPLE_MAP_KEY);
769 you.props.erase(OVERFLOW_TEMPLES_KEY);
770 you.props.erase(TEMPLE_GODS_KEY);
771 you.clear_place_info();
772 // the following is supposed to clear any persistent lua state related to
773 // the builder. However, it's susceptible to custom dlua doing its own
774 // thing...
775 dlua.callfn("dgn_clear_persistant_data", "");
776
777 // monsters
778 you.unique_creatures.reset();
779
780 // item stuff that can interact with the builder
781 you.runes.reset();
782 you.obtainable_runes = MAX_RUNES;
783 initialise_item_sets(true);
784 you.unique_items.init(UNIQ_NOT_EXISTS);
785 you.octopus_king_rings = 0x00;
786 you.item_description.init(255); // random names need reset after this, e.g.
787 // via debug.dungeon_setup()
788 you.attribute[ATTR_GOLD_GENERATED] = 0;
789 // potentially relevant for item placement in e.g. troves:
790 you.seen_weapon.init(0);
791 you.seen_armour.init(0);
792 you.seen_misc.reset();
793 you.seen_talisman.reset();
794}
795
796static void _dgn_load_colour_grid()
797{

Callers 2

mapstat_build_levelsFunction · 0.85
LUAFNFunction · 0.85

Calls 8

reset_portal_entrancesFunction · 0.85
initialise_item_setsFunction · 0.85
clear_place_infoMethod · 0.80
clearMethod · 0.45
resetMethod · 0.45
eraseMethod · 0.45
callfnMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected