ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/random_map.h
(Generate patch)

Comparing deliantra/server/random_maps/random_map.h (file contents):
Revision 1.17 by root, Fri Apr 11 21:09:53 2008 UTC vs.
Revision 1.19 by root, Tue Apr 15 03:00:24 2008 UTC

124// 12 has been experimentally :( determined ot be a lot more stable 124// 12 has been experimentally :( determined ot be a lot more stable
125// than 11 or 10, leading to the assumption that something inherently 125// than 11 or 10, leading to the assumption that something inherently
126// needs a minimum size of at least 12 126// needs a minimum size of at least 12
127#define MIN_RANDOM_MAP_SIZE 12 127#define MIN_RANDOM_MAP_SIZE 12
128 128
129struct MazeData : zero_initialised 129struct LayoutData : zero_initialised
130{ 130{
131 char **col; 131 char **col;
132 int w, h;
132 133
133 MazeData (int xsize, int ysize); 134 LayoutData (int w, int h);
134 ~MazeData (); 135 ~LayoutData ();
135 136
136 operator char **() 137 operator char **()
137 { 138 {
138 return col; 139 return col;
139 } 140 }
141
142 void clear (char fill = 0);
143 void border (char fill = '#');
140}; 144};
141 145
142struct Maze 146struct Layout
143{ 147{
144 MazeData *ptr; 148 LayoutData *ptr;
145 149
146 Maze () 150 Layout ()
147 { 151 {
148 } 152 }
149 153
150 Maze (int xsize, int ysize) 154 Layout (int xsize, int ysize)
151 : ptr (new MazeData (xsize, ysize)) 155 : ptr (new LayoutData (xsize, ysize))
152 { 156 {
153 } 157 }
154 158
155 Maze (random_map_params *RP) 159 Layout (random_map_params *RP)
156 : ptr (new MazeData (RP->Xsize, RP->Ysize)) 160 : ptr (new LayoutData (RP->Xsize, RP->Ysize))
157 { 161 {
158 } 162 }
159 163
160 void free () 164 void free ()
161 { 165 {
162 delete ptr; 166 delete ptr;
163 } 167 }
164 168
169 LayoutData *operator ->() const
170 {
171 return ptr;
172 }
173
165 operator char **() 174 operator char **() const
166 { 175 {
167 return *ptr; 176 return *ptr;
177 }
178
179 void swap (const Layout &layout) const
180 {
181 ::swap (layout.ptr->col, ptr->col);
182 ::swap (layout.ptr->w , ptr->w );
183 ::swap (layout.ptr->h , ptr->h );
168 } 184 }
169}; 185};
170 186
171#endif 187#endif
172 188

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines