summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-12 01:05:50 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-12 01:05:50 -0800
commit0f338eb725f33ee68843fb3bc178bfd9bc65cb22 (patch)
tree6c4ef451572f2324f9f65ab8063c94e8f840bc2c
parent9f7066eab03883b18610a629a3a84731cd26ca13 (diff)
downloadcrawl-ref-0f338eb725f33ee68843fb3bc178bfd9bc65cb22.tar.gz
crawl-ref-0f338eb725f33ee68843fb3bc178bfd9bc65cb22.zip
Add a CrawlHashTable to monster objects
-rw-r--r--crawl-ref/source/monster.cc2
-rw-r--r--crawl-ref/source/monster.h3
-rw-r--r--crawl-ref/source/tags.cc8
-rw-r--r--crawl-ref/source/tags.h3
4 files changed, 14 insertions, 2 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index db08f3d07e..1982175f14 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -52,7 +52,7 @@ monsters::monsters()
inv(NON_ITEM), spells(), attitude(ATT_HOSTILE), behaviour(BEH_WANDER),
foe(MHITYOU), enchantments(), flags(0L), experience(0), number(0),
colour(BLACK), foe_memory(0), shield_blocks(0), god(GOD_NO_GOD), ghost(),
- seen_context("")
+ seen_context(""), props()
{
travel_path.clear();
}
diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h
index 26b266ee37..83e9f779d1 100644
--- a/crawl-ref/source/monster.h
+++ b/crawl-ref/source/monster.h
@@ -60,6 +60,7 @@ public:
void reset();
public:
+ // Possibly some of these should be moved into the hash table
std::string mname;
monster_type type;
@@ -102,6 +103,8 @@ public:
std::string seen_context; // Non-standard context for
// AI_SEE_MONSTER
+ CrawlHashTable props;
+
public:
mon_attitude_type temp_attitude() const;
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 4b5ab14ae8..0b99e3e2ff 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1928,6 +1928,8 @@ static void marshall_monster(writer &th, const monsters &m)
ASSERT(m.ghost.get());
marshallGhost(th, *m.ghost);
}
+
+ m.props.write(th);
}
static void tag_construct_level_monsters(writer &th)
@@ -2246,6 +2248,12 @@ static void unmarshall_monster(reader &th, monsters &m)
if (mons_is_ghost_demon(m.type))
m.set_ghost(unmarshallGhost(th, _tag_minor_version));
+ if (_tag_minor_version >= TAG_MINOR_MON_PROP)
+ {
+ m.props.clear();
+ m.props.read(th);
+ }
+
m.check_speed();
}
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h
index b843a55329..da4e1211aa 100644
--- a/crawl-ref/source/tags.h
+++ b/crawl-ref/source/tags.h
@@ -61,7 +61,8 @@ enum tag_minor_version
TAG_MINOR_DSTRAITS = 9, // Pre-calculate demonspawn mutations
TAG_MINOR_YOU_PROP = 10, // Player class has CrawlHashTable
TAG_MINOR_SMALL_HASH = 11, // Reduced RAM size of CrawlHashTable
- TAG_MINOR_VERSION = 11 // Current version. (Keep equal to max.)
+ TAG_MINOR_MON_PROP = 12, // Monster class has CrawlHashTable
+ TAG_MINOR_VERSION = 12 // Current version. (Keep equal to max.)
};