1 /*
2    Copyright (C) 2017-2018 the Battle for Wesnoth Project https://www.wesnoth.org/
3 
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,
9    but WITHOUT ANY WARRANTY.
10 
11    See the COPYING file for more details.
12 */
13 
14 #include "actions/shroud_clearing_action.hpp"
15 
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"
24 
25 namespace actions {
return_village()26 void shroud_clearing_action::return_village()
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
33 		if(take_village_timebonus) {
34 			current_team.set_action_bonus_count(current_team.action_bonus_count() - 1);
35 		}
36 	}
37 }
take_village()38 void shroud_clearing_action::take_village()
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
45 		if(take_village_timebonus) {
46 			current_team.set_action_bonus_count(1 + current_team.action_bonus_count());
47 		}
48 	}
49 }
50 }
51