Skip to content

Commit

Permalink
Initialize order.sub_target in path_finder
Browse files Browse the repository at this point in the history
The sub_target should be set to NO_ORDER by default, otherwise we get a
warning when reading back from saves.

Closes #2394.
  • Loading branch information
lmoureaux authored and jwrober committed Oct 28, 2024
1 parent 74285da commit 981444e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions common/path_finder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ vertex vertex::child_for_action(action_id action, const unit &probe,
ret.order.order = ORDER_PERFORM_ACTION;
ret.order.action = action;
ret.order.target = target->index;
ret.order.sub_target = NO_TARGET;
ret.order.dir = DIR8_ORIGIN;
ret.moves_left = probe.moves_left;
ret.location = target;
Expand Down
6 changes: 3 additions & 3 deletions server/savegame/savegame3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6035,14 +6035,14 @@ static bool sg_load_player_unit(struct loaddata *loading, struct player *plr,
break;
case ASTK_NONE:
// None of these can take a sub target.
fc_assert_msg(order_sub_tgt == -1,
fc_assert_msg(order_sub_tgt == NO_TARGET,
"Specified sub target for action %d unsupported.",
order->action);
order->sub_target = NO_TARGET;
break;
case ASTK_COUNT:
fc_assert_msg(order_sub_tgt == -1, "Bad action action %d.",
order->action);
fc_assert_msg(order_sub_tgt == NO_TARGET,
"Bad action action %d.", order->action);
order->sub_target = NO_TARGET;
break;
}
Expand Down

0 comments on commit 981444e

Please sign in to comment.