From c4246fc216beca0282bf281274a3756a10086f87 Mon Sep 17 00:00:00 2001 From: Jude Brown Date: Sun, 17 Jan 2010 15:29:52 +1000 Subject: Code to alter/check feature properties in Lua. This commit moves str_to_fprop from initfile.cc to fprop.cc. It also introduces two new dungeon Lua wrappers: fprop_changed(x, y, fprop), and fprop_at(x, y, fprop). fprop_at(x, y, fprop) will return testbits(coord_def(x, y), fprop). fprop_changed will either add the fprop to that location, or if it already exists there, it will remove it from that location. It will returrn a boolean value of true if it altered the location, and false if it did nothing. --- crawl-ref/source/fprop.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crawl-ref/source/fprop.cc') diff --git a/crawl-ref/source/fprop.cc b/crawl-ref/source/fprop.cc index 50023409d0..5ab09c5279 100644 --- a/crawl-ref/source/fprop.cc +++ b/crawl-ref/source/fprop.cc @@ -23,3 +23,21 @@ bool is_bloodcovered(const coord_def& p) { return (testbits(env.pgrid(p), FPROP_BLOODY)); } + +int str_to_fprop ( const std::string &str) +{ + if (str == "bloody") + return (FPROP_BLOODY); + if (str == "no_cloud_gen") + return (FPROP_NO_CLOUD_GEN); + if (str == "no_rtele_into") + return (FPROP_NO_RTELE_INTO); + if (str == "no_ctele_into") + return (FPROP_NO_CTELE_INTO); + if (str == "no_tele_into") + return (FPROP_NO_TELE_INTO); + + return (FPROP_NONE); +} + + -- cgit v1.2.3-54-g00ecf