summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libutil.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-03-27 14:01:11 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-03-27 14:01:11 +0200
commit13f3e7316f51652e296d9323d64ad67f66046b58 (patch)
tree08afe2c0d6723aa671b5dc0876339eb27fd19d73 /crawl-ref/source/libutil.h
parente176a440239aa6414c8d6e06dafab84f7b66ac48 (diff)
downloadcrawl-ref-13f3e7316f51652e296d9323d64ad67f66046b58.tar.gz
crawl-ref-13f3e7316f51652e296d9323d64ad67f66046b58.zip
Make it impossible to wait out or re-roll Sage cards you don't want.
They redirect a certain amount of xp. Multiple cards work concurrently, diluting each other but not affecting the total amount of xp redirected. Need a formula for how much to redirect.
Diffstat (limited to 'crawl-ref/source/libutil.h')
-rw-r--r--crawl-ref/source/libutil.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h
index 96e596f95a..cb1cb6e1d8 100644
--- a/crawl-ref/source/libutil.h
+++ b/crawl-ref/source/libutil.h
@@ -178,6 +178,14 @@ std::string comma_separated_line(Z start, Z end,
std::string unwrap_desc(std::string desc);
+template <typename Z>
+void erase_any(std::vector<Z> &vec, unsigned long which)
+{
+ if (which != vec.size() - 1)
+ vec[which] = vec[vec.size() - 1];
+ vec.pop_back();
+}
+
inline int sqr(int x)
{
return x * x;