The Battle for Wesnoth  1.17.0-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 #pragma once
16 
17 #include "map/location.hpp"
18 #include "units/ptr.hpp"
19 
20 class unit_ability_list;
21 namespace unit_abilities
22 {
23 bool filter_base_matches(const config& cfg, int def);
24 
26 
28 {
30  loc(map_location::null_location()) {}
31  void set(value_modifier t, int val, const config *abil,const map_location &l);
33  int value;
34  const config *ability;
36 };
37 
38 class effect
39 {
40  public:
41  effect(const unit_ability_list& list, int def, bool backstab, const_attack_ptr attacker = const_attack_ptr());
42  // Provide read-only access to the effect list:
43  typedef std::vector<individual_effect>::const_iterator iterator;
44  typedef std::vector<individual_effect>::const_iterator const_iterator;
45 
46  int get_composite_value() const
47  { return composite_value_; }
48  const_iterator begin() const
49  { return effect_list_.begin(); }
50  const_iterator end() const
51  { return effect_list_.end(); }
52  private:
53  std::vector<individual_effect> effect_list_;
55 };
56 
57 
58 }
std::vector< individual_effect > effect_list_
Definition: abilities.hpp:53
std::vector< individual_effect >::const_iterator iterator
Definition: abilities.hpp:43
const_iterator end() const
Definition: abilities.hpp:50
bool filter_base_matches(const config &cfg, int def)
Definition: abilities.cpp:1637
const_iterator begin() const
Definition: abilities.hpp:48
Encapsulates the map of the game.
Definition: location.hpp:37
int get_composite_value() const
Definition: abilities.hpp:46
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:59
std::shared_ptr< const attack_type > const_attack_ptr
Definition: ptr.hpp:33
std::vector< individual_effect >::const_iterator const_iterator
Definition: abilities.hpp:44