-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMap.h
72 lines (60 loc) · 2.27 KB
/
Map.h
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
#ifndef MAP_H
#define MAP_H
#include <iostream>
using namespace std;
class Map
{
private:
const char UNEXPLORED = '-'; // marker for unexplored spaces
const char EXPLORED = ' '; // marker for explored spaces
const char ROOM = 'R'; // marker for room locations
const char NPC = 'N'; // marker for NPC locations
const char PARTY = 'X'; // marker for party position
const char EXIT = 'E'; // marker for dungeon exit
static const int num_rows_ = 12; // number of rows in map
static const int num_cols_ = 12; // number of columns in map
static const int max_npcs_ = 5; // max non-player characters
static const int max_rooms_ = 5; // max number of rooms
int player_position_[2]; // player position (row,col)
int dungeon_exit_[2]; // exit location of the dungeon
int npc_positions_[max_npcs_][3]; // stores the (row,col) positions of NPCs present on map and if they have been found
int room_positions_[max_rooms_][2]; // stores the (row,col) positions of rooms present on map
char map_data_[num_rows_][num_cols_]; // stores the character that will be shown at a given (row,col)
int npc_count_; // stores number of misfortunes currently on map
int room_count_; // stores number of sites currently on map
public:
Map();
void resetMap();
// getters
int getPlayerRow();
int getPlayerCol();
int getDungeonExitRow();
int getDungeonExitCol();
int getRoomCount();
int getNPCCount();
int getNumRows();
int getNumCols();
bool isOnMap(int row, int col);
bool isNPCLocation(int row, int col);
bool isRoomLocation(int row, int col);
bool isExplored(int row, int col);
bool isFreeSpace(int row, int col);
bool isDungeonExit(int row, int col);
// setters
void setPlayerPosition(int row, int col);
void setDungeonExit(int row, int col);
// other
void displayMap();
bool move(char);
bool addNPC(int row, int col);
bool addRoom(int row, int col);
bool removeNPC(int row, int col);
bool removeRoom(int row, int col);
void exploreSpace(int row, int col);
void printMoveMenu();
//generators
void spawnRooms();
void spawnNPCs();
int randomNum(int first_num, int last_num);
};
#endif