diff options
author | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-29 00:59:40 -0700 |
---|---|---|
committer | Matthew Cline <zelgadis@sourceforge.net> | 2009-10-29 00:59:40 -0700 |
commit | f5cf3b82006ffe51f9462ddc8a6f65dce55a03d6 (patch) | |
tree | 02619aa602cf52d8d2700d9225bb0c2b1ba5c0c8 /crawl-ref/source/newgame.cc | |
parent | e083e2c09aad37199affe880180f2eda90d213ac (diff) | |
download | crawl-ref-f5cf3b82006ffe51f9462ddc8a6f65dce55a03d6.tar.gz crawl-ref-f5cf3b82006ffe51f9462ddc8a6f65dce55a03d6.zip |
Pre- and post-savefile callbacks.
The constructor of class SavefileCallback can be used to add a callback
which is called before a game is saved and after it's restored. This is
useful to move data in and out of you.props, or after a restore if
there's data not stored in the savefile which can be easily regenerated.
NOTE: I experienced some weirdness with C++ global constructors, and
since global constructors probably differ with compiler and system,
until this has been tested on all compiler/system combinations, any code
which uses the callbacks should fail gracefully if the callbacks aren't
called.
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r-- | crawl-ref/source/newgame.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index ffb56cf046..e36fa10a01 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -898,6 +898,11 @@ game_start: fix_up_jiyva_name(); _save_newgame_options(); + + // Pretend that a savefile was just loaded, in order to + // get things setup properly. + SavefileCallback::post_restore(); + return (true); } |