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

#include "List.hpp"

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);

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