summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorevktalo <evktalo@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-20 11:16:38 +0000
committerevktalo <evktalo@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-20 11:16:38 +0000
commitbb40b309944e95aa6d7b73605a3108d17b7db740 (patch)
tree20bd0a9da20d7753384910759bf4826891973128 /crawl-ref
parentc0c7da4864ed1598594bd372f60058cbe4c3052f (diff)
downloadcrawl-ref-bb40b309944e95aa6d7b73605a3108d17b7db740.tar.gz
crawl-ref-bb40b309944e95aa6d7b73605a3108d17b7db740.zip
Commit r10210 and r10302 to 0.5: milestones for Ziggurats; don't mark milestones before game starts.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.5@10349 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/dat/clua/util.lua9
-rw-r--r--crawl-ref/source/dat/clua/ziggurat.lua11
-rw-r--r--crawl-ref/source/hiscores.cc2
-rw-r--r--crawl-ref/source/luadgn.cc11
4 files changed, 33 insertions, 0 deletions
diff --git a/crawl-ref/source/dat/clua/util.lua b/crawl-ref/source/dat/clua/util.lua
index fa78b189aa..4894f1fc67 100644
--- a/crawl-ref/source/dat/clua/util.lua
+++ b/crawl-ref/source/dat/clua/util.lua
@@ -190,6 +190,15 @@ function util.exists(list, pred)
return false
end
+function util.contains(haystack, needle)
+ for _, value in ipairs(haystack) do
+ if value == needle then
+ return true
+ end
+ end
+ return false
+end
+
function util.random_from(list)
return list[ crawl.random2(#list) + 1 ]
end
diff --git a/crawl-ref/source/dat/clua/ziggurat.lua b/crawl-ref/source/dat/clua/ziggurat.lua
index 9df1acade1..4a4679ba58 100644
--- a/crawl-ref/source/dat/clua/ziggurat.lua
+++ b/crawl-ref/source/dat/clua/ziggurat.lua
@@ -132,7 +132,18 @@ function ziggurat_awaken_all(mons)
mons.beh = beh_wander
end
+function ziggurat_milestone()
+ local depth = zig().depth
+ if util.contains({ 1, 9, 15, 21, 24, 27 }, depth) then
+ crawl.mark_milestone(depth < 27 and "br.enter" or "br.end",
+ (depth == 1 and "entered a Ziggurat" or
+ ("reached level " .. depth .. " of a Ziggurat"))
+ .. ".")
+ end
+end
+
function ziggurat_build_level(e)
+ ziggurat_milestone()
if zig().depth == 1 then
e.welcome("You land on top of a ziggurat so tall you cannot make out the ground.")
end
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index 5132af79e5..8332427ba9 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -2079,6 +2079,8 @@ std::string xlog_fields::xlog_line() const
void mark_milestone(const std::string &type, const std::string &milestone)
{
+ if (crawl_state.arena || !crawl_state.need_save)
+ return;
const std::string milestone_file = Options.save_dir + "milestones.txt";
if (FILE *fp = lk_open("a", milestone_file))
{
diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc
index 465e9e894a..c74dae3676 100644
--- a/crawl-ref/source/luadgn.cc
+++ b/crawl-ref/source/luadgn.cc
@@ -22,6 +22,7 @@ REVISION("$Rev$");
#include "directn.h"
#include "dungeon.h"
#include "files.h"
+#include "hiscores.h"
#include "initfile.h"
#include "items.h"
#include "luadgn.h"
@@ -3090,6 +3091,15 @@ LUAFN(_crawl_args)
return dlua_stringtable(ls, SysEnv.cmd_args);
}
+LUAFN(_crawl_milestone)
+{
+#ifdef DGL_MILESTONES
+ mark_milestone(luaL_checkstring(ls, 1),
+ luaL_checkstring(ls, 2));
+#endif
+ return (0);
+}
+
#ifdef UNIX
LUAFN(_crawl_millis)
{
@@ -3108,6 +3118,7 @@ LUAFN(_crawl_millis)
static const struct luaL_reg crawl_lib[] =
{
{ "args", _crawl_args },
+ { "mark_milestone", _crawl_milestone },
#ifdef UNIX
{ "millis", _crawl_millis },
#endif