aboutsummaryrefslogtreecommitdiff
path: root/backend/Location.h
blob: 4ce2349f31053c1e0792a1c2faa72452f09dd00a (plain)
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
#pragma once

#include "List.h"
#include "ListIterator.h"

class Enemy;
class Object;

enum Direction {
	NORTH = 0,
	EAST = 1,
	SOUTH = 2,
	WEST = 3,
};
static constexpr const Direction DIRECTIONS[] = { NORTH, EAST, SOUTH, WEST };

class Location {
public:
	void set_name(const char * name);
	const char * get_name();
	void set_description(const char * description);
	const char * get_description();
	void set_exit(Direction dir, Location * location = nullptr);
	Location * get_exit(Direction dir);
	void add_object(Object *);
	ListRange<Object *> get_objects();
	void add_enemy(Enemy *);
	ListRange<Enemy *> get_enemies();

private:
	Location(const char * name = "", const char * description = "");
	virtual ~Location();
	friend class LocationFactory;

private:
	const char * name = nullptr;
	const char * description = nullptr;
	List<Enemy*> enemies = {};
	List<Object*> objects = {};

	Location * edges[4] = {
		nullptr,
		nullptr,
		nullptr,
		nullptr,
	};
};