From 8d1fa5916d012588e2eaa62fcdcc62768dcb86e1 Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Sun, 17 Jan 2010 11:28:50 +0530 Subject: Add FPROP_NO_TIDE to tell the tide not to touch certain squares. Wizmode &( now accepts fprop names to set the fprop on the current square. --- crawl-ref/source/dgn-shoals.cc | 4 ++++ crawl-ref/source/fprop.cc | 11 ++++++++--- crawl-ref/source/fprop.h | 17 +++++++++++------ crawl-ref/source/mapdef.cc | 5 +++-- crawl-ref/source/wiz-dgn.cc | 17 ++++++++++++++--- 5 files changed, 40 insertions(+), 14 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/dgn-shoals.cc b/crawl-ref/source/dgn-shoals.cc index 3f9637cbad..e5bee1e121 100644 --- a/crawl-ref/source/dgn-shoals.cc +++ b/crawl-ref/source/dgn-shoals.cc @@ -9,6 +9,7 @@ #include "dgn-height.h" #include "env.h" #include "flood_find.h" +#include "fprop.h" #include "items.h" #include "maps.h" #include "mgen_data.h" @@ -846,6 +847,9 @@ static tide_direction _shoals_feature_tide_height_change( static void _shoals_apply_tide_at(coord_def c, int tide) { + if (is_tide_immune(c)) + return; + const int effective_height = dgn_height_at(c) - tide; dungeon_feature_type newfeat = _shoals_feature_by_height(effective_height); diff --git a/crawl-ref/source/fprop.cc b/crawl-ref/source/fprop.cc index 5ab09c5279..de4f5e2dde 100644 --- a/crawl-ref/source/fprop.cc +++ b/crawl-ref/source/fprop.cc @@ -24,7 +24,12 @@ bool is_bloodcovered(const coord_def& p) return (testbits(env.pgrid(p), FPROP_BLOODY)); } -int str_to_fprop ( const std::string &str) +bool is_tide_immune(const coord_def &p) +{ + return (env.pgrid(p) & FPROP_NO_TIDE); +} + +feature_property_type str_to_fprop(const std::string &str) { if (str == "bloody") return (FPROP_BLOODY); @@ -36,8 +41,8 @@ int str_to_fprop ( const std::string &str) return (FPROP_NO_CTELE_INTO); if (str == "no_tele_into") return (FPROP_NO_TELE_INTO); + if (str == "no_tide") + return (FPROP_NO_TIDE); return (FPROP_NONE); } - - diff --git a/crawl-ref/source/fprop.h b/crawl-ref/source/fprop.h index 54be5a597e..88e5fab10b 100644 --- a/crawl-ref/source/fprop.h +++ b/crawl-ref/source/fprop.h @@ -3,10 +3,6 @@ struct coord_def; -bool is_sanctuary( const coord_def& p ); -bool is_bloodcovered( const coord_def& p ); -int str_to_fprop (const std::string &str); - enum feature_property_type { FPROP_NONE = 0, @@ -14,13 +10,22 @@ enum feature_property_type FPROP_SANCTUARY_2 = (1 << 2), FPROP_BLOODY = (1 << 3), FPROP_VAULT = (1 << 4), - FPROP_HIGHLIGHT = (1 << 5), // Highlight grids on the X map for debugging. + FPROP_HIGHLIGHT = (1 << 5), // Highlight on the X map for debugging. // NOTE: Bloody floor and sanctuary are exclusive. FPROP_UNUSED = (1 << 6), // used to be force_exclude FPROP_NO_CLOUD_GEN = (1 << 7), FPROP_NO_RTELE_INTO = (1 << 8), FPROP_NO_CTELE_INTO = (1 << 9), - FPROP_NO_TELE_INTO = FPROP_NO_RTELE_INTO | FPROP_NO_CTELE_INTO + FPROP_NO_TELE_INTO = FPROP_NO_RTELE_INTO | FPROP_NO_CTELE_INTO, + + // Squares that the tide should not affect. + FPROP_NO_TIDE = (1 << 10) }; + +bool is_sanctuary(const coord_def& p); +bool is_bloodcovered(const coord_def& p); +bool is_tide_immune(const coord_def &p); +feature_property_type str_to_fprop(const std::string &str); + #endif diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 09b233fc53..8f6f2fa02d 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -996,7 +996,8 @@ void map_lines::overlay_fprops(fprop_spec &spec) for (int y = 0, ysize = lines.size(); y < ysize; ++y) { std::string::size_type pos = 0; - while ((pos = lines[y].find_first_of(spec.key, pos)) != std::string::npos) + while ((pos = lines[y].find_first_of(spec.key, pos)) + != std::string::npos) { (*overlay)(pos, y).property |= spec.get_property(); ++pos; @@ -3147,7 +3148,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) summon_type = static_cast(str_to_summon_type(s_type)); if (summon_type == SPELL_NO_SPELL) { - error = make_stringf("bad monster summon type: \"%s\"", + error = make_stringf("bad monster summon type: \"%s\"", s_type.c_str()); return (slot); } diff --git a/crawl-ref/source/wiz-dgn.cc b/crawl-ref/source/wiz-dgn.cc index 8251e6c76e..78d6119bdf 100644 --- a/crawl-ref/source/wiz-dgn.cc +++ b/crawl-ref/source/wiz-dgn.cc @@ -289,12 +289,23 @@ void wizard_create_feature() feat = dungeon_feature_by_name(name); if (feat == DNGN_UNSEEN) // no exact match { - std::vector matches = dungeon_feature_matches(name); + std::vector matches = + dungeon_feature_matches(name); if (matches.empty()) { - mprf(MSGCH_DIAGNOSTICS, "No features matching '%s'", - name.c_str()); + const feature_property_type fprop(str_to_fprop(name)); + if (fprop != FPROP_NONE) + { + env.pgrid(you.pos()) |= fprop; + mprf("Set fprops \"%s\" at (%d,%d)", + name.c_str(), you.pos().x, you.pos().y); + } + else + { + mprf(MSGCH_DIAGNOSTICS, "No features matching '%s'", + name.c_str()); + } return; } -- cgit v1.2.3