1 /******************************************************************************
2  *  Warmux is a convivial mass murder game.
3  *  Copyright (C) 2001-2011 Warmux Team.
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  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18  ******************************************************************************
19  * It's boring if an AI useses always the same weapon.
20  * This class makes it possible to rate strategies based on what weapon gets used.
21  * The RandomizeFactors gets called every turn so that the AI preferes different weapons each turn.
22  *****************************************************************************/
23 
24 
25 #ifndef AI_WEAPONS_WEIGHTING_H
26 #define AI_WEAPONS_WEIGHTING_H
27 
28 #include "weapon/weapon.h"
29 
30 class WeaponsWeighting
31 {
32   float factor[Weapon::LAST+1];
33   float min_factor[Weapon::LAST+1];
34   float max_factor[Weapon::LAST+1];
35 
36 public:
37   WeaponsWeighting();
38   void RandomizeFactors();
GetFactor(Weapon::Weapon_type type)39   float GetFactor(Weapon::Weapon_type type) const { return factor[type]; }
SetMinFactor(Weapon::Weapon_type type,float value)40   void SetMinFactor(Weapon::Weapon_type type, float value) { min_factor[type] = value; }
SetMaxFactor(Weapon::Weapon_type type,float value)41   void SetMaxFactor(Weapon::Weapon_type type, float value) { max_factor[type] = value; }
42 };
43 
44 #endif
45