File: CreateScenarioRandomize.h

package info (click to toggle)
lordsawar 0.3.2%2Bfrogknows-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 41,716 kB
  • sloc: cpp: 103,193; sh: 4,965; xml: 2,220; makefile: 1,371
file content (86 lines) | stat: -rw-r--r-- 2,648 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//  Copyright (C) 2008, 2009, 2014, 2017 Ben Asselstine
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Library General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
//  02110-1301, USA.

#pragma once
#ifndef CREATE_SCENARIO_RANDOMIZE_H
#define CREATE_SCENARIO_RANDOMIZE_H

#include <fstream>
#include <vector>
#include <gtkmm.h>
#include "shield.h"
#include "namelist.h"

class Signpost;
class Army;
class Player;
class Reward;
class Keeper;

//! Generates random values for various map buildings.
class CreateScenarioRandomize
{
    public:
        CreateScenarioRandomize();
        virtual ~CreateScenarioRandomize() {};

	/** take a random city name
	 */
	Glib::ustring popRandomCityName();

	/* give a random city name
	 */
	void pushRandomCityName(Glib::ustring name);
	Glib::ustring popRandomRuinName();
	void pushRandomRuinName(Glib::ustring name);
	Glib::ustring popRandomTempleName();
	void pushRandomTempleName(Glib::ustring name);
	Glib::ustring popRandomSignpost();
	void pushRandomSignpost(Glib::ustring name);
	guint32 getRandomCityIncome(bool capital = false);
	bool randomSignpostsEmpty() {return d_signposts->empty();}
	Glib::ustring getDynamicSignpost(Signpost *signpost);
	int getNumSignposts() {return d_signposts->size();}
	Keeper * getRandomRuinKeeper(Vector<int> pos);
	Reward *getNewRandomReward();


	//! Based on the difficulty, get how much gold each player should
	//start with.
	void getBaseGold (int difficulty, int *base_gold);

	int adjustBaseGold (int base_gold);

	//! Get the default player name for the given shield colour.
	static Glib::ustring getPlayerName(Shield::Colour id);

        void cleanup();
    protected:
        //the namelists
	NameList *d_citynames;
	NameList *d_signposts;
	NameList *d_templenames;
	NameList *d_ruinnames;

    private:

	Glib::ustring popRandomListName(std::vector<Glib::ustring>& list);
        Glib::ustring get_direction(int xdir, int ydir);
	bool loadNames(std::vector<Glib::ustring>& list, std::ifstream& file);
};

#endif  //CREATE_SCENARIO_RANDOMIZE_H