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.20 by root, Tue Apr 15 18:43:11 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
129// reference
130//
131// \0 floor only
132// # wall
133// D door
134// < up
135// > down
136// C "center" (of onion layout)
137// . ?? (rogue)
138//
139
129struct MazeData : zero_initialised 140struct LayoutData : zero_initialised
130{ 141{
131 char **col; 142 char **col;
143 int w, h;
132 144
133 MazeData (int xsize, int ysize); 145 LayoutData (int w, int h);
134 ~MazeData (); 146 ~LayoutData ();
135 147
136 operator char **() 148 operator char **()
137 { 149 {
138 return col; 150 return col;
139 } 151 }
152
153 void clear (char fill = 0);
154 void border (char fill = '#');
140}; 155};
141 156
142struct Maze 157struct Layout
143{ 158{
144 MazeData *ptr; 159 LayoutData *ptr;
145 160
146 Maze () 161 Layout ()
147 { 162 {
148 } 163 }
149 164
150 Maze (int xsize, int ysize) 165 Layout (int xsize, int ysize)
151 : ptr (new MazeData (xsize, ysize)) 166 : ptr (new LayoutData (xsize, ysize))
152 { 167 {
153 } 168 }
154 169
155 Maze (random_map_params *RP) 170 Layout (random_map_params *RP)
156 : ptr (new MazeData (RP->Xsize, RP->Ysize)) 171 : ptr (new LayoutData (RP->Xsize, RP->Ysize))
157 { 172 {
158 } 173 }
159 174
160 void free () 175 void free ()
161 { 176 {
162 delete ptr; 177 delete ptr;
163 } 178 }
164 179
180 LayoutData *operator ->() const
181 {
182 return ptr;
183 }
184
165 operator char **() 185 operator char **() const
166 { 186 {
167 return *ptr; 187 return *ptr;
188 }
189
190 void swap (const Layout &layout) const
191 {
192 ::swap (layout.ptr->col, ptr->col);
193 ::swap (layout.ptr->w , ptr->w );
194 ::swap (layout.ptr->h , ptr->h );
168 } 195 }
169}; 196};
170 197
171#endif 198#endif
172 199

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines