|
|
@ -11,6 +11,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
// DF data structure definition headers
|
|
|
|
// DF data structure definition headers
|
|
|
|
#include "DataDefs.h"
|
|
|
|
#include "DataDefs.h"
|
|
|
|
|
|
|
|
#include "LuaTools.h"
|
|
|
|
#include "MiscUtils.h"
|
|
|
|
#include "MiscUtils.h"
|
|
|
|
#include "Types.h"
|
|
|
|
#include "Types.h"
|
|
|
|
#include "df/viewscreen_dwarfmodest.h"
|
|
|
|
#include "df/viewscreen_dwarfmodest.h"
|
|
|
@ -85,6 +86,25 @@ struct SuspendedBuilding
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool is_planned_building(df::building *bld)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto L = Lua::Core::State;
|
|
|
|
|
|
|
|
color_ostream_proxy out(Core::getInstance().getConsole());
|
|
|
|
|
|
|
|
Lua::StackUnwinder top(L);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!lua_checkstack(L, 2) ||
|
|
|
|
|
|
|
|
!Lua::PushModulePublic(
|
|
|
|
|
|
|
|
out, L, "plugins.buildingplan", "isPlannedBuilding"))
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Lua::Push(L, bld);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Lua::SafeCall(out, L, 1, 1))
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return lua_toboolean(L, -1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DFHACK_PLUGIN_IS_ENABLED(enabled);
|
|
|
|
DFHACK_PLUGIN_IS_ENABLED(enabled);
|
|
|
|
static bool buildings_scanned = false;
|
|
|
|
static bool buildings_scanned = false;
|
|
|
|
static vector<SuspendedBuilding> suspended_buildings, resumed_buildings;
|
|
|
|
static vector<SuspendedBuilding> suspended_buildings, resumed_buildings;
|
|
|
@ -101,7 +121,7 @@ void scan_for_suspended_buildings()
|
|
|
|
if (job)
|
|
|
|
if (job)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SuspendedBuilding sb(bld);
|
|
|
|
SuspendedBuilding sb(bld);
|
|
|
|
sb.is_planned = job->job_items.size() == 1 && job->job_items[0]->item_type == item_type::NONE;
|
|
|
|
sb.is_planned = is_planned_building(bld);
|
|
|
|
|
|
|
|
|
|
|
|
auto it = resumed_buildings.begin();
|
|
|
|
auto it = resumed_buildings.begin();
|
|
|
|
|
|
|
|
|
|
|
|