unit_abilities.hpp

Go to the documentation of this file.
00001 /* $Id: unit_abilities.hpp 26798 2008-05-23 17:50:49Z mordante $ */
00002 /*
00003    Copyright (C) 2006 - 2008 by Dominic Bolin <dominic.bolin@exong.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License version 2
00008    or at your option any later version.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details.
00013 */
00014 
00015 /** @file unit_abilities.hpp */
00016 
00017 #ifndef UNIT_ABILITIES_HPP_INCLUDED
00018 #define UNIT_ABILITIES_HPP_INCLUDED
00019 
00020 #include "map.hpp"
00021 
00022 class unit_ability_list;
00023 
00024 namespace unit_abilities
00025 {
00026 
00027 
00028 enum value_modifier {NOT_USED,SET,ADD,MUL};
00029 
00030 struct individual_effect
00031 {
00032     individual_effect() : type(NOT_USED), value(0), ability(NULL),
00033         loc(gamemap::location::null_location) {};
00034     individual_effect(value_modifier t,int val,config* abil,const gamemap::location& l);
00035     void set(value_modifier t,int val,config* abil,const gamemap::location& l);
00036     value_modifier type;
00037     int value;
00038     config* ability;
00039     gamemap::location loc;
00040 };
00041 
00042 typedef std::vector<individual_effect> effect_list;
00043 
00044 class effect
00045 {
00046     public:
00047         effect(const unit_ability_list& list, int def, bool backstab);
00048 
00049         int get_composite_value() const
00050         { return composite_value_; }
00051         effect_list::const_iterator begin() const
00052         { return effect_list_.begin(); }
00053         effect_list::const_iterator end() const
00054         { return effect_list_.end(); }
00055     private:
00056         effect_list effect_list_;
00057         int composite_value_;
00058 };
00059 
00060 
00061 }
00062 
00063 
00064 #endif
00065 

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs