|
|
@ -815,33 +815,6 @@ IMPLEMENT_VMETHOD_INTERPOSE(buildingplan_query_hook, render);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(buildingplan_place_hook, render);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(buildingplan_place_hook, render);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(buildingplan_room_hook, render);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(buildingplan_room_hook, render);
|
|
|
|
|
|
|
|
|
|
|
|
static DFHack::PersistentDataItem get_ui_settings_config()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
static const std::string settings_persistence_key =
|
|
|
|
|
|
|
|
"buildingplan/ui_settings";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool added;
|
|
|
|
|
|
|
|
DFHack::PersistentDataItem config =
|
|
|
|
|
|
|
|
DFHack::World::GetPersistentData(settings_persistence_key, &added);
|
|
|
|
|
|
|
|
if (added)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
config.ival(0) = quickfort_mode;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return config;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void load_settings()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
DFHack::PersistentDataItem config = get_ui_settings_config();
|
|
|
|
|
|
|
|
quickfort_mode = config.ival(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void save_settings()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
DFHack::PersistentDataItem config = get_ui_settings_config();
|
|
|
|
|
|
|
|
config.ival(0) = quickfort_mode;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static command_result buildingplan_cmd(color_ostream &out, vector <string> & parameters)
|
|
|
|
static command_result buildingplan_cmd(color_ostream &out, vector <string> & parameters)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!parameters.empty())
|
|
|
|
if (!parameters.empty())
|
|
|
@ -870,10 +843,7 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable)
|
|
|
|
if (enable != is_enabled)
|
|
|
|
if (enable != is_enabled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (DFHack::Core::getInstance().isMapLoaded())
|
|
|
|
if (DFHack::Core::getInstance().isMapLoaded())
|
|
|
|
{
|
|
|
|
|
|
|
|
load_settings();
|
|
|
|
|
|
|
|
planner.reset();
|
|
|
|
planner.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!INTERPOSE_HOOK(buildingplan_query_hook, feed).apply(enable) ||
|
|
|
|
if (!INTERPOSE_HOOK(buildingplan_query_hook, feed).apply(enable) ||
|
|
|
|
!INTERPOSE_HOOK(buildingplan_place_hook, feed).apply(enable) ||
|
|
|
|
!INTERPOSE_HOOK(buildingplan_place_hook, feed).apply(enable) ||
|
|
|
@ -903,7 +873,6 @@ DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_chan
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (event) {
|
|
|
|
switch (event) {
|
|
|
|
case SC_MAP_LOADED:
|
|
|
|
case SC_MAP_LOADED:
|
|
|
|
load_settings();
|
|
|
|
|
|
|
|
planner.reset();
|
|
|
|
planner.reset();
|
|
|
|
roomMonitor.reset(out);
|
|
|
|
roomMonitor.reset(out);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -961,7 +930,6 @@ static void setSetting(std::string name, bool value) {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
debug("setting quickfort_mode %d -> %d", quickfort_mode, value);
|
|
|
|
debug("setting quickfort_mode %d -> %d", quickfort_mode, value);
|
|
|
|
quickfort_mode = value;
|
|
|
|
quickfort_mode = value;
|
|
|
|
save_settings();
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
planner.setGlobalSetting(name, value);
|
|
|
|
planner.setGlobalSetting(name, value);
|
|
|
|