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