fix teledwarf bug (leaves babies lying on ground)

develop
sv-esk 2016-03-10 13:37:57 +02:00
parent cbb4275a44
commit 6ab8c8b9b1
1 changed files with 12 additions and 0 deletions

@ -10,6 +10,7 @@
#include "df/unit.h" #include "df/unit.h"
#include "df/unit_action.h" #include "df/unit_action.h"
#include "df/map_block.h" #include "df/map_block.h"
#include "df/units_other_id.h"
using std::string; using std::string;
using std::vector; using std::vector;
@ -97,6 +98,17 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
// move unit to destination // move unit to destination
unit->pos = unit->path.dest; unit->pos = unit->path.dest;
unit->path.path.clear(); unit->path.path.clear();
//move unit's riders(including babies) to destination
if (unit->flags1.bits.ridden)
{
for (size_t j = 0; j < world->units.other[units_other_id::ANY_RIDER].size(); j++)
{
df::unit *rider = world->units.other[units_other_id::ANY_RIDER][j];
if (rider->relations.rider_mount_id == unit->id)
rider->pos = unit->pos;
}
}
} while (0); } while (0);
if (enable_fastdwarf) if (enable_fastdwarf)