Labyrinth 2. kodutöö
{
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)
{
if(east == NULL)
{
east = room2;
return true;
}
else return false;
}
bool Room::connectWest(Room *room2)
{
if(west == NULL)
{
west = room2;
return true;
}
else return false;
}
Room* Room::addNorth(string newRoomName)
{
north = new Room(newRoomName, maze);
north->connectSouth(this);
return north;
}
Room* Room::addSouth(string newRoomName)
{
south = new Room(newRoomName, maze);
south->connectNorth(this);
return south;
}
Room* Room::addEast(string newRoomName)
{
east = new Room(newRoomName, maze);
east->connectWest(this);
return east;
}
Room* Room::addWest(string newRoomName)
{
west = new Room(newRoomName, maze);
west->connectEast(this);
return west;
}