diff --git a/plugins/devel/kittens.cpp b/plugins/devel/kittens.cpp index 26a2655e8..b978fab7f 100644 --- a/plugins/devel/kittens.cpp +++ b/plugins/devel/kittens.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -20,6 +21,11 @@ #include "df/creature_raw.h" #include "df/world.h" +// for MSVC alignas(64) issues +#ifdef WIN32 +#define _DISABLE_EXTENDED_ALIGNED_STORAGE +#endif + using std::vector; using std::string; using namespace DFHack; @@ -220,7 +226,7 @@ struct ClearMem : public ConnectedBase { }; struct Connected : public ClearMem { - using Sig = Signal; + using Sig = Signal; std::array con; Sig signal; weak other; @@ -245,7 +251,7 @@ struct Connected : public ClearMem { // Externally synchronized object destruction is only safe to this // connect. con[pos] = b->signal.connect( - [this](int) { + [this](uint32_t) { uint32_t old = callee.fetch_add(1); assert(old != 0xDEDEDEDE); std::this_thread::sleep_for(delay); @@ -272,7 +278,7 @@ struct Connected : public ClearMem { if (!sig) return; con[pos] = sig->connect(b, - [this](int) { + [this](uint32_t) { uint32_t old = callee.fetch_add(1); assert(old != 0xDEDEDEDE); std::this_thread::sleep_for(delay); @@ -284,7 +290,7 @@ struct Connected : public ClearMem { out = &o; count = c; con[pos] = b->signal.connect(a, - [this](int) { + [this](uint32_t) { uint32_t old = callee.fetch_add(1); assert(old != 0xDEDEDEDE); std::this_thread::sleep_for(delay); @@ -345,13 +351,13 @@ command_result sharedsignal (color_ostream &out, vector & parameters) TRACE(command, out) << "Thread " << c->id << " started." << std::endl; weak ref = c; for (;c->caller < c->count; ++c->caller) { - c->signal(c->caller); + c->signal(std::move(c->caller)); } TRACE(command, out) << "Thread " << c->id << " resets shared." << std::endl; c.reset(); while((c = ref.lock())) { ++c->caller; - c->signal(c->caller); + c->signal(std::move(c->caller)); c.reset(); std::this_thread::sleep_for(delay*25); } @@ -363,7 +369,7 @@ command_result sharedsignal (color_ostream &out, vector & parameters) } TRACE(command, out) << "running " << std::endl; for (;external->caller < external->count; ++external->caller) { - external->signal(external->caller); + external->signal(std::move(external->caller)); external->reconnect(1); } TRACE(command, out) << "join " << std::endl;