00001 #include "Builder.h"
00002 #include "MazeGame.h"
00003
00004
00005 #include "Maze.h"
00006 #include "Wall.h"
00007 #include "Room.h"
00008 #include "Door.h"
00009
00010
00011
00012
00013
00014
00015 StandardMazeBuilder::StandardMazeBuilder () {
00016 _currentMaze = 0;
00017 }
00018
00019
00020 void StandardMazeBuilder::BuildMaze () {
00021 _currentMaze = new Maze;
00022 }
00023
00024
00025 Maze *StandardMazeBuilder::GetMaze () {
00026 Maze* maze = _currentMaze;
00027 return maze;
00028 }
00029
00030
00031 void StandardMazeBuilder::BuildRoom (int n) {
00032 if (!_currentMaze->RoomNo(n)) {
00033 Room* room = new Room(n);
00034 _currentMaze->AddRoom(room);
00035
00036
00037 room->SetSide(North, new Wall);
00038 room->SetSide(South, new Wall);
00039 room->SetSide(East, new Wall);
00040 room->SetSide(West, new Wall);
00041 }
00042 }
00043
00044
00045 void StandardMazeBuilder::BuildDoor (int n1, int n2) {
00046 Room* r1 = _currentMaze->RoomNo(n1);
00047 Room* r2 = _currentMaze->RoomNo(n2);
00048 Door* d = new Door(r1, r2);
00049
00050
00051 r1->SetSide(CommonWall(r1,r2), d);
00052 r2->SetSide(CommonWall(r2,r1), d);
00053 }
00054
00055
00056
00057 CountingMazeBuilder::CountingMazeBuilder () {
00058 _rooms = _doors = 0;
00059 }
00060
00061
00062 void CountingMazeBuilder::BuildRoom (int) {
00063 _rooms++;
00064 }
00065
00066
00067 void CountingMazeBuilder::BuildDoor (int, int) {
00068 _doors++;
00069 }
00070
00071
00072 void CountingMazeBuilder::GetCounts (
00073 int& rooms, int& doors
00074 ) const {
00075 rooms = _rooms;
00076 doors = _doors;
00077 }
00078
00079 void CountingMazeBuilder::BuildMaze ()
00080 {
00081
00082 }
00083
00084 void CountingMazeBuilder::AddWall(int, Direction)
00085 {
00086
00087
00088 }