-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorld.h
118 lines (92 loc) · 2.78 KB
/
World.h
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
* @file World.h
* World.h defines the methods for the World.cpp source file.
*
* @brief Defines the World class.
*
* @author Michael Abrams
* @author James Boocock
* @author Toby Herbert
* @author Tatai Nikora
* @version 0.3
*/
#ifndef _WORLD_H
#define _WORLD_H
//------------------------------------------------------------------------------
/* Include */
//------------------------------------------------------------------------------
#include "Area.h"
#include <string>
#include <vector>
class World {
protected:
std::string language; ///< The language the game is written in.
std::string author; ///< The author(s) of the game.
std::vector<Area*> areas; ///< All the areas in the game.
std::string initial_area; ///< The starting area.
int num_areas; ///< How many areas in the game.
Area *active_area; ///< The area that is currently active.
public:
/**
Gets the author of the game specified in the world tag
of the game.
@return A string - the author of the game.
*/
std::string get_author();
/**
Gets the language specified in the world tag of the game.
@return A string - the language the game is written in.
*/
std::string get_language();
/**
Gets the active area.
@return A pointer to the active area in the game world.
*/
Area* get_active_area();
/**
Gets an area from the areas vector by index.
@param[in] index The index of an area pointer in the vector.
@return A pointer to an area at the index given.
*/
Area *get_area(int index);
/**
Adds an area to the world.
@param[in] new_area A pointer to an area object
*/
void add_area(Area *new_area);
/**
Gets the number of areas in the world.
@return The number of areas in the world.
*/
int get_num_areas();
/**
Gets an area from the areas vector by area id.
@param[in] area_id The id of an area.
@return A pointer to an area with the given id.
*/
Area *get_area(std::string area_id);
/**
Sets the initial area in the areas vector to the
active area.
@return True if an initial area is found in the
areas vector otherwise false.
*/
bool init_active_area();
/**
Sets the active area to the specified area.
@param[in] name An id of an area to set as active.
*/
void change_area(std::string name);
/**
The constructor for a world object.
@param[in] lang The name of the language for the game.
@param[in] auth The author(s) of the game.
@param[in] init_area The initial area for the game.
*/
World(const char *lang, const char *auth, const char *init_area);
/**
The deconstructor for the World object.
*/
~World();
};
#endif