-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpace.hpp
More file actions
102 lines (85 loc) · 2.63 KB
/
Space.hpp
File metadata and controls
102 lines (85 loc) · 2.63 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*******************************************************************************
* ** Author: Gavin Slusher
* ** Date: 6/2/2019
* ** Description: Space class specification file. Contains logic to create,
* display, and move around in a map defined by the 2D array
* of MapObjects within the class. Also has logic to interact
* with MapObjects. Designed as an abstract class, this class
* should be used a base when creating custom "maps" via
* subclasses.
* ** *************************************************************************/
#ifndef SPACE_HPP
#define SPACE_HPP
#include <iostream>
#include <vector>
//#include "Game.hpp"
#include "displayMenu.hpp"
#include "inputValidation.hpp"
#include "MapObjects.hpp"
#include "Player.hpp"
//class Game; //forward declaration
class Space
{
protected:
//map variables
std::vector<std::vector <MapObjects *> > mapObjects;
int mapWidth;
int mapHeight;
const char FLOOR = ',';
//Space Features
std::string name;
std::string cutscene;
std::string defaultDescription;
bool cutscenePlayed;
bool endGame;
//Player variables
int playerRow;
int playerCol;
//Pointers
Space *top;
Space *bottom;
Space *left;
Space *right;
Space *currentSpace;
public:
Space();
Space(int, int, std::string);
~Space();
//map Methods
virtual void displaySpace();
virtual void createSpace() = 0;
void setPlayer(int row, int col);
void setPlayer(Player *, int, int);
//Player methods
void playerAction(char);
void moveUp();
void moveDown();
void moveLeft();
void moveRight();
void interact();
Player *getPlayer();
void setPlayerNull();
//Space Methods
void linkSpaces(Space *, Space *, Space *, Space *);
void setCurrentSpace(Space *);
Space *getCurrentSpace();
void resetCurrentSpace();
void displayName();
std::string getName();
//Space Pointers
Space *getTop();
Space *getBottom();
Space *getLeft();
Space *getRight();
//Cutscene Methods
bool getIfPlayed();
virtual void getCutscene();
void getDefDes();
void setIfPlayed(bool);
void setCutscene(std::string &);
void setDefDes(std::string &);
//EndGame
bool getEndGame();
void setEndGame(bool);
};
#endif