|
|
@ -46,8 +46,6 @@ using namespace Pausing;
|
|
|
|
using namespace df::enums;
|
|
|
|
using namespace df::enums;
|
|
|
|
|
|
|
|
|
|
|
|
struct Configuration {
|
|
|
|
struct Configuration {
|
|
|
|
bool debug = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool unpause = false;
|
|
|
|
bool unpause = false;
|
|
|
|
bool disengage = false;
|
|
|
|
bool disengage = false;
|
|
|
|
bool animals = false;
|
|
|
|
bool animals = false;
|
|
|
@ -86,14 +84,16 @@ namespace SP {
|
|
|
|
std::default_random_engine RNG;
|
|
|
|
std::default_random_engine RNG;
|
|
|
|
|
|
|
|
|
|
|
|
void DebugUnitVector(std::vector<df::unit*> units) {
|
|
|
|
void DebugUnitVector(std::vector<df::unit*> units) {
|
|
|
|
|
|
|
|
if (debug_plugin.isEnabled(DFHack::DebugCategory::LDEBUG)) {
|
|
|
|
for (auto unit: units) {
|
|
|
|
for (auto unit: units) {
|
|
|
|
INFO(plugin).print("[id: %d]\n animal: %d\n hostile: %d\n visiting: %d\n",
|
|
|
|
DEBUG(plugin).print("[id: %d]\n animal: %d\n hostile: %d\n visiting: %d\n",
|
|
|
|
unit->id,
|
|
|
|
unit->id,
|
|
|
|
Units::isAnimal(unit),
|
|
|
|
Units::isAnimal(unit),
|
|
|
|
Units::isDanger(unit),
|
|
|
|
Units::isDanger(unit),
|
|
|
|
Units::isVisiting(unit));
|
|
|
|
Units::isVisiting(unit));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PrintStatus(color_ostream &out) {
|
|
|
|
void PrintStatus(color_ostream &out) {
|
|
|
|
out.print("Spectate is %s\n", enabled ? "ENABLED." : "DISABLED.");
|
|
|
|
out.print("Spectate is %s\n", enabled ? "ENABLED." : "DISABLED.");
|
|
|
@ -306,7 +306,7 @@ namespace SP {
|
|
|
|
if (!at_least_one) {
|
|
|
|
if (!at_least_one) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//DebugUnitVector(units);
|
|
|
|
DebugUnitVector(units);
|
|
|
|
std::piecewise_linear_distribution<> follow_any(i.begin(), i.end(), w.begin());
|
|
|
|
std::piecewise_linear_distribution<> follow_any(i.begin(), i.end(), w.begin());
|
|
|
|
// if you're looking at a warning about a local address escaping, it means the unit* from units (which aren't local)
|
|
|
|
// if you're looking at a warning about a local address escaping, it means the unit* from units (which aren't local)
|
|
|
|
size_t idx = follow_any(RNG);
|
|
|
|
size_t idx = follow_any(RNG);
|
|
|
|