The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017 the Battle for Wesnoth Project
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
11  See the COPYING file for more details.
12 */
16 #include "actions/move.hpp" //get_village
17 #include "resources.hpp"
18 #include "team.hpp"
19 #include "log.hpp"
20 #include "units/udisplay.hpp"
21 #include "game_board.hpp"
22 #include "map/map.hpp"
23 #include "play_controller.hpp"
25 namespace actions {
27 {
28  team &current_team = resources::controller->current_team();
29  const map_location back = route.back();
30  if(resources::gameboard->map().is_village(back)) {
31  get_village(back, original_village_owner, nullptr, false);
32  //MP_COUNTDOWN take away capture bonus
34  current_team.set_action_bonus_count(current_team.action_bonus_count() - 1);
35  }
36  }
37 }
39 {
40  team &current_team = resources::controller->current_team();
41  const map_location back = route.back();
42  if(resources::gameboard->map().is_village(back)) {
43  get_village(back, current_team.side(), nullptr, false);
44  //MP_COUNTDOWN restore capture bonus
46  current_team.set_action_bonus_count(1 + current_team.action_bonus_count());
47  }
48  }
49 }
50 }
play_controller * controller
Definition: resources.cpp:21
void take_village()
Change village owner on redo.
bool take_village_timebonus
Whether this actions got a timebonus becasue it took a village.
-file sdl_utils.hpp
void return_village()
Change village owner on undo.
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:44
game_board * gameboard
Definition: resources.cpp:20
Encapsulates the map of the game.
Definition: location.hpp:40
Various functions related to moving units.
int side() const
Definition: team.hpp:187
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:139
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:213
Standard logging facilities (interface).
route_t route
The hexes occupied by the affected unit during this action.
int action_bonus_count() const
Definition: team.hpp:212
Display units performing various actions: moving, attacking, and dying.