and there's vaults on the level, then report which vaults (if any) the problem monsters are in.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8024 c06c8d41-db1a-0410-9941-cceddc491573
3TEB6EUUYKQ4S6WJHX46OXUM4JPDSGJJNGACT7K7IBZU3L2SVJQAC XSENCWVHKZ5NUODAG3ACCDK7SXBPTN4YF6LL4YXCEV557UKXF5TQC T2ZYXC5YLXGQUN5R4VRNTQWJDGD3KS3BVS3KAJ4BZ4GXRCQT2SYQC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC IB4IOXRL7AMMYTUE7GKYDYI6FE5ZFDIUG7DXAZIRMNEPA7KVSSWQC TK2DI6PDNMQWV3WGYEFTRNITLFJ6YXSEMKRDP3FIFGS4W4LSPSMQC DPJBWGZZPH6WNIHLLENQBL3EO2WKHEOPAF777ROBCYBNK6DY5KDQC KQNIGKATHT4YSPJFPJGIGPD6VNR5B753SE2JN2LCXZZJNHCGY3DQC mpr_comma_separated_list("Temp_Vaults: ", vault_names);
mpr_comma_separated_list("Temp_Vaults: ", vault_names," and ", ", ", MSGCH_WARN);}}static bool _inside_vault(const vault_placement& place, const coord_def &pos){const coord_def delta = pos - place.pos;return (delta.x >= 0 && delta.y >= 0&& delta.x < place.size.x && delta.y < place.size.y);}static std::vector<std::string> _in_vaults(const coord_def &pos){std::vector<std::string> out;for (unsigned int i = 0; i < Level_Vaults.size(); i++){const vault_placement &vault = Level_Vaults[i];if (_inside_vault(vault, pos))out.push_back(vault.map.name);
if (warned && Generating_Level)
// No problems?if (!warned)return;// If this wasn't the result of generating a level then there's nothing// more to report.if (!Generating_Level){// Force the dev to notice problems. :Pmore();return;}// No vaults to report on?if (Level_Vaults.size() == 0 && Temp_Vaults.size() == 0){
// Force the dev to notice problems. :Pmore();return;}mpr("");for (unsigned int i = 0; i < floating_mons.size(); i++){const int idx = floating_mons[i];const monsters* mon = &menv[idx];std::vector<std::string> vaults = _in_vaults(mon->pos());std::string str =make_stringf("Floating monster %s (%d, %d)",mon->name(DESC_PLAIN, true).c_str(),mon->pos().x, mon->pos().y);
// If there are warnings, force the dev to notice. :Pif (warned)more();
if (vaults.size() == 0)mprf(MSGCH_WARN, "%s not in any vaults.", str.c_str());elsempr_comma_separated_list(str + " in vault(s) ", vaults," and ", ", ", MSGCH_WARN);}mpr("");for (unsigned int i = 0; i < bogus_pos.size(); i++){const coord_def pos = bogus_pos[i];const int idx = bogus_idx[i];const monsters* mon = &menv[idx];std::string str =make_stringf("Bogus mgrd (%d, %d) pointing to %s",pos.x, pos.y, mon->name(DESC_PLAIN, true).c_str());std::vector<std::string> vaults = _in_vaults(pos);if (vaults.size() == 0)mprf(MSGCH_WARN, "%s not in any vaults.", str.c_str());elsempr_comma_separated_list(str + " in vault(s) ", vaults," and ", ", ", MSGCH_WARN);// Don't report on same monster twice.if (is_floating[idx])continue;str = "Monster pointed to";vaults = _in_vaults(mon->pos());if (vaults.size() == 0)mprf(MSGCH_WARN, "%s not in any vaults.", str.c_str());elsempr_comma_separated_list(str + " in vault(s) ", vaults," and ", ", ", MSGCH_WARN);}mpr("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", MSGCH_ERROR);// Force the dev to notice problems. :Pmore();