-
Notifications
You must be signed in to change notification settings - Fork 0
/
location.h
55 lines (45 loc) · 1.15 KB
/
location.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
#ifndef LOCATION_H
#define LOCATION_H
#include <string>
#include "parser.h"
#include "actor.h"
#include "entity.h"
class Actor;
class Location;
enum Direction {north, south, east, west, up, down};
struct LocationConnections {
Location* north;
Location* south;
Location* east;
Location* west;
Location* up;
Location* down;
};
class Location {
public:
Location();
virtual std::string getTitle()=0;
virtual void setupConnections()=0;
virtual void processCommand(Command command,
Actor* player);
virtual void handleTravel(Actor* player,
std::string direction);
std::string getDescription();
std::string getSubDescription();
void handleLook(Actor* player,
Entity* target);
void announce();
void addEntity(Entity* entityToAdd);
void removeEntity(Entity* entityToRemove);
protected:
void addLocation(Location* connectedLocation,
Direction direction);
virtual std::string getDescriptionText()=0;
private:
bool hasBeenVisited;
LocationConnections locations;
std::set<Entity*> entities;
Entity* matchTokenToEntity(std::string noun);
std::set<Entity*> findActors(Actor* player);
};
#endif