-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloor.cpp
More file actions
37 lines (32 loc) · 742 Bytes
/
floor.cpp
File metadata and controls
37 lines (32 loc) · 742 Bytes
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
#include <iostream>
#include "floor.h"
Floor::Floor()
{
}
void Floor::addRoom(Room *room)
{
m_rooms[room->getId()] = room;
}
Room *Floor::getRoom(const std::string& room_id)
{
auto it = m_rooms.find(room_id);
if (it != m_rooms.end()){
return it->second;
}
return nullptr;
}
RoomEntity *Floor::getEntity(const std::string& entity_id)
{
for (auto room : m_rooms){
auto entity = room.second->getEntity(entity_id);
if (entity) return entity;
}
return nullptr;
}
void Floor::printFloor()
{
std::cout << "Floor with " << m_rooms.size() << " rooms:\n";
for (auto room : m_rooms){
std::cout << room.second->toString() << "\n";
}
}