-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSpace.cpp
More file actions
73 lines (63 loc) · 1.3 KB
/
Copy pathSpace.cpp
File metadata and controls
73 lines (63 loc) · 1.3 KB
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
67
68
69
70
71
72
73
/***************************************
Program Name: Final Project
Author: Robert Elsom
Date: 3/6/2019
Description: Space class, contains 2d linked list representing board spaces
with 4 space pointers for up, left, down, and right.
**************************************/
#include "Space.hpp"
#include <curses.h>
#include <iostream>
/*
#define KEY_UP 72
#define KEY_DOWN 80
#define KEY_LEFT 75
#define KEY_RIGHT 77
*/
Space::Space() {
right = nullptr;
left = nullptr;
up = nullptr;
down = nullptr;
}
//changes pointers
void Space::changePointer(Space* newPtr, std::string direction) {
if (direction == "up") {
up = newPtr;
}
else if (direction == "down") {
down = newPtr;
}
else if (direction == "left") {
left = newPtr;
}
else {
right = newPtr;
}
}
//returns pointer for specific direction
Space* Space::getPointer(std::string direction) {
if (direction == "up") {
return up;
}
else if (direction == "down") {
return down;
}
else if (direction == "left") {
return left;
}
else {
return right;
}
}
//remaining functions are here just to be used with derived classes, add nothing to actual space class
bool Space::hasShelter() {
return false;
}
bool Space::gotHypothermia() {
return false;
}
void Space::buildShelter() {}
void Space::setEntered() {}
Space::~Space() {
}