Skip to content

Commit

Permalink
Merge pull request #839 from sv-esk/teledwarf
Browse files Browse the repository at this point in the history
fix teledwarf bug (leaves babies lying on ground)
  • Loading branch information
expwnent committed Mar 10, 2016
2 parents 5fe618a + 6ab8c8b commit 5ae3e35
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugins/fastdwarf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "df/unit.h"
#include "df/unit_action.h"
#include "df/map_block.h"
#include "df/units_other_id.h"

using std::string;
using std::vector;
Expand Down Expand Up @@ -97,6 +98,17 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
// move unit to destination
unit->pos = unit->path.dest;
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);

if (enable_fastdwarf)
Expand Down

0 comments on commit 5ae3e35

Please sign in to comment.