The Battle for Wesnoth  1.17.0-dev
shroud_clearing_action.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017 - 2021
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
16 
17 #include "actions/move.hpp" //get_village
18 #include "resources.hpp"
19 #include "team.hpp"
20 #include "log.hpp"
21 #include "units/udisplay.hpp"
22 #include "game_board.hpp"
23 #include "map/map.hpp"
24 #include "play_controller.hpp"
25 
26 namespace actions {
28 {
29  team &current_team = resources::controller->current_team();
30  const map_location back = route.back();
31  if(resources::gameboard->map().is_village(back)) {
32  get_village(back, original_village_owner, nullptr, false);
33  //MP_COUNTDOWN take away capture bonus
35  current_team.set_action_bonus_count(current_team.action_bonus_count() - 1);
36  }
37  }
38 }
40 {
41  team &current_team = resources::controller->current_team();
42  const map_location back = route.back();
43  if(resources::gameboard->map().is_village(back)) {
44  get_village(back, current_team.side(), nullptr, false);
45  //MP_COUNTDOWN restore capture bonus
47  current_team.set_action_bonus_count(1 + current_team.action_bonus_count());
48  }
49  }
50 }
51 }
play_controller * controller
Definition: resources.cpp:22
void take_village()
Change village owner on redo.
bool take_village_timebonus
Whether this actions got a timebonus because it took a village.
void return_village()
Change village owner on undo.
int action_bonus_count() const
Definition: team.hpp:225
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:72
game_board * gameboard
Definition: resources.cpp:21
Encapsulates the map of the game.
Definition: location.hpp:38
Various functions related to moving units.
game_events::pump_result_t get_village(const map_location &loc, int side, bool *action_timebonus, bool fire_event)
Makes it so the village at the given location is owned by the given side.
Definition: move.cpp:140
int original_village_owner
The number of the side that preivously owned the village that the unit stepped on Note...
void set_action_bonus_count(const int count)
Definition: team.hpp:226
Standard logging facilities (interface).
route_t route
The hexes occupied by the affected unit during this action.
int side() const
Definition: team.hpp:200
Display units performing various actions: moving, attacking, and dying.