-
Notifications
You must be signed in to change notification settings - Fork 0
/
environment.h
66 lines (46 loc) · 1.6 KB
/
environment.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
#ifndef DA_GAME_ENVIRONMENT_H
#define DA_GAME_ENVIRONMENT_H
#include <string>
#include <vector>
#include <map>
#include "actor.h"
#include "exit.h"
#include "object.h"
namespace da_game {
class Actor;
class Object;
class Environment {
friend class GameCommands;
public:
Environment();
~Environment();
const int id;
/*
* Any implementation of this function should return a
* description of what the environment contains, what
* objects are available and what actors are in the
* environment.
*
* TODO: fixa så det här printas vid operator<<
*/
virtual std::string description() const;
virtual bool add_exit(std::string, Exit *);
virtual Exit * get_exit(std::string) const;
virtual std::vector<std::string> get_exit_names() const;
virtual void enter(Actor &);
virtual void leave(Actor &);
virtual bool pick_up(Object *);
virtual void drop(Object *);
virtual std::vector<Object *> get_objects();
virtual std::vector<Actor *> get_actors();
virtual void save(std::fstream &);
static Environment * load(std::string);
protected:
static int instances;
std::vector<Object *> * objects;
std::vector<Actor *> * actors;
std::map<std::string, Environment *> neighbors;
std::map<std::string, Exit *> exits;
};
}
#endif // DA_GAME_ENVIRONTMENT_H