|
|
@ -57,6 +57,7 @@
|
|
|
|
#include "df/activity_event_individual_skill_drillst.h"
|
|
|
|
#include "df/activity_event_individual_skill_drillst.h"
|
|
|
|
#include "df/activity_event_skill_demonstrationst.h"
|
|
|
|
#include "df/activity_event_skill_demonstrationst.h"
|
|
|
|
#include "df/activity_event_sparringst.h"
|
|
|
|
#include "df/activity_event_sparringst.h"
|
|
|
|
|
|
|
|
#include "df/building_hivest.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
@ -136,6 +137,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
|
|
|
|
" to make them stand out more in the list.\n"
|
|
|
|
" to make them stand out more in the list.\n"
|
|
|
|
" tweak military-training [disable]\n"
|
|
|
|
" tweak military-training [disable]\n"
|
|
|
|
" Speed up melee squad training, removing inverse dependency on unit count.\n"
|
|
|
|
" Speed up melee squad training, removing inverse dependency on unit count.\n"
|
|
|
|
|
|
|
|
" tweak hive-crash [disable]\n"
|
|
|
|
|
|
|
|
" Prevents crash if bees die in a hive with uncollected products (bug 6368).\n"
|
|
|
|
));
|
|
|
|
));
|
|
|
|
return CR_OK;
|
|
|
|
return CR_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -932,6 +935,47 @@ struct military_training_id_hook : df::activity_event_individual_skill_drillst {
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(military_training_id_hook, process);
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(military_training_id_hook, process);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct hive_crash_hook : df::building_hivest {
|
|
|
|
|
|
|
|
typedef df::building_hivest interpose_base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFINE_VMETHOD_INTERPOSE(void, updateAction, ())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bool any_bees = false;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < contained_items.size(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (contained_items[i]->item->getType() != item_type::VERMIN)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
any_bees = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!any_bees)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bool any_products = false;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < contained_items.size(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (contained_items[i]->use_mode != 0 ||
|
|
|
|
|
|
|
|
!contained_items[i]->item->flags.bits.in_building)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contained_items[i]->item->flags.bits.in_building = false;
|
|
|
|
|
|
|
|
any_products = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (any_products)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
color_ostream_proxy out(Core::getInstance().getConsole());
|
|
|
|
|
|
|
|
out.print("Bees died in hive with products at (%d,%d,%d); preventing crash.\n",
|
|
|
|
|
|
|
|
centerx, centery, z);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INTERPOSE_NEXT(updateAction)();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_VMETHOD_INTERPOSE(hive_crash_hook, updateAction);
|
|
|
|
|
|
|
|
|
|
|
|
static void enable_hook(color_ostream &out, VMethodInterposeLinkBase &hook, vector <string> ¶meters)
|
|
|
|
static void enable_hook(color_ostream &out, VMethodInterposeLinkBase &hook, vector <string> ¶meters)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (vector_get(parameters, 1) == "disable")
|
|
|
|
if (vector_get(parameters, 1) == "disable")
|
|
|
@ -1112,6 +1156,10 @@ static command_result tweak(color_ostream &out, vector <string> ¶meters)
|
|
|
|
enable_hook(out, INTERPOSE_HOOK(military_training_sp_hook, process), parameters);
|
|
|
|
enable_hook(out, INTERPOSE_HOOK(military_training_sp_hook, process), parameters);
|
|
|
|
enable_hook(out, INTERPOSE_HOOK(military_training_id_hook, process), parameters);
|
|
|
|
enable_hook(out, INTERPOSE_HOOK(military_training_id_hook, process), parameters);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (cmd == "hive-crash")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
enable_hook(out, INTERPOSE_HOOK(hive_crash_hook, updateAction), parameters);
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return CR_WRONG_USAGE;
|
|
|
|
return CR_WRONG_USAGE;
|
|
|
|
|
|
|
|
|
|
|
|