AI: Fix assertion when trying to move to an off-map location
This could, for example, be triggered using ai.move().
This commit is contained in:
parent
644f5735da
commit
28d2ffae6a
2 changed files with 4 additions and 2 deletions
|
@ -377,8 +377,8 @@ bool move_result::test_route(const unit &un)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!to_.valid()) {
|
||||
set_error(E_NO_ROUTE);
|
||||
if (!to_.valid() || !resources::gameboard->map().on_board(to_)) {
|
||||
set_error(E_OFF_MAP);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1092,6 +1092,7 @@ const std::string& actions::get_error_name(int error_code)
|
|||
error_names_.emplace(move_result::E_AMBUSHED, "move_result::E_AMBUSHED");
|
||||
error_names_.emplace(move_result::E_FAILED_TELEPORT, "move_result::E_FAILED_TELEPORT");
|
||||
error_names_.emplace(move_result::E_NO_ROUTE, "move_result::E_NO_ROUTE");
|
||||
error_names_.emplace(move_result::E_OFF_MAP, "move_result::E_OFF_MAP");
|
||||
|
||||
error_names_.emplace(recall_result::E_NOT_AVAILABLE_FOR_RECALLING, "recall_result::E_NOT_AVAILABLE_FOR_RECALLING");
|
||||
error_names_.emplace(recall_result::E_NO_GOLD, "recall_result::E_NO_GOLD");
|
||||
|
|
|
@ -175,6 +175,7 @@ public:
|
|||
E_INCAPACITATED_UNIT = 2004,
|
||||
E_AMBUSHED = 2005,
|
||||
E_FAILED_TELEPORT = 2006,
|
||||
E_OFF_MAP = 2007,
|
||||
E_NO_ROUTE = 2008
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue