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

Method validate_temple_map

crawl-ref/source/mapdef.cc:2750–2797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2748}
2749
2750string map_def::validate_temple_map()
2751{
2752 vector<coord_def> altars = find_glyph('B');
2753
2754 if (has_tag_prefix("temple_overflow_"))
2755 {
2756 if (has_tag_prefix("temple_overflow_generic_"))
2757 {
2758 string matching_tag = make_stringf("temple_overflow_generic_%u",
2759 (unsigned int) altars.size());
2760 if (!has_tag(matching_tag))
2761 {
2762 return make_stringf(
2763 "Temple ('%s') has %u altars and a "
2764 "'temple_overflow_generic_' tag, but does not match the "
2765 "number of altars: should have at least '%s'.",
2766 tags_string().c_str(),
2767 (unsigned int) altars.size(),
2768 matching_tag.c_str());
2769 }
2770 }
2771 else
2772 {
2773 // Assume specialised altar vaults are set up correctly.
2774 return "";
2775 }
2776 }
2777
2778 if (altars.empty())
2779 return "Temple vault must contain at least one altar.";
2780
2781 // TODO: check for substitutions and shuffles
2782
2783 vector<coord_def> b_glyphs = map.find_glyph('B');
2784 for (auto c : b_glyphs)
2785 {
2786 const keyed_mapspec *spec = map.mapspec_at(c);
2787 if (spec != nullptr && !spec->feat.feats.empty())
2788 return "Can't change feat 'B' in temple (KFEAT)";
2789 }
2790
2791 vector<god_type> god_list = temple_god_list();
2792
2793 if (altars.size() > god_list.size())
2794 return "Temple vault has too many altars";
2795
2796 return "";
2797}
2798
2799string map_def::validate_map_placeable()
2800{

Callers

nothing calls this directly

Calls 6

make_stringfFunction · 0.85
temple_god_listFunction · 0.85
find_glyphMethod · 0.80
mapspec_atMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected