summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mapdef.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-26 04:49:33 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-26 04:49:33 +0000
commit9629076ee9f0b7a88048c0eb6d979c5d86a7a3d2 (patch)
treecb7381ef2ff5a76c88624a951070e3495b15e5fb /crawl-ref/source/mapdef.cc
parent300286dd913491e4869d56078d42bab7c47c40db (diff)
downloadcrawl-ref-9629076ee9f0b7a88048c0eb6d979c5d86a7a3d2.tar.gz
crawl-ref-9629076ee9f0b7a88048c0eb6d979c5d86a7a3d2.zip
Start of moving special room definitions (monster lairs and monster pits)
to lua. As of now all special rooms are filled with rats. Introduces two new members to map_def, weight_depth_mult and weight_depth_div, which change a map's weight based on the absolute dungeon depth (not yet accesible via lua or vault definitions). This needs to be done in C++ rather than in lua since a map's lua isn't re-invoked every time a random map is chosen, but only when the map is placed. NOTE: When I first made this change crawl started crashing until I manually forced the recompilation of util/levcomp.lex.o and util/levcomp.tab.o; if crawl starts crashing after this change, try doing that. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7629 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r--crawl-ref/source/mapdef.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 57302d789f..9954147c62 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -1184,10 +1184,10 @@ dlua_set_map::~dlua_set_map()
map_def::map_def()
: name(), tags(), place(), depths(), orient(), chance(), weight(),
- welcome_messages(), map(), mons(), items(), keyspecs(),
- prelude("dlprelude"), main("dlmain"), validate("dlvalidate"),
- veto("dlveto"), rock_colour(BLACK), floor_colour(BLACK),
- index_only(false), cache_offset(0L)
+ weight_depth_mult(), weight_depth_div(), welcome_messages(), map(),
+ mons(), items(), keyspecs(), prelude("dlprelude"), main("dlmain"),
+ validate("dlvalidate"), veto("dlveto"), rock_colour(BLACK),
+ floor_colour(BLACK), index_only(false), cache_offset(0L)
{
init();
}
@@ -1239,6 +1239,12 @@ void map_def::reinit()
// eligible vaults).
weight = 10;
+ // How to modify weight based on absolte dungeon depth. This
+ // needs to be done in the C++ code since the map's lua code doesnt'
+ // get called again each time the depth changes.
+ weight_depth_mult = 0;
+ weight_depth_div = 1;
+
// Clearing the map also zaps map transforms.
map.clear();
mons.clear();