1 // Copyright (C) 2007, 2008, 2009 Ben Asselstine
2 // Copyright (C) 2008 Ole Laursen
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 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Library General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 #ifndef HERO_TEMPLATES_H
20 #define HERO_TEMPLATES_H
30 //! A list of Item objects.
32 * The HeroTemplates holds all hero templates together.
34 * It is implemented as a singleton. Upon creation, it reads the hero
35 * description file and initialises an internal list.
40 //! Returns the singleton instance.
41 static HeroTemplates* getInstance();
43 //! Explicitely deletes the singleton instance.
44 static void deleteInstance();
46 HeroProto *getRandomHero(int player_id);
48 HeroProto *getRandomHero(Hero::Gender gender, int player_id);
51 //! Default constructor. The function reads in the heronames file and produces a set of hero templates to be randomly selected from.
56 bool load(std::string tag, XML_Helper *helper);
59 /* the contents of the heronames data file */
60 std::vector<HeroProto*> d_herotemplates[MAX_PLAYERS];
62 //a list of male hero prototypes contained in the the army set.
63 std::vector<const ArmyProto*> d_male_heroes;
64 //a list of female hero prototypes contained in the the army set.
65 std::vector<const ArmyProto*> d_female_heroes;
67 static HeroTemplates* d_instance;
69 int loadHeroTemplates();