aboutsummaryrefslogtreecommitdiff
path: root/backend/Location.h
blob: 8b600bb6c729a6ff1055f0f14c9314a7bd585b5f (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
#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);
	ListRange<Object *> get_objects();

protected:
	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,
	};
};