From 56ef33ea0e5c6236239b4af43f00cb182c181987 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 10 Nov 2012 17:33:05 +0400 Subject: [PATCH] Support building steam engines on top of brooks without any down stairs. --- library/include/TileTypes.h | 6 ++++++ library/xml | 2 +- plugins/steam-engine.cpp | 8 +++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/library/include/TileTypes.h b/library/include/TileTypes.h index d21fb3c17..48c10146a 100644 --- a/library/include/TileTypes.h +++ b/library/include/TileTypes.h @@ -203,6 +203,12 @@ namespace DFHack return ENUM_ATTR(tiletype_shape, passable_flow, tileShape(tiletype)); } + inline + bool FlowPassableDown(df::tiletype tiletype) + { + return ENUM_ATTR(tiletype_shape, passable_flow_down, tileShape(tiletype)); + } + inline bool isWalkable(df::tiletype tiletype) { diff --git a/library/xml b/library/xml index 02e0e0d7b..4b2124957 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 02e0e0d7b9a7ef708a621ef5511a24bf8657b4a2 +Subproject commit 4b2124957e282683480eaf05922e63c353364ec1 diff --git a/plugins/steam-engine.cpp b/plugins/steam-engine.cpp index d884191e5..60f38ef83 100644 --- a/plugins/steam-engine.cpp +++ b/plugins/steam-engine.cpp @@ -320,7 +320,7 @@ struct workshop_hook : df::building_workshopst { for (int y = y1; y <= y2; y++) { auto ptile = Maps::getTileType(x,y,z); - if (!ptile || !LowPassable(*ptile)) + if (!ptile || !FlowPassableDown(*ptile)) continue; auto pltile = Maps::getTileType(x,y,z-1); @@ -891,7 +891,7 @@ IMPLEMENT_VMETHOD_INTERPOSE(dwarfmode_hook, feed); * Scan raws for matching workshop buildings. */ -static bool find_engines() +static bool find_engines(color_ostream &out) { engines.clear(); @@ -943,6 +943,8 @@ static bool find_engines() if (!ws.gear_tiles.empty()) engines.push_back(ws); + else + out.printerr("%s has no gear tiles - ignoring.\n", wslist[i]->code.c_str()); } return !engines.empty(); @@ -973,7 +975,7 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan { switch (event) { case SC_WORLD_LOADED: - if (find_engines()) + if (find_engines(out)) { out.print("Detected steam engine workshops - enabling plugin.\n"); enable_hooks(true);