The Battle for Wesnoth  1.19.5+dev
shroud_clearing_action.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017 - 2024
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 "game_board.hpp"
21 #include "map/map.hpp"
22 #include "play_controller.hpp"
23 
24 namespace actions {
26 {
27  team &current_team = resources::controller->current_team();
28  const map_location back = route.back();
29  if(resources::gameboard->map().is_village(back)) {
30  get_village(back, original_village_owner, nullptr, false);
31  //MP_COUNTDOWN take away capture bonus
33  current_team.set_action_bonus_count(current_team.action_bonus_count() - 1);
34  }
35  }
36 }
38 {
39  team &current_team = resources::controller->current_team();
40  const map_location back = route.back();
41  if(resources::gameboard->map().is_village(back)) {
42  get_village(back, current_team.side(), nullptr, false);
43  //MP_COUNTDOWN restore capture bonus
45  current_team.set_action_bonus_count(1 + current_team.action_bonus_count());
46  }
47  }
48 }
49 }
Various functions related to moving units.
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:75
void set_action_bonus_count(const int count)
Definition: team.hpp:200
int side() const
Definition: team.hpp:175
int action_bonus_count() const
Definition: team.hpp:199
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:163
game_board * gameboard
Definition: resources.cpp:20
play_controller * controller
Definition: resources.cpp:21
route_t route
The hexes occupied by the affected unit during this action.
void return_village()
Change village owner on undo.
int original_village_owner
The number of the side that preivously owned the village that the unit stepped on Note,...
void take_village()
Change village owner on redo.
bool take_village_timebonus
Whether this actions got a timebonus because it took a village.
Encapsulates the map of the game.
Definition: location.hpp:45