diff options
| author | Alexander Gavrilov | 2012-05-17 20:38:27 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-05-17 20:38:27 +0400 |
| commit | f37f708b37bf21ded2ca99fac6db3facd7a05fcf (patch) | |
| tree | 4d8e3da9ae015964b8fb87f10d1845abf87dcf97 /library/Core.cpp | |
| parent | e9ef9b87b575b4746e2090556c192237c95f508a (diff) | |
| download | dfhack-f37f708b37bf21ded2ca99fac6db3facd7a05fcf.tar.gz dfhack-f37f708b37bf21ded2ca99fac6db3facd7a05fcf.tar.bz2 dfhack-f37f708b37bf21ded2ca99fac6db3facd7a05fcf.tar.xz | |
Add a workaround for Planepacked bug in buildings constructed via API.
Buildings hanging in the air cause constructWithFilters to
exhibit the same behavior as a moody dwarf in a burrow excluding
the workshop, i.e. endlessly collecting the same type of reagent.
http://www.bay12games.com/dwarves/mantisbt/view.php?id=1416
The workaround monitors jobs and reclassifies the reagents on the fly.
Diffstat (limited to 'library/Core.cpp')
| -rw-r--r-- | library/Core.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/library/Core.cpp b/library/Core.cpp index 1d2a7602..e8c43b7f 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -71,6 +71,7 @@ using namespace DFHack; using namespace tthread; using namespace df::enums; using df::global::init; +using df::global::world; // FIXME: A lot of code in one file, all doing different things... there's something fishy about it. @@ -1113,8 +1114,18 @@ int Core::Update() return 0; }; +extern bool buildings_do_onupdate; +void buildings_onStateChange(color_ostream &out, state_change_event event); +void buildings_onUpdate(color_ostream &out); + +static int buildings_timer = 0; + void Core::onUpdate(color_ostream &out) { + // convert building reagents + if (buildings_do_onupdate && (++buildings_timer & 1)) + buildings_onUpdate(out); + // notify all the plugins that a game tick is finished plug_mgr->OnUpdate(out); @@ -1124,6 +1135,8 @@ void Core::onUpdate(color_ostream &out) void Core::onStateChange(color_ostream &out, state_change_event event) { + buildings_onStateChange(out, event); + plug_mgr->OnStateChange(out, event); Lua::Core::onStateChange(out, event); |
