diff options
author | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-12-05 19:14:36 +0530 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-12-05 23:02:59 +0530 |
commit | 20c306a60f1055d933bf77a03d2e529641a4fc19 (patch) | |
tree | e684c74f364737345f93d4ba667d95c864c5ec18 /crawl-ref/source/l_dgnlvl.cc | |
parent | 75874ee8246b0be85caf59c5a3e89309195854ce (diff) | |
download | crawl-ref-20c306a60f1055d933bf77a03d2e529641a4fc19.tar.gz crawl-ref-20c306a60f1055d933bf77a03d2e529641a4fc19.zip |
Add support for Lua hooks triggered during vault generation (dpeg)
Fire hooks at various points during vault generation and allow Lua code in
vaults to add functions to these hooks. Lua hooks are handy when creating
vaults that want to place other vaults (for instance a vault that places
ten copies of another small minivault).
Diffstat (limited to 'crawl-ref/source/l_dgnlvl.cc')
-rw-r--r-- | crawl-ref/source/l_dgnlvl.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crawl-ref/source/l_dgnlvl.cc b/crawl-ref/source/l_dgnlvl.cc index 59223d4bb0..7e3ea5b381 100644 --- a/crawl-ref/source/l_dgnlvl.cc +++ b/crawl-ref/source/l_dgnlvl.cc @@ -35,11 +35,10 @@ BRANCHFN(parent_branch, string, static void _push_level_id(lua_State *ls, const level_id &lid) { - // We're skipping the constructor; naughty, but level_id has no - // virtual methods and no dynamically allocated memory. - level_id *nlev = - static_cast<level_id*>(lua_newuserdata(ls, sizeof(level_id))); - *nlev = lid; + // [ds] Should really set up a metatable to delete (FIXME). + level_id *nlev = static_cast<level_id*>( + lua_newuserdata(ls, sizeof(level_id))); + new (nlev) level_id(lid); } level_id dlua_level_id(lua_State *ls, int ndx) |