diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-12-03 06:54:53 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-12-03 06:54:53 +0000 |
commit | 38e77f4ea4395ed90f12e880224e5bd378113602 (patch) | |
tree | 87a0ca74f0fc77d59a32fd1317f739cf9ddb1530 /crawl-ref/source/tags.cc | |
parent | cca6195c042a64fed711dba3ea0d94bc78b410df (diff) | |
download | crawl-ref-38e77f4ea4395ed90f12e880224e5bd378113602.tar.gz crawl-ref-38e77f4ea4395ed90f12e880224e5bd378113602.zip |
Items can now fall through shaft traps (trap doors). The code is rather
simplistic, and it's not currently possible to make a "baited" shaft;
also, there is no threshold weight, so even a single dart will open up
(and thus reveal) a shaft trap. Breaks savefile compatibility.
Monsters which fall through a shaft now show up 100% of the time on the
player's next visit to the shaft's destination level. Also, the monster is
placed close to the spot where the player would end up if s/he went through
the same shaft.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2988 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tags.cc')
-rw-r--r-- | crawl-ref/source/tags.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index c16e20005f..53f856911f 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -106,10 +106,12 @@ static void tag_construct_you(struct tagHeader &th); static void tag_construct_you_items(struct tagHeader &th); static void tag_construct_you_dungeon(struct tagHeader &th); static void tag_construct_lost_monsters(tagHeader &th); +static void tag_construct_lost_items(tagHeader &th); static void tag_read_you(struct tagHeader &th, char minorVersion); static void tag_read_you_items(struct tagHeader &th, char minorVersion); static void tag_read_you_dungeon(struct tagHeader &th); static void tag_read_lost_monsters(tagHeader &th, int minorVersion); +static void tag_read_lost_items(tagHeader &th, int minorVersion); static void tag_construct_level(struct tagHeader &th); static void tag_construct_level_items(struct tagHeader &th); @@ -586,6 +588,7 @@ void tag_construct(struct tagHeader &th, int tagID) break; case TAG_LOST_MONSTERS: tag_construct_lost_monsters(th); + tag_construct_lost_items(th); break; default: // I don't know how to make that! @@ -687,6 +690,7 @@ int tag_read(FILE *fp, char minorVersion) break; case TAG_LOST_MONSTERS: tag_read_lost_monsters(th, minorVersion); + tag_read_lost_items(th, minorVersion); break; default: // I don't know how to read that! @@ -1085,6 +1089,17 @@ static void marshall_follower_list(tagHeader &th, const m_transit_list &mlist) } } +static void marshall_item_list(tagHeader &th, const i_transit_list &ilist) +{ + marshallShort( th, ilist.size() ); + + for (i_transit_list::const_iterator ii = ilist.begin(); + ii != ilist.end(); ++ii) + { + marshallItem( th, *ii ); + } +} + static m_transit_list unmarshall_follower_list(tagHeader &th) { m_transit_list mlist; @@ -1101,12 +1116,34 @@ static m_transit_list unmarshall_follower_list(tagHeader &th) return (mlist); } +static i_transit_list unmarshall_item_list(tagHeader &th) +{ + i_transit_list ilist; + + const int size = unmarshallShort(th); + + for (int i = 0; i < size; ++i) + { + item_def item; + unmarshallItem(th, item); + ilist.push_back(item); + } + + return (ilist); +} + static void tag_construct_lost_monsters(tagHeader &th) { marshallMap( th, the_lost_ones, marshall_level_id, marshall_follower_list ); } +static void tag_construct_lost_items(tagHeader &th) +{ + marshallMap( th, transiting_items, marshall_level_id, + marshall_item_list ); +} + static void tag_read_you(struct tagHeader &th, char minorVersion) { char buff[20]; // For birth date @@ -1467,6 +1504,14 @@ static void tag_read_lost_monsters(tagHeader &th, int minorVersion) unmarshall_level_id, unmarshall_follower_list); } +static void tag_read_lost_items(tagHeader &th, int minorVersion) +{ + transiting_items.clear(); + + unmarshallMap(th, transiting_items, + unmarshall_level_id, unmarshall_item_list); +} + // ------------------------------- level tags ---------------------------- // static void tag_construct_level(struct tagHeader &th) |