Pass unreach_is_ok in move-action.

to surpress E_NOT_REACHED_DESTINATION in GOTO_CA.
This commit is contained in:
flix 2013-10-07 17:13:51 +02:00
parent c630bb2e1a
commit 6472560ca7
3 changed files with 13 additions and 13 deletions

View file

@ -103,13 +103,13 @@ attack_result_ptr readonly_context_impl::check_attack_action(const map_location&
}
move_result_ptr readwrite_context_impl::execute_move_action(const map_location& from, const map_location& to, bool remove_movement){
return actions::execute_move_action(get_side(),true,from,to,remove_movement);
move_result_ptr readwrite_context_impl::execute_move_action(const map_location& from, const map_location& to, bool remove_movement, bool unreach_is_ok){
return actions::execute_move_action(get_side(),true,from,to,remove_movement,unreach_is_ok);
}
move_result_ptr readonly_context_impl::check_move_action(const map_location& from, const map_location& to, bool remove_movement){
return actions::execute_move_action(get_side(),false,from,to,remove_movement);
move_result_ptr readonly_context_impl::check_move_action(const map_location& from, const map_location& to, bool remove_movement, bool unreach_is_ok){
return actions::execute_move_action(get_side(),false,from,to,remove_movement,unreach_is_ok);
}

View file

@ -183,7 +183,7 @@ public:
virtual void diagnostic(const std::string& msg) = 0;
virtual void log_message(const std::string& msg) = 0;
virtual attack_result_ptr check_attack_action(const map_location& attacker_loc, const map_location& defender_loc, int attacker_weapon) = 0;
virtual move_result_ptr check_move_action(const map_location& from, const map_location& to, bool remove_movement=true) = 0;
virtual move_result_ptr check_move_action(const map_location& from, const map_location& to, bool remove_movement=true, bool unreach_is_ok=false) = 0;
virtual recall_result_ptr check_recall_action(const std::string& id, const map_location &where = map_location::null_location, const map_location &from = map_location::null_location) = 0;
virtual recruit_result_ptr check_recruit_action(const std::string& unit_name, const map_location &where = map_location::null_location, const map_location &from = map_location::null_location) = 0;
virtual stopunit_result_ptr check_stopunit_action(const map_location& unit_location, bool remove_movement = true, bool remove_attacks = false) = 0;
@ -432,7 +432,7 @@ public:
virtual attack_result_ptr execute_attack_action(const map_location& attacker_loc, const map_location& defender_loc, int attacker_weapon) = 0;
virtual move_result_ptr execute_move_action(const map_location& from, const map_location& to, bool remove_movement=true) = 0;
virtual move_result_ptr execute_move_action(const map_location& from, const map_location& to, bool remove_movement=true, bool unreach_is_ok=false) = 0;
virtual recall_result_ptr execute_recall_action(const std::string& id, const map_location &where = map_location::null_location, const map_location &from = map_location::null_location) = 0;
@ -556,9 +556,9 @@ public:
return target_->check_attack_action(attacker_loc, defender_loc, attacker_weapon);
}
virtual move_result_ptr check_move_action(const map_location &from, const map_location &to, bool remove_movement=true)
virtual move_result_ptr check_move_action(const map_location &from, const map_location &to, bool remove_movement=true, bool unreach_is_ok=false)
{
return target_->check_move_action(from, to, remove_movement);
return target_->check_move_action(from, to, remove_movement, unreach_is_ok);
}
@ -1049,9 +1049,9 @@ public:
}
virtual move_result_ptr execute_move_action(const map_location& from, const map_location& to, bool remove_movement=true)
virtual move_result_ptr execute_move_action(const map_location& from, const map_location& to, bool remove_movement=true, bool unreach_is_ok=false)
{
return target_->execute_move_action(from, to, remove_movement);
return target_->execute_move_action(from, to, remove_movement, unreach_is_ok);
}
@ -1213,7 +1213,7 @@ public:
* @retval possible result: move is interrupted
* @retval possible result: move is impossible
*/
move_result_ptr check_move_action(const map_location& from, const map_location& to, bool remove_movement=true);
move_result_ptr check_move_action(const map_location& from, const map_location& to, bool remove_movement=true, bool unreach_is_ok=false);
@ -1608,7 +1608,7 @@ public:
* @retval possible result: move is interrupted
* @retval possible result: move is impossible
*/
virtual move_result_ptr execute_move_action(const map_location& from, const map_location& to, bool remove_movement=true);
virtual move_result_ptr execute_move_action(const map_location& from, const map_location& to, bool remove_movement=true, bool unreach_is_ok=false);
/**

View file

@ -89,7 +89,7 @@ double goto_phase::evaluate()
route = pathfind::a_star_search(ui->get_location(), ui->get_goto(), 10000.0, &calc, map_.w(), map_.h(), &allowed_teleports);
if (!route.steps.empty()){
move_ = check_move_action(ui->get_location(), route.steps.back());
move_ = check_move_action(ui->get_location(), route.steps.back(), true, true);
} else {
// there is no direct path (yet)
// go to the nearest hex instead.