Skip to content

Commit a0097a6

Browse files
chdocmyk002
andauthored
Apply suggestions from code review
Co-authored-by: Myk <myk.taylor@gmail.com>
1 parent 2c834b9 commit a0097a6

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

docs/dev/Lua API.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ Units module
17031703
``dfhack.units.isOwnCiv`` or another appropriate predicate on the unit
17041704
in question.
17051705

1706-
* ``dfhack.units.setGoal(unit, pos, goal)``
1706+
* ``dfhack.units.setPathGoal(unit, pos, goal)``
17071707

17081708
Set target coordinates and goal (of type ``df.unit_path_goal``) for the given
17091709
unit. In case of a change, also clears the unit's current path.

library/modules/Units.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,7 @@ void Units::setPathGoal(df::unit *unit, df::coord pos, df::unit_path_goal goal)
946946

947947
if (unit->flags1.bits.rider && unit->mount_type == df::rider_positions_type::STANDARD)
948948
{
949-
auto mount = df::unit::find(unit->relationship_ids[df::unit_relationship_type::RiderMount]);
950-
if (mount)
949+
if (auto mount = df::unit::find(unit->relationship_ids[df::unit_relationship_type::RiderMount]))
951950
{
952951
mount->path.dest = pos;
953952
mount->path.goal = goal;

0 commit comments

Comments
 (0)