Remove blank lines
Trying to get the formatting to be at least somewhat consistent.
This commit is contained in:
parent
2753b9d0f5
commit
cfee347a38
1 changed files with 0 additions and 61 deletions
|
@ -66,7 +66,6 @@ action_result::action_result( side_number side )
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
action_result::~action_result()
|
||||
{
|
||||
if (!return_value_checked_) {
|
||||
|
@ -74,19 +73,16 @@ action_result::~action_result()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void action_result::check_after()
|
||||
{
|
||||
do_check_after();
|
||||
}
|
||||
|
||||
|
||||
void action_result::check_before()
|
||||
{
|
||||
do_check_before();
|
||||
}
|
||||
|
||||
|
||||
void action_result::execute()
|
||||
{
|
||||
is_execution_ = true;
|
||||
|
@ -115,20 +111,17 @@ void action_result::init_for_execution()
|
|||
do_init_for_execution();
|
||||
}
|
||||
|
||||
|
||||
bool action_result::is_gamestate_changed() const
|
||||
{
|
||||
return is_gamestate_changed_;
|
||||
}
|
||||
|
||||
|
||||
bool action_result::is_ok()
|
||||
{
|
||||
return_value_checked_ = true;
|
||||
return is_success();
|
||||
}
|
||||
|
||||
|
||||
void action_result::set_error(int error_code, bool log_as_error){
|
||||
status_ = error_code;
|
||||
if (is_execution()) {
|
||||
|
@ -142,13 +135,11 @@ void action_result::set_error(int error_code, bool log_as_error){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void action_result::set_gamestate_changed()
|
||||
{
|
||||
is_gamestate_changed_ = true;
|
||||
}
|
||||
|
||||
|
||||
int action_result::get_status() const
|
||||
{
|
||||
return status_;
|
||||
|
@ -159,19 +150,16 @@ bool action_result::is_success() const
|
|||
return (status_ == action_result::AI_ACTION_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
bool action_result::is_execution() const
|
||||
{
|
||||
return is_execution_;
|
||||
}
|
||||
|
||||
|
||||
game_info& action_result::get_info() const
|
||||
{
|
||||
return manager::get_active_ai_info_for_side(get_side());
|
||||
}
|
||||
|
||||
|
||||
team& action_result::get_my_team() const
|
||||
{
|
||||
return (*resources::teams)[side_-1];
|
||||
|
@ -183,7 +171,6 @@ attack_result::attack_result( side_number side, const map_location& attacker_loc
|
|||
: action_result(side), attacker_loc_(attacker_loc), defender_loc_(defender_loc), attacker_weapon_(attacker_weapon), aggression_(aggression), advancements_(advancements){
|
||||
}
|
||||
|
||||
|
||||
void attack_result::do_check_before()
|
||||
{
|
||||
LOG_AI_ACTIONS << " check_before " << *this << std::endl;
|
||||
|
@ -249,12 +236,10 @@ void attack_result::do_check_before()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void attack_result::do_check_after()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::string attack_result::do_describe() const
|
||||
{
|
||||
std::stringstream s;
|
||||
|
@ -268,7 +253,6 @@ std::string attack_result::do_describe() const
|
|||
return s.str();
|
||||
}
|
||||
|
||||
|
||||
void attack_result::do_execute()
|
||||
{
|
||||
LOG_AI_ACTIONS << "start of execution of: "<< *this << std::endl;
|
||||
|
@ -326,14 +310,11 @@ void attack_result::do_execute()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void attack_result::do_init_for_execution()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// move_result
|
||||
move_result::move_result(side_number side, const map_location& from,
|
||||
const map_location& to, bool remove_movement, bool unreach_is_ok)
|
||||
|
@ -348,7 +329,6 @@ move_result::move_result(side_number side, const map_location& from,
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
const unit *move_result::get_unit()
|
||||
{
|
||||
unit_map::const_iterator un = resources::units->find(from_);
|
||||
|
@ -368,7 +348,6 @@ const unit *move_result::get_unit()
|
|||
return u;
|
||||
}
|
||||
|
||||
|
||||
bool move_result::test_route(const unit &un)
|
||||
{
|
||||
if (from_== to_) {
|
||||
|
@ -416,13 +395,11 @@ void move_result::do_check_before()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const map_location& move_result::get_unit_location() const
|
||||
{
|
||||
return unit_location_;
|
||||
}
|
||||
|
||||
|
||||
void move_result::do_check_after()
|
||||
{
|
||||
if (move_spectator_.get_ambusher().valid()) {
|
||||
|
@ -441,7 +418,6 @@ void move_result::do_check_after()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
std::string move_result::do_describe() const
|
||||
{
|
||||
std::stringstream s;
|
||||
|
@ -457,7 +433,6 @@ std::string move_result::do_describe() const
|
|||
return s.str();
|
||||
}
|
||||
|
||||
|
||||
void move_result::do_execute()
|
||||
{
|
||||
LOG_AI_ACTIONS << "start of execution of: "<< *this << std::endl;
|
||||
|
@ -512,14 +487,12 @@ void move_result::do_execute()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void move_result::do_init_for_execution()
|
||||
{
|
||||
move_spectator_.reset(*resources::units);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// recall_result
|
||||
recall_result::recall_result(side_number side,
|
||||
const std::string& unit_id, const map_location& where, const map_location& from)
|
||||
|
@ -542,7 +515,6 @@ const unit * recall_result::get_recall_unit(const team &my_team)
|
|||
return &*rec;
|
||||
}
|
||||
|
||||
|
||||
bool recall_result::test_enough_gold(const team &my_team)
|
||||
{
|
||||
if (my_team.gold() < my_team.recall_cost() ) {
|
||||
|
@ -597,7 +569,6 @@ void recall_result::do_check_before()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void recall_result::do_check_after()
|
||||
{
|
||||
if (!resources::game_map->on_board(recall_location_)){
|
||||
|
@ -614,7 +585,6 @@ void recall_result::do_check_after()
|
|||
set_error(AI_ACTION_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string recall_result::do_describe() const
|
||||
|
@ -632,7 +602,6 @@ std::string recall_result::do_describe() const
|
|||
return s.str();
|
||||
}
|
||||
|
||||
|
||||
void recall_result::do_execute()
|
||||
{
|
||||
LOG_AI_ACTIONS << "start of execution of: " << *this << std::endl;
|
||||
|
@ -658,14 +627,11 @@ void recall_result::do_execute()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void recall_result::do_init_for_execution()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// recruit_result
|
||||
recruit_result::recruit_result(side_number side,
|
||||
const std::string& unit_name, const map_location& where, const map_location& from)
|
||||
|
@ -742,7 +708,6 @@ void recruit_result::do_check_before()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void recruit_result::do_check_after()
|
||||
{
|
||||
if (!resources::game_map->on_board(recruit_location_)) {
|
||||
|
@ -759,7 +724,6 @@ void recruit_result::do_check_after()
|
|||
set_error(AI_ACTION_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string recruit_result::do_describe() const
|
||||
|
@ -777,7 +741,6 @@ std::string recruit_result::do_describe() const
|
|||
return s.str();
|
||||
}
|
||||
|
||||
|
||||
void recruit_result::do_execute()
|
||||
{
|
||||
LOG_AI_ACTIONS << "start of execution of: " << *this << std::endl;
|
||||
|
@ -803,15 +766,11 @@ void recruit_result::do_execute()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void recruit_result::do_init_for_execution()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// stopunit_result
|
||||
stopunit_result::stopunit_result( side_number side, const map_location& unit_location, bool remove_movement, bool remove_attacks)
|
||||
: action_result(side), unit_location_(unit_location), remove_movement_(remove_movement), remove_attacks_(remove_attacks)
|
||||
|
@ -844,10 +803,8 @@ void stopunit_result::do_check_before()
|
|||
if (!get_unit()) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void stopunit_result::do_check_after()
|
||||
{
|
||||
unit_map::const_iterator un = resources::units->find(unit_location_);
|
||||
|
@ -906,14 +863,11 @@ void stopunit_result::do_execute()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void stopunit_result::do_init_for_execution()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// STATELESS INTERFACE TO AI ACTIONS
|
||||
// =======================================================================
|
||||
|
@ -931,8 +885,6 @@ attack_result_ptr actions::execute_attack_action( side_number side,
|
|||
return action;
|
||||
}
|
||||
|
||||
|
||||
|
||||
move_result_ptr actions::execute_move_action( side_number side,
|
||||
bool execute,
|
||||
const map_location& from,
|
||||
|
@ -943,10 +895,8 @@ move_result_ptr actions::execute_move_action( side_number side,
|
|||
move_result_ptr action(new move_result(side,from,to,remove_movement,unreach_is_ok));
|
||||
execute ? action->execute() : action->check_before();
|
||||
return action;
|
||||
|
||||
}
|
||||
|
||||
|
||||
recall_result_ptr actions::execute_recall_action( side_number side,
|
||||
bool execute,
|
||||
const std::string& unit_id,
|
||||
|
@ -956,10 +906,8 @@ recall_result_ptr actions::execute_recall_action( side_number side,
|
|||
recall_result_ptr action(new recall_result(side,unit_id,where,from));
|
||||
execute ? action->execute() : action->check_before();
|
||||
return action;
|
||||
|
||||
}
|
||||
|
||||
|
||||
recruit_result_ptr actions::execute_recruit_action( side_number side,
|
||||
bool execute,
|
||||
const std::string& unit_name,
|
||||
|
@ -969,10 +917,8 @@ recruit_result_ptr actions::execute_recruit_action( side_number side,
|
|||
recruit_result_ptr action(new recruit_result(side,unit_name,where,from));
|
||||
execute ? action->execute() : action->check_before();
|
||||
return action;
|
||||
|
||||
}
|
||||
|
||||
|
||||
stopunit_result_ptr actions::execute_stopunit_action( side_number side,
|
||||
bool execute,
|
||||
const map_location& unit_location,
|
||||
|
@ -982,10 +928,8 @@ stopunit_result_ptr actions::execute_stopunit_action( side_number side,
|
|||
stopunit_result_ptr action(new stopunit_result(side,unit_location,remove_movement,remove_attacks));
|
||||
execute ? action->execute() : action->check_before();
|
||||
return action;
|
||||
|
||||
}
|
||||
|
||||
|
||||
const std::string& actions::get_error_name(int error_code)
|
||||
{
|
||||
if (error_names_.empty()){
|
||||
|
@ -1039,7 +983,6 @@ const std::string& actions::get_error_name(int error_code)
|
|||
return i->second;
|
||||
}
|
||||
|
||||
|
||||
std::map<int,std::string> actions::error_names_;
|
||||
|
||||
} //end of namespace ai
|
||||
|
@ -1050,25 +993,21 @@ std::ostream &operator<<(std::ostream &s, ai::attack_result const &r) {
|
|||
return s;
|
||||
}
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &s, ai::move_result const &r) {
|
||||
s << r.do_describe();
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &s, ai::recall_result const &r) {
|
||||
s << r.do_describe();
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &s, ai::recruit_result const &r) {
|
||||
s << r.do_describe();
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &s, ai::stopunit_result const &r) {
|
||||
s << r.do_describe();
|
||||
return s;
|
||||
|
|
Loading…
Add table
Reference in a new issue