00001 #include "Door.h" 00002 #include "Room.h" 00003 00004 //---- Door --------------------------------------------------------- 00005 00006 Door::Door(class Room * room1, class Room * room2) : MapSite() 00007 { 00008 this->_room1 = room1; 00009 this->_room2 = room2; 00010 } 00011 00012 Door::~Door() { } 00013 00014 void Door::Enter() { 00015 if(this->_isOpen) { 00016 /* Um Code erweitern, falls Maze fuer Spiel verwendet wird */ 00017 } 00018 } 00019 00020 class Room * Door::OtherSideFrom(class Room *room) { 00021 if(room == this->_room1) { 00022 return this->_room2; 00023 } else if(room == this->_room2) { 00024 return this->_room1; 00025 } else { 00026 return 0; 00027 } 00028 } 00029 00030 void Door::Print(int indent) { 00031 PrintIndent(indent); 00032 printf("Door:\n"); 00033 00034 PrintIndent(indent+2); 00035 if(this->_room1) printf("_room1 = %d\n", this->_room1->GetRoomNo()); 00036 else printf("_room1 = NULL\n"); 00037 00038 PrintIndent(indent+2); 00039 if(this->_room2) printf("_room2 = %d\n", this->_room2->GetRoomNo()); 00040 else printf("_room2 = NULL\n"); 00041 00042 PrintIndent(indent+2); 00043 if(this->_isOpen) printf("_isOpen = true\n"); 00044 else printf("_isOpen = false\n"); 00045 00046 MapSite::Print(indent+2); 00047 }