-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap.h
More file actions
53 lines (41 loc) · 1.38 KB
/
Map.h
File metadata and controls
53 lines (41 loc) · 1.38 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
#ifndef MAP_H
#define MAP_H
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <algorithm>
#include <unordered_map> // For std::unordered_map
#include "Room.h"
class Room;
// Define the Edge struct
struct Edge {
Room* from; // Source room
Room* to; // Destination room
int weight; // Weight of the edge
Edge(Room* from, Room* to, int weight)
: from(from), to(to), weight(weight) {}
// Comparator for priority queue
bool operator>(const Edge& other) const {
return weight > other.weight;
}
};
class MapExplore {
public:
MapExplore(int numRooms); // this will help us create list of rooms based on # of rooms
void genTree(); // option between prim or kruskal
void startPlayerRoute(Player& player);
void shuffleRoom();
void finalBossEncounter(Player& player); // Final boss encounter function
std::pair<Room*, int> findFarthestNode(Room* startRoom); // this for farthest node
std::vector<Room>& getRooms();
private:
std::vector<Room> rooms; // room storage
std::vector<Edge> mst;
std::unordered_map<Room*, std::vector<Room*>> mstEdges; // Tracks MST connections
Room* startRoom; // starting room
Room* endRoom; // farthest room from start
// player traversal routes
void traverse(Room* startRoom, Room* endRoom, Player& player); // guide for playuer along path
};
#endif