summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-10 15:11:07 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-10 15:11:07 +0000
commit684f80b554daadb08cf2c40b8e905737e8655530 (patch)
treee506d5ff31e40b979983a44f5f85b7f3930c0521
parentf8179d2e319879c5cdfa9083efb7edc1327c9bb5 (diff)
downloadcrawl-ref-684f80b554daadb08cf2c40b8e905737e8655530.tar.gz
crawl-ref-684f80b554daadb08cf2c40b8e905737e8655530.zip
Allow "any trap" and "any shop" (alternatives to "random trap" and "random
shop") in des files. Allow using '8', '9' and '0' in monster specifications. Tossed out some unused functions. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1281 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/describe.cc2
-rw-r--r--crawl-ref/source/dungeon.cc11
-rw-r--r--crawl-ref/source/externs.h3
-rw-r--r--crawl-ref/source/libw32c.h2
-rw-r--r--crawl-ref/source/mapdef.cc25
-rw-r--r--crawl-ref/source/mapdef.h9
-rw-r--r--crawl-ref/source/maps.cc15
-rw-r--r--crawl-ref/source/maps.h1
-rw-r--r--crawl-ref/source/misc.cc4
-rw-r--r--crawl-ref/source/misc.h2
-rw-r--r--crawl-ref/source/monstuff.cc10
-rw-r--r--crawl-ref/source/monstuff.h2
-rw-r--r--crawl-ref/source/player.cc5
-rw-r--r--crawl-ref/source/player.h11
-rw-r--r--crawl-ref/source/stash.cc13
-rw-r--r--crawl-ref/source/stash.h2
-rw-r--r--crawl-ref/source/travel.cc21
-rw-r--r--crawl-ref/source/view.cc12
18 files changed, 44 insertions, 106 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index aea61f9d6a..9336702f90 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -343,7 +343,7 @@ int str_to_trap(const std::string &s)
{
ASSERT(NUM_TRAPS == sizeof(trap_names) / sizeof(*trap_names));
- if (s == "random")
+ if (s == "random" || s == "any")
return (TRAP_RANDOM);
else if (s == "suitable")
return (TRAP_INDEPTH);
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 314ddf5d8e..e27c40d2a0 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -6046,6 +6046,17 @@ static void dngn_place_monster(
{
const int mid = monster_type_thing.mid;
int not_used;
+
+ const int mlev = monster_type_thing.mlevel;
+ if (mlev)
+ {
+ if (mlev > 0)
+ monster_level = mlev;
+ else if (mlev == -8)
+ monster_level = 4 + monster_level * 2;
+ else if (mlev == -9)
+ monster_level += 5;
+ }
if (mid != RANDOM_MONSTER && mid < NUM_MONSTERS)
{
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 57102a2603..bfa1f93f60 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -484,9 +484,6 @@ public:
// Take one off the rest counter.
void rest();
- // Decrements the run counter. Identical to rest.
- void rundown();
-
// Checks if shift-run should be aborted and aborts the run if necessary.
// Returns true if you were running and are now no longer running.
bool check_stop_running();
diff --git a/crawl-ref/source/libw32c.h b/crawl-ref/source/libw32c.h
index bb29497292..887a3c6446 100644
--- a/crawl-ref/source/libw32c.h
+++ b/crawl-ref/source/libw32c.h
@@ -50,8 +50,6 @@ void textbackground(int c);
void enable_smart_cursor(bool cursor);
bool is_smart_cursor_enabled();
-inline void srandom(unsigned int seed) { srand(seed); }
-
#endif
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 6a8a79802a..42849a8a17 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -909,6 +909,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
{
std::string s = specs[i];
int weight = find_weight(s);
+ int mlevel = 0;
if (weight == TAG_UNFOUND || weight <= 0)
weight = 10;
@@ -916,15 +917,26 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
const bool generate_awake = strip_tag(s, "generate_awake");
trim_string(s);
- const int mid = mons_by_name(s);
- if (mid == MONS_PROGRAM_BUG)
+ int mid = RANDOM_MONSTER;
+
+ if (s == "8")
+ mlevel = -8;
+ else if (s == "9")
+ mlevel = -9;
+ else if (s != "0")
{
- error = make_stringf("unrecognised monster \"%s\"", s.c_str());
- return (slot);
+ mid = mons_by_name(s);
+
+ if (mid == MONS_PROGRAM_BUG)
+ {
+ error = make_stringf("unrecognised monster \"%s\"", s.c_str());
+ return (slot);
+ }
}
- slot.mlist.push_back( mons_spec(mid, weight, fixmons, generate_awake) );
+ slot.mlist.push_back(
+ mons_spec(mid, weight, mlevel, fixmons, generate_awake) );
}
return (slot);
@@ -1350,7 +1362,8 @@ feature_spec_list keyed_mapspec::parse_feature(const std::string &str)
return (list);
}
- std::vector<dungeon_feature_type> feats = features_by_desc(s);
+ std::vector<dungeon_feature_type> feats =
+ features_by_desc( text_pattern(s, true) );
for (int i = 0, size = feats.size(); i < size; ++i)
list.push_back( feature_spec(feats[i], weight) );
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index 7f0a21eecc..238df8957a 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -155,13 +155,14 @@ private:
struct mons_spec
{
int mid;
- int genweight;
+ int genweight, mlevel;
bool fix_mons;
bool generate_awake;
- mons_spec(int id = RANDOM_MONSTER, int gw = 10, bool _fixmons = false,
- bool awaken = false)
- : mid(id), genweight(gw), fix_mons(_fixmons), generate_awake(awaken)
+ mons_spec(int id = RANDOM_MONSTER, int gw = 10, int ml = 0,
+ bool _fixmons = false, bool awaken = false)
+ : mid(id), genweight(gw), mlevel(ml), fix_mons(_fixmons),
+ generate_awake(awaken)
{
}
};
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index d76b8c4268..660778d67d 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -283,21 +283,6 @@ int random_map_for_place(const std::string &place, bool want_minivault)
return (mapindex);
}
-int find_map_named(const std::string &name)
-{
- if (name.empty())
- return (-1);
-
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Looking for map named \"%s\"", name.c_str());
-#endif
- for (unsigned i = 0, size = vdefs.size(); i < size; ++i)
- if (vdefs[i].name == name)
- return (i);
-
- return (-1);
-}
-
int random_map_for_depth(int depth, bool want_minivault)
{
int mapindex = -1;
diff --git a/crawl-ref/source/maps.h b/crawl-ref/source/maps.h
index 6c098d11c4..0c3211664a 100644
--- a/crawl-ref/source/maps.h
+++ b/crawl-ref/source/maps.h
@@ -41,7 +41,6 @@ int vault_main(map_type vgrid,
const map_def *map_by_index(int index);
int random_map_for_place(const std::string &place, bool mini = false);
-int find_map_named(const std::string &name);
int random_map_for_depth(int depth, bool want_minivault = false);
int random_map_for_tag(const std::string &tag, bool want_minivault);
void add_parsed_map(const map_def &md);
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 5c53d6501e..922b5a15ce 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1975,7 +1975,7 @@ unsigned short get_packed_place()
you.level_type );
}
-bool single_level_branch( int branch )
+bool single_level_branch( branch_type branch )
{
return
branch >= 0 && branch < NUM_BRANCHES
@@ -2175,7 +2175,7 @@ static const char *shop_types[] = {
int str_to_shoptype(const std::string &s)
{
- if (s == "random")
+ if (s == "random" || s == "any")
return (SHOP_RANDOM);
for (unsigned i = 0; i < sizeof(shop_types) / sizeof (*shop_types); ++i)
diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h
index 7eeac53e24..2f2a3c1911 100644
--- a/crawl-ref/source/misc.h
+++ b/crawl-ref/source/misc.h
@@ -189,6 +189,8 @@ int player_branch_depth();
// Get absolute depth given the displayable depth in the branch.
int absdungeon_depth(unsigned char branch, int subdepth);
+
+bool single_level_branch(branch_type branch);
//////////////////////////////////////////////////////////////////////
// Set floor/wall colour based on the mons_alloc array. Used for
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 3df19c9d6c..a810198deb 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1827,16 +1827,6 @@ static void handle_behaviour(struct monsters *mon)
}
} // end handle_behaviour()
-std::string str_simple_monster_message(monsters *mons, const char *event)
-{
- if (mons_near(mons) && player_monster_visible(mons))
- return make_stringf("%s%s",
- ptr_monam(mons, DESC_CAP_THE),
- event );
-
- return ("");
-}
-
// note that this function *completely* blocks messaging for monsters
// distant or invisible to the player ... look elsewhere for a function
// permitting output of "It" messages for the invisible {dlb}
diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h
index e5ea8f2c45..fa35da2074 100644
--- a/crawl-ref/source/monstuff.h
+++ b/crawl-ref/source/monstuff.h
@@ -90,8 +90,6 @@ bool random_near_space( int ox, int oy, int &tx, int &ty,
bool simple_monster_message(const monsters *monster, const char *event,
int channel = MSGCH_PLAIN, int param = 0);
-std::string str_simple_monster_message(monsters *mons, const char *event);
-
/* ***********************************************************************
* called from: acr
* *********************************************************************** */
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 4af04a2195..3944b077c7 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -359,11 +359,6 @@ bool player_is_swimming(void)
return you.swimming();
}
-bool player_floundering()
-{
- return (player_in_water() && !player_can_swim());
-}
-
bool player_under_penance(void)
{
if (you.religion != GOD_NO_GOD)
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index a476b2d40a..9a578f4d7a 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -16,16 +16,6 @@
#include "externs.h"
-std::string actor_name(const monsters *actor, description_level_type desc);
-std::string actor_verb(const monsters *actor, const std::string &verb);
-int actor_size(const monsters *actor);
-int actor_damage_type(const monsters *actor);
-int actor_damage_brand(const monsters *actor);
-bool actor_swimming(const monsters *actor);
-bool actor_floundering(const monsters *actor);
-item_def *actor_weapon(const monsters *actor, int which_attack = -1);
-item_def *actor_shield(const monsters *actor);
-
bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
bool force );
@@ -57,7 +47,6 @@ bool player_light_armour(bool with_skill = false);
* *********************************************************************** */
bool player_in_water(void);
bool player_is_swimming(void);
-bool player_floundering();
bool player_is_levitating(void);
/* ***********************************************************************
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index abc33b44c5..8f08374c36 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -1003,19 +1003,6 @@ bool LevelStashes::is_current() const
return (place == level_id::current());
}
-bool LevelStashes::in_hell() const
-{
- return place.branch >= BRANCH_DIS
- && place.branch <= BRANCH_THE_PIT
- && place.branch != BRANCH_VESTIBULE_OF_HELL;
-}
-
-bool LevelStashes::in_branch(int branchid) const
-{
- return place.branch == branchid;
-}
-
-
std::string LevelStashes::level_name() const
{
return place.describe(true, true);
diff --git a/crawl-ref/source/stash.h b/crawl-ref/source/stash.h
index 5575b04ce0..c384041191 100644
--- a/crawl-ref/source/stash.h
+++ b/crawl-ref/source/stash.h
@@ -239,8 +239,6 @@ public:
void write(std::ostream &os, bool identify = false) const;
std::string level_name() const;
std::string short_level_name() const;
- bool in_hell() const;
- bool in_branch(int) const;
int stash_count() const { return stashes.size() + shops.size(); }
int visible_stash_count() const { return count_stashes() + shops.size(); }
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 19299a1506..663a83009c 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -324,15 +324,6 @@ void toggle_exclude(int x, int y)
}
}
-void forget_square(int x, int y)
-{
- if (you.level_type == LEVEL_LABYRINTH || you.level_type == LEVEL_ABYSS)
- return;
-
- if (is_exclude_root(x, y))
- toggle_exclude(x, y);
-}
-
/*
* Returns true if the square at (x,y) is a dungeon feature the character
* can't (under normal circumstances) safely cross.
@@ -1917,10 +1908,10 @@ static int prompt_travel_branch(int prompt_flags)
}
}
-static int prompt_travel_depth(int branch)
+static int prompt_travel_depth(branch_type branch)
{
// Handle one-level branches by not prompting.
- if ( branches[branch].depth == 1 )
+ if (single_level_branch(branch))
return 1;
char buf[100];
@@ -2028,7 +2019,8 @@ level_pos prompt_translevel_target(int prompt_flags)
target.id.branch = branch;
// User's chosen a branch, so now we ask for a level.
- target.id.depth = prompt_travel_depth(target.id.branch);
+ target.id.depth =
+ prompt_travel_depth(static_cast<branch_type>(target.id.branch));
if (target.id.depth < 1 || target.id.depth >= MAX_LEVELS)
target.id.depth = -1;
@@ -3314,11 +3306,6 @@ bool runrest::is_explore() const
return (runmode == RMODE_EXPLORE || runmode == RMODE_EXPLORE_GREEDY);
}
-void runrest::rundown()
-{
- rest();
-}
-
void runrest::rest()
{
// stop_running() Lua hooks will never see rest stops.
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 82fc5968ab..3074192956 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -224,18 +224,6 @@ void clear_envmap_grid( int x, int y )
env.map_col[x - 1][y - 1].clear();
}
-void clear_envmap( void )
-{
- for (int i = 0; i < GXM; i++)
- {
- for (int j = 0; j < GYM; j++)
- {
- env.map[i][j] = 0;
- env.map_col[i][j].clear();
- }
- }
-}
-
#if defined(WIN32CONSOLE) || defined(DOS)
static unsigned colflag2brand(int colflag)
{