The Battle for Wesnoth  1.15.7+dev
abilities.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 - 2018 by Dominic Bolin <dominic.bolin@exong.net>
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 
15 /** @file */
16 
17 #pragma once
18 
19 #include "map/location.hpp"
20 #include "units/ptr.hpp"
21 
22 class unit_ability_list;
23 namespace unit_abilities
24 {
25 bool filter_base_matches(const config& cfg, int def);
26 
28 
30 {
32  loc(map_location::null_location()) {}
33  void set(value_modifier t, int val, const config *abil,const map_location &l);
35  int value;
36  const config *ability;
38 };
39 
40 class effect
41 {
42  public:
43  effect(const unit_ability_list& list, int def, bool backstab, const_attack_ptr attacker = const_attack_ptr());
44  // Provide read-only access to the effect list:
45  typedef std::vector<individual_effect>::const_iterator iterator;
46  typedef std::vector<individual_effect>::const_iterator const_iterator;
47 
48  int get_composite_value() const
49  { return composite_value_; }
50  const_iterator begin() const
51  { return effect_list_.begin(); }
52  const_iterator end() const
53  { return effect_list_.end(); }
54  private:
55  std::vector<individual_effect> effect_list_;
57 };
58 
59 
60 }
std::vector< individual_effect > effect_list_
Definition: abilities.hpp:55
std::vector< individual_effect >::const_iterator iterator
Definition: abilities.hpp:45
const_iterator end() const
Definition: abilities.hpp:52
bool filter_base_matches(const config &cfg, int def)
Definition: abilities.cpp:1342
const_iterator begin() const
Definition: abilities.hpp:50
Encapsulates the map of the game.
Definition: location.hpp:42
int get_composite_value() const
Definition: abilities.hpp:48
double t
Definition: astarsearch.cpp:64
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:68
std::shared_ptr< const attack_type > const_attack_ptr
Definition: ptr.hpp:36
std::vector< individual_effect >::const_iterator const_iterator
Definition: abilities.hpp:46