summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tags.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-04 10:04:17 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-04 16:50:18 +0100
commit6f10cd2574eeb8a1417eff84718edd309287ac0d (patch)
tree69a45fe0e35cb559a3285b08697c96c230fc0c0f /crawl-ref/source/tags.cc
parent9ad85435681ad82c7ef07d2083e40e525e2b0f55 (diff)
downloadcrawl-ref-6f10cd2574eeb8a1417eff84718edd309287ac0d.tar.gz
crawl-ref-6f10cd2574eeb8a1417eff84718edd309287ac0d.zip
Get rid of multiple-meaning "int object" in env.show.
env.show is now a class show_def that stores tagged unions of type show_type. For the moment, there's also env.show_los for use in LOS determination, but that should become an array of boolean at some point. This breaks save compatibility. Tiles and console version build and appear to work fine, but this kind of change is likely to have some side-effects.
Diffstat (limited to 'crawl-ref/source/tags.cc')
-rw-r--r--crawl-ref/source/tags.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 9300e7329b..a05a0bd18a 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1708,7 +1708,7 @@ static void tag_construct_level(writer &th)
for (int count_y = 0; count_y < GYM; count_y++)
{
marshallByte(th, grd[count_x][count_y]);
- marshallShort(th, env.map[count_x][count_y].object);
+ marshallShowtype(th, env.map[count_x][count_y].object);
marshallShort(th, env.map[count_x][count_y].colour);
marshallShort(th, env.map[count_x][count_y].flags);
marshallLong(th, env.map[count_x][count_y].property);
@@ -1810,6 +1810,22 @@ void unmarshallItem(reader &th, item_def &item)
item.props.read(th);
}
+void marshallShowtype(writer &th, const show_type &obj)
+{
+ marshallByte(th, obj.cls);
+ marshallShort(th, obj.feat); // union
+ marshallShort(th, obj.colour);
+}
+
+show_type unmarshallShowtype(reader &th)
+{
+ show_type obj;
+ obj.cls = static_cast<show_class>(unmarshallByte(th));
+ obj.feat = static_cast<dungeon_feature_type>(unmarshallShort(th));
+ obj.colour = unmarshallShort(th);
+ return (obj);
+}
+
static void tag_construct_level_items(writer &th)
{
// how many traps?
@@ -2073,7 +2089,7 @@ static void tag_read_level( reader &th, char minorVersion )
static_cast<dungeon_feature_type>(
static_cast<unsigned char>(unmarshallByte(th)) );
- env.map[i][j].object = unmarshallShort(th);
+ env.map[i][j].object = unmarshallShowtype(th);
env.map[i][j].colour = unmarshallShort(th);
env.map[i][j].flags = unmarshallShort(th);
env.map[i][j].property = unmarshallLong(th);