summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohanna Ploog <j-p-e-g@users.sourceforge.net>2010-01-10 00:43:01 +0100
committerJohanna Ploog <j-p-e-g@users.sourceforge.net>2010-01-10 00:43:01 +0100
commit0f55e73c6f9d41b127a25186fc502e2c95f17f46 (patch)
tree4d6669ccc1780026b8046f739f9ef61ce41ddd8c
parent9d79dc038f1d09f3ef9aa375c2c885b987ebb8ef (diff)
downloadcrawl-ref-0f55e73c6f9d41b127a25186fc502e2c95f17f46.tar.gz
crawl-ref-0f55e73c6f9d41b127a25186fc502e2c95f17f46.zip
Also list cloud type for fog generator exclusion annotations.
Increases minor version by one as travel_exclude now stores a string rather than the monster type, which is more versatile and can also be used for cloud names.
-rw-r--r--crawl-ref/source/exclude.cc71
-rw-r--r--crawl-ref/source/exclude.h6
-rw-r--r--crawl-ref/source/monster.cc2
-rw-r--r--crawl-ref/source/tags.h3
4 files changed, 52 insertions, 30 deletions
diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc
index f37d08eb0c..7c57f32dad 100644
--- a/crawl-ref/source/exclude.cc
+++ b/crawl-ref/source/exclude.cc
@@ -7,6 +7,7 @@
#include "exclude.h"
+#include "cloud.h"
#include "coord.h"
#include "coordit.h"
#include "map_knowledge.h"
@@ -124,10 +125,10 @@ static opacity_excl opc_excl;
// skip LOS calculation in that case anyway since it doesn't
// currently short-cut for small bounds. So radius 0, 1 are special-cased.
travel_exclude::travel_exclude(const coord_def &p, int r,
- bool autoexcl, monster_type mons, bool vaultexcl)
+ bool autoexcl, std::string dsc, bool vaultexcl)
: pos(p), radius(r),
los(los_def(p, opc_excl, circle_def(r, C_ROUND))),
- uptodate(false), autoex(autoexcl), mon(mons), vault(vaultexcl)
+ uptodate(false), autoex(autoexcl), desc(dsc), vault(vaultexcl)
{
set_los();
}
@@ -136,7 +137,7 @@ travel_exclude::travel_exclude(const coord_def &p, int r,
travel_exclude::travel_exclude()
: pos(-1, -1), radius(-1),
los(coord_def(-1, -1), opc_excl, circle_def(-1, C_ROUND)),
- uptodate(false), autoex(false), mon(MONS_NO_MONSTER), vault(false)
+ uptodate(false), autoex(false), desc(""), vault(false)
{
}
@@ -207,10 +208,10 @@ void exclude_set::add_exclude(travel_exclude &ex)
}
void exclude_set::add_exclude(const coord_def &p, int radius,
- bool autoexcl, monster_type mons,
+ bool autoexcl, std::string desc,
bool vaultexcl)
{
- travel_exclude ex(p, radius, autoexcl, mons, vaultexcl);
+ travel_exclude ex(p, radius, autoexcl, desc, vaultexcl);
add_exclude(ex);
}
@@ -464,7 +465,7 @@ void set_exclude(const coord_def &p, int radius, bool autoexcl, bool vaultexcl,
}
else
{
- monster_type montype = MONS_NO_MONSTER;
+ std::string desc = "";
if (!defer_updates)
{
// Don't list a monster in the exclusion annotation if the
@@ -473,11 +474,18 @@ void set_exclude(const coord_def &p, int radius, bool autoexcl, bool vaultexcl,
if (m && (you.can_see(m) || mons_is_stationary(m)
&& testbits(m->flags, MF_SEEN)))
{
- montype = m->type;
+ desc = mons_type_name(m->type, DESC_PLAIN);
}
}
+ else
+ {
+ int cl = env.cgrid(p);
+
+ if (env.cgrid(p) != EMPTY_CLOUD)
+ desc = cloud_name(cl);
+ }
- curr_excludes.add_exclude(p, radius, autoexcl, montype, vaultexcl);
+ curr_excludes.add_exclude(p, radius, autoexcl, desc, vaultexcl);
}
if (!defer_updates)
@@ -490,9 +498,13 @@ void maybe_remove_autoexclusion(const coord_def &p)
{
if (travel_exclude *exc = curr_excludes.get_exclude_root(p))
{
+ if (!exc->autoex)
+ return;
+
const monsters *m = monster_at(p);
- if (exc->autoex && (!m || !you.can_see(m) || m->type != exc->mon
- || m->attitude != ATT_HOSTILE))
+ if (!m || !you.can_see(m) || m->attitude != ATT_HOSTILE
+ || strcmp(mons_type_name(m->type, DESC_PLAIN).c_str(),
+ exc->desc.c_str()) != 0)
{
del_exclude(p);
}
@@ -502,14 +514,14 @@ void maybe_remove_autoexclusion(const coord_def &p)
// Lists all exclusions on the current level.
std::string exclude_set::get_exclusion_desc()
{
- std::vector<std::string> monsters;
+ std::vector<std::string> desc;
int count_other = 0;
for (exclmap::iterator it = exclude_roots.begin();
it != exclude_roots.end(); ++it)
{
travel_exclude &ex = it->second;
- if (!invalid_monster_type(ex.mon))
- monsters.push_back(mons_type_name(ex.mon, DESC_PLAIN));
+ if (ex.desc != "")
+ desc.push_back(ex.desc);
else
count_other++;
}
@@ -517,22 +529,22 @@ std::string exclude_set::get_exclusion_desc()
if (count_other > 0)
{
snprintf(info, INFO_SIZE, "%d %sexclusion%s",
- count_other, monsters.empty() ? "" : "more ",
+ count_other, desc.empty() ? "" : "more ",
count_other > 1 ? "s" : "");
- monsters.push_back(info);
+ desc.push_back(info);
}
- else if (monsters.empty())
+ else if (desc.empty())
return "";
- std::string desc = "";
- if (monsters.size() > 1 || count_other == 0)
+ std::string desc_str = "";
+ if (desc.size() > 1 || count_other == 0)
{
snprintf(info, INFO_SIZE, "exclusion%s: ",
- monsters.size() > 1 ? "s" : "");
- desc += info;
+ desc.size() > 1 ? "s" : "");
+ desc_str += info;
}
- return (desc + comma_separated_line(monsters.begin(), monsters.end(),
- ", and ", ", "));
+ return (desc_str + comma_separated_line(desc.begin(), desc.end(),
+ ", and ", ", "));
}
@@ -548,7 +560,7 @@ void marshallExcludes(writer& outf, const exclude_set& excludes)
marshallCoord(outf, ex.pos);
marshallShort(outf, ex.radius);
marshallBoolean(outf, ex.autoex);
- marshallShort(outf, ex.mon);
+ marshallString(outf, ex.desc);
// XXX: marshall travel_exclude::vault?
}
}
@@ -566,11 +578,18 @@ void unmarshallExcludes(reader& inf, char minorVersion, exclude_set &excludes)
unmarshallCoord(inf, c);
const int radius = unmarshallShort(inf);
bool autoexcl = false;
- monster_type mon = MONS_NO_MONSTER;
autoexcl = unmarshallBoolean(inf);
- mon = static_cast<monster_type>(unmarshallShort(inf));
+ std::string desc = "";
+ if (minorVersion < TAG_MINOR_EXCLUSION_DESC)
+ {
+ monster_type mon = static_cast<monster_type>(unmarshallShort(inf));
+ if (mon != MONS_NO_MONSTER)
+ desc = mons_type_name(mon, DESC_PLAIN);
+ }
+ else
+ desc = unmarshallString(inf);
- excludes.add_exclude(c, radius, autoexcl, mon);
+ excludes.add_exclude(c, radius, autoexcl, desc);
}
}
}
diff --git a/crawl-ref/source/exclude.h b/crawl-ref/source/exclude.h
index 16462e1f28..0889d4679f 100644
--- a/crawl-ref/source/exclude.h
+++ b/crawl-ref/source/exclude.h
@@ -28,11 +28,11 @@ public:
los_def los; // los from exclusion centre
bool uptodate; // Is los up to date?
bool autoex; // Was set automatically.
- monster_type mon; // Monster around which exclusion is centered.
+ std::string desc; // Exclusion description.
bool vault; // Is this exclusion set by a vault?
travel_exclude(const coord_def &p, int r = LOS_RADIUS,
- bool autoex = false, monster_type mons = MONS_NO_MONSTER,
+ bool autoex = false, std::string desc = "",
bool vault = false);
// For exclude_map[p] = foo;
travel_exclude();
@@ -62,7 +62,7 @@ public:
void add_exclude(travel_exclude &ex);
void add_exclude(const coord_def &p, int radius = LOS_RADIUS,
bool autoexcl = false,
- monster_type mons = MONS_NO_MONSTER,
+ std::string desc = "",
bool vaultexcl = false);
void update_excluded_points();
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index c2139a4b90..c67ad4785b 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -1161,11 +1161,13 @@ bool monsters::drop_item(int eslot, int near)
if (pitem->flags & ISFLAG_SUMMONED)
{
if (need_message(near))
+ {
mprf("%s %s as %s drops %s!",
pitem->name(DESC_CAP_THE).c_str(),
summoned_poof_msg(this, *pitem).c_str(),
name(DESC_NOCAP_THE).c_str(),
pitem->quantity > 1 ? "them" : "it");
+ }
item_was_destroyed(*pitem, mindex());
destroy_item(item_index);
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h
index 7cf59c42c9..e2559d33fd 100644
--- a/crawl-ref/source/tags.h
+++ b/crawl-ref/source/tags.h
@@ -49,7 +49,8 @@ enum tag_minor_version
TAG_MINOR_RESET = 0, // Minor tags were reset
TAG_MINOR_SEEN_WEAPONS_ARMOUR = 1,
TAG_MINOR_BEHELD16 = 2, // Use correct type sizes for beholders
- TAG_MINOR_VERSION = 2 // Current version. (Keep equal to max.)
+ TAG_MINOR_EXCLUSION_DESC = 3, // Mark exclusion reason in annotation.
+ TAG_MINOR_VERSION = 3 // Current version. (Keep equal to max.)
};
struct enum_info