Labyrinth 2. kodutöö
#include "Room.h"
#include "Player.h"
#include "Maze.h"
using namespace std;
Room::Room(string c, Maze* parentMaze)
{
name = c;
north = south = east = west = NULL;
maze = parentMaze;
if(name != "ENTRY")
{
parentMaze->addRoom(this);
}
}
void Room::print(string text) // prindib text-i ja ruumi kogu info
{
cout << text << "Asud ruumis " << name << ", saad liikuda: ";
if(north != NULL)
{
cout << " P6hja "<< north->getName();
}
if(south != NULL)
{
cout << " L6unasse "<< south->getName();
}
if(east != NULL)
{
cout << " Itta "<< east->getName();
}
if(west != NULL)
{
cout << " L22nde "<< west->getName();
}
cout << endl;
}
bool Room::connectNorth(Room *room2)
{
if(north == NULL)
{
north = room2;
return true;
}
else return false;
}
bool Room::connectSouth(Room *room2)
{
if(south == NULL)
{
south = room2;
return true;
}
else return false;
}
bool Room::connectEast(Room *room2)
{