Should not highlight unvisited stairs in the Vestibule, since travel cache doesn't track visited-ness of Vestibule stairs.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1706 c06c8d41-db1a-0410-9941-cceddc491573
2ZZD6EYMSPVCXZTICL4VGYGGQRRWDLZ24KBCDBVIYC54OZ4C6GGAC
XHNJ2W4AQHIF32P2ENIMMDLWAIFWP442KJIZC6RKS4HBJNZIHHBAC
7SHTBTXKO5V35YLX5O5TNIBPZ3IVMDWSTUEYJQJHAGUACAR57I6QC
IVVTHLTTLOP5TSULXJWUSSXHOKYWVU3OWKYVK45A7RIB6V34MYQAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
ZJLJGSB2XSBQU42OFQMXL3EG4CXAQGOYAU6YTV2SAWZEJIPFH2CAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
W52PCSHX72WAMWKG6L4BPUBVMO6E72KYYBNKAA7554KNOTY6V7WQC
AUYQDKLMOG4FGH2T3LACX4TH632DPKVXBNV5VU6PIVUEWSIO4LQQC
WKTZHLOJ65WSK6FR5MF7RWGSMZ22T2D6LHB66FV3IPGXIBLYHHNAC
7KWDC7XFNMBLSUO2HISIROBINZBX5T67LJEEXTAORXW2YZ7VWFGAC
JQFQX7IWSJ4TYWVUVXAFMCPSAN67PRMNECDQI5WMON2JFMQVVUEQC
KFJEFN377VIZ7OH2XCYOGCELNEGO4CIOOP7DNXEMX3LFKIKWXVTAC
MSQI3TH6T62JAXQGLL52QZCWAMC372TGB6ZNNRDGUGMJKBNNV2VAC
34C4U6EQWERY75GZJKUCM5KVGU2OUICETS5LGZF6RMKMZT4R5SQAC
JDM27QE4HR52AYFSQE763BFF57ANOTF5MXKMO377PP5EXMN7SAOAC
UPU5QYUWCXSX233JNGE37QEN5TG5HDRGLNSCEKHH3GPU4AEXW3KAC
442VGKMARB6LTQUEBIB5P447EI34BRJL6JALZKXLWPDHWCM6KKCQC
AUXHSGS4EFOPZ6TVZYWNVOUDO7NYKUKE3HBKGQQWTALSVFOE3HAAC
R6XS2HO5QX2FJUGL5UQQRNETKCMYWTUFPHPPS5SYWK3OQA4UDUQQC
};
class nsubst_spec : public map_transformer
{
public:
nsubst_spec(int key, const std::vector<subst_spec> &specs);
std::string apply_transform(map_lines &map);
map_transformer *clone() const;
transform_type type() const { return TT_NSUBST; }
std::string describe() const;
public:
int key;
std::vector<subst_spec> specs;
transforms.push_back( new subst_spec( key, sep == ':', repl ) );
std::string map_lines::parse_nsubst_spec(const std::string &s,
subst_spec &spec)
{
std::string key, arg;
int sep;
std::string err = split_key_item(s, &key, &sep, &arg);
if (!err.empty())
return err;
const int keyval = key == "*"? -1 : atoi(key.c_str());
if (!keyval)
return make_stringf("Illegal spec: %s", s.c_str());
glyph_replacements_t repl;
err = parse_glyph_replacements(arg, repl);
if (!err.empty())
return (err);
spec = subst_spec(keyval, sep == ':', repl);
return ("");
}
std::string map_lines::add_nsubst(const std::string &s)
{
std::vector<subst_spec> substs;
int sep;
std::string key, arg;
std::string err = split_key_item(s, &key, &sep, &arg);
if (!err.empty())
return (err);
std::vector<std::string> segs = split_string("/", arg);
for (int i = 0, size = segs.size(); i < size; ++i)
{
std::string &ns = segs[i];
if (ns.find('=') == std::string::npos
&& ns.find(':') == std::string::npos)
{
if (i < size - 1)
ns = "1=" + ns;
else
ns = "*=" + ns;
}
subst_spec spec;
err = parse_nsubst_spec(ns, spec);
if (!err.empty())
return (make_stringf("Bad NSUBST spec: %s (%s)",
s.c_str(), err.c_str()));
substs.push_back(spec);
}
}
void map_lines::nsubst(nsubst_spec &spec)
{
std::vector<coord_def> positions;
for (int y = 0, ysize = lines.size(); y < ysize; ++y)
{
std::string::size_type pos = 0;
while ((pos = lines[y].find(spec.key, pos)) != std::string::npos)
positions.push_back(coord_def(pos++, y));
}
scramble(positions);
int pcount = 0;
const int psize = positions.size();
for (int i = 0, size = spec.specs.size(); i < size && pcount < psize; ++i)
{
const int nsubsts = spec.specs[i].key();
pcount += apply_nsubst(positions, pcount, nsubsts, spec.specs[i]);
}
}
int map_lines::apply_nsubst(std::vector<coord_def> &pos,
int start, int nsub,
subst_spec &spec)
{
if (nsub == -1)
nsub = pos.size();
const int end = std::min(start + nsub, (int) pos.size());
int substituted = 0;
for (int i = start; i < end; ++i)
{
const int val = spec.value();
const coord_def &c = pos[i];
lines[c.y][c.x] = val;
++substituted;
}
return (substituted);
// nsubst_spec
nsubst_spec::nsubst_spec(int _key, const std::vector<subst_spec> &_specs)
: key(_key), specs(_specs)
{
}
std::string nsubst_spec::apply_transform(map_lines &map)
{
map.nsubst(*this);
return ("");
}
map_transformer *nsubst_spec::clone() const
{
return new nsubst_spec(key, specs);
}
std::string nsubst_spec::describe() const
{
return ("");
}
//////////////////////////////////////////////////////////////////////////
? = 3:w / *:l
replaces three occurrences (randomly selected) of ? with w
and all others with l.
You can use complex SUBST specifications:
? = 3= w .:15 A / *: =+CF
This is equivalent to SUBST: ? = w .:15 A for three ? and
SUBST: ? : =+CF for all the others.
You use any number of NSUBST specifiers:
? = wW / l / A / 1234
Each specifier is preceded by the number of symbols to apply
it to, followed by : or = (: to use one substitution for all
occurrences, = to randomly pick for each occurrence). If you
omit the initial N: or N=, then 1= is assumed, except for the
last spec where *= is assumed.