summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorDavid Ploog <dploog@users.sourceforge.net>2009-10-19 05:58:41 +0200
committerDavid Ploog <dploog@users.sourceforge.net>2009-10-19 06:10:57 +0200
commit9ec4ec86a3fbd6067b41d82bf180a99c0a5b9529 (patch)
tree9fc1be6d85945acd304aa8bba5a818706e93817c /crawl-ref/source
parent355302abda4509c6fde141c40f1b1277ca32a557 (diff)
downloadcrawl-ref-9ec4ec86a3fbd6067b41d82bf180a99c0a5b9529.tar.gz
crawl-ref-9ec4ec86a3fbd6067b41d82bf180a99c0a5b9529.zip
Naming monsters via MONS: rat name:Yves (Jude & Vsevolod).
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/dungeon.cc1
-rw-r--r--crawl-ref/source/mapdef.cc7
-rw-r--r--crawl-ref/source/mapdef.h3
-rw-r--r--crawl-ref/source/monplace.cc5
-rw-r--r--crawl-ref/source/monplace.h9
5 files changed, 22 insertions, 3 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 0f70733569..b5f3279e51 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -4730,6 +4730,7 @@ int dgn_place_monster(mons_spec &mspec,
mg.base_type = mspec.monbase;
mg.number = mspec.number;
mg.colour = mspec.colour;
+ mg.mname = mspec.monname;
coord_def place(where);
if (!force_pos && mgrd(place) != NON_MONSTER
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 0d2b5f6864..237e55808f 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -2268,6 +2268,13 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
}
}
+ std::string name = strip_tag_prefix(mon_str, "name:");
+ if (!name.empty())
+ {
+ name = replace_all_of(name, "_", " ");
+ mspec.monname = name;
+ }
+
trim_string(mon_str);
if (mon_str == "8")
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index a7b9bc4d9b..85c8484aef 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -432,6 +432,7 @@ class mons_spec
int colour;
item_list items;
+ std::string monname;
mons_spec(int id = RANDOM_MONSTER,
monster_type base = MONS_PROGRAM_BUG,
@@ -441,7 +442,7 @@ class mons_spec
: mid(id), place(), monbase(base), attitude(ATT_HOSTILE), number(num),
quantity(1), genweight(gw), mlevel(ml), fix_mons(_fixmons),
generate_awake(awaken), patrolling(false), band(false),
- colour(BLACK), items()
+ colour(BLACK), items(), monname("")
{
}
};
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index ac2e0e0ff5..e072d0980c 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -1124,6 +1124,11 @@ static int _place_monster_aux(const mgen_data &mg,
LIGHTBLUE, RED, LIGHTRED, MAGENTA, -1);
}
+ if (mg.mname != "")
+ {
+ menv[id].mname = mg.mname;
+ }
+
// The return of Boris is now handled in monster_die()...
// not setting this for Boris here allows for multiple Borises in
// the dungeon at the same time. -- bwr
diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h
index 4d24ef1815..8d05ee2e21 100644
--- a/crawl-ref/source/monplace.h
+++ b/crawl-ref/source/monplace.h
@@ -180,6 +180,9 @@ struct mgen_data
// be available (vault metadata is not preserved across game saves).
unsigned map_mask;
+ // XXX: Rather hackish.
+ std::string mname;
+
mgen_data(monster_type mt = RANDOM_MONSTER,
beh_type beh = BEH_HOSTILE,
int abj = 0,
@@ -193,12 +196,14 @@ struct mgen_data
int moncolour = BLACK,
int monpower = you.your_level,
proximity_type prox = PROX_ANYWHERE,
- level_area_type ltype = you.level_type)
+ level_area_type ltype = you.level_type,
+ std::string monname = "")
: cls(mt), base_type(base), behaviour(beh),
abjuration_duration(abj), summon_type(st), pos(p), foe(mfoe),
flags(monflags), god(which_god), number(monnumber), colour(moncolour),
- power(monpower), proximity(prox), level_type(ltype), map_mask(0)
+ power(monpower), proximity(prox), level_type(ltype), map_mask(0),
+ mname(monname)
{
ASSERT(summon_type == 0 || (abj >= 1 && abj <= 6)
|| mt == MONS_BALL_LIGHTNING);