attack_context::attack_context(const unit& a, const unit& d, int a_cth, int d_cth) : attacker_type(a.type_id()), defender_type(d.type_id()), attacker_side(a.side_id()), defender_side(d.side_id()), chance_to_hit_defender(a_cth), chance_to_hit_attacker(d_cth), attacker_res(), defender_res() { }
void advance_unit(const unit& u) { stats& s = get_stats(u.side_id()); s.advanced_to[u.type_id()]++; }
int un_recall_unit_cost(const unit& u) // this really belongs elsewhere, perhaps in undo.cpp { // but I'm too lazy to do it at the moment stats& s = get_stats(u.side_id()); s.recalls[u.type_id()]--; return u.recall_cost(); }
void un_recruit_unit(const unit& u) { stats& s = get_stats(u.side_id()); s.recruits[u.type().base_id()]--; s.recruit_cost -= u.cost(); }
void un_recall_unit(const unit& u) { stats& s = get_stats(u.side_id()); s.recalls[u.type_id()]--; s.recall_cost -= u.cost(); }
void recall_unit(const unit& u) { stats& s = get_stats(u.side_id()); s.recalls[u.type_id()]++; s.recall_cost += u.cost(); }