Labyrinth 2. kodutöö
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)
{
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;
}