initial commit, lordsawar source, slightly modified
[lordsawar] / src / CreateScenarioRandomize.h
1 //  Copyright (C) 2008, 2009 Ben Asselstine
2 //
3 //  This program is free software; you can redistribute it and/or modify
4 //  it under the terms of the GNU General Public License as published by
5 //  the Free Software Foundation; either version 3 of the License, or
6 //  (at your option) any later version.
7 //
8 //  This program is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //  GNU Library General Public License for more details.
12 //
13 //  You should have received a copy of the GNU General Public License
14 //  along with this program; if not, write to the Free Software
15 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
16 //  02110-1301, USA.
17
18 #ifndef CREATE_SCENARIO_RANDOMIZE_H
19 #define CREATE_SCENARIO_RANDOMIZE_H
20
21 #include <fstream>
22 #include <string>
23 #include <vector>
24 #include <gtkmm.h>
25 #include "game-parameters.h"
26 #include "namelist.h"
27 #include "shield.h"
28
29 class Signpost;
30 class Army;
31 class Player;
32 class Reward;
33
34 class CreateScenarioRandomize
35 {
36     public:
37         CreateScenarioRandomize();
38         virtual ~CreateScenarioRandomize();
39
40         /** take a random city name
41          */
42         std::string popRandomCityName();
43
44         /* give a random city name
45          */
46         void pushRandomCityName(std::string name);
47         std::string popRandomRuinName();
48         void pushRandomRuinName(std::string name);
49         std::string popRandomTempleName();
50         void pushRandomTempleName(std::string name);
51         std::string popRandomSignpost();
52         void pushRandomSignpost(std::string name);
53         guint32 getRandomCityIncome(bool capital = false);
54         bool randomSignpostsEmpty() {return d_signposts->empty();}
55         std::string getDynamicSignpost(Signpost *signpost);
56         int getNumSignposts() {return d_signposts->size();}
57         Army * getRandomRuinKeeper(Player *p);
58         Reward *getNewRandomReward(bool hidden_ruins);
59
60
61         //! Based on the difficulty, get how much gold each player should
62         //start with.
63         void getBaseGold (int difficulty, int *base_gold);
64
65         int adjustBaseGold (int base_gold);
66
67         //! Get the default player name for the given shield colour.
68         std::string getPlayerName(Shield::Colour id);
69
70     private:
71
72         std::string popRandomListName(std::vector<std::string>& list);
73
74         bool loadNames(std::vector<std::string>& list, std::ifstream& file);
75
76         //the namelists
77         NameList *d_citynames;
78         NameList *d_signposts;
79         NameList *d_templenames;
80         NameList *d_ruinnames;
81 };
82
83 #endif  //CREATE_SCENARIO_RANDOMIZE_H