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.31 by root, Wed Jun 30 23:15:56 2010 UTC vs.
Revision 1.32 by root, Thu Jul 1 01:22:44 2010 UTC

155// C "center" (of onion layout) 155// C "center" (of onion layout)
156// . ?? (rogue) 156// . ?? (rogue)
157// 157//
158 158
159// use this in new code 159// use this in new code
160struct LayoutData 160struct Layout
161{ 161{
162 char **col; 162 char **col;
163 int w, h; 163 int w, h;
164 164
165 LayoutData (int w, int h); 165 Layout (int w, int h);
166 ~LayoutData (); 166 ~Layout ();
167 167
168 operator char **() 168 operator char **()
169 { 169 {
170 return col; 170 return col;
171 }
172
173 void swap (Layout &layout)
174 {
175 ::swap (layout.col, col);
176 ::swap (layout.w , w );
177 ::swap (layout.h , h );
171 } 178 }
172 179
173 // for debugging, print layout to stdout 180 // for debugging, print layout to stdout
174 void print (); 181 void print ();
175 182
187 194
188 // generates a cave, subtype 0 is a rough cave, randomly open or closed 195 // generates a cave, subtype 0 is a rough cave, randomly open or closed
189 void gen_cave (int subtype); 196 void gen_cave (int subtype);
190 void erode_1_2 (int c1, int c2 = -1, int repeat = 1); 197 void erode_1_2 (int c1, int c2 = -1, int repeat = 1);
191 198
192 void swap (LayoutData &layout)
193 {
194 ::swap (layout.col, col);
195 ::swap (layout.w , w );
196 ::swap (layout.h , h );
197 }
198};
199
200// basically a layoutdata pointer - do not use in new code
201struct Layout
202{
203 LayoutData *ptr;
204
205 Layout ()
206 {
207 }
208
209 Layout (int xsize, int ysize)
210 : ptr (new LayoutData (xsize, ysize))
211 {
212 }
213
214 Layout (random_map_params *RP) 199 void generate (random_map_params *RP);
215 : ptr (new LayoutData (RP->Xsize, RP->Ysize))
216 {
217 }
218
219 void free ()
220 {
221 delete ptr;
222 }
223
224 LayoutData *operator ->() const
225 {
226 return ptr;
227 }
228
229 operator char **() const
230 {
231 return *ptr;
232 }
233
234 void swap (Layout &layout)
235 {
236 ::swap (layout.ptr, ptr);
237 }
238}; 200};
239 201
240// utility functions, to use rmg_rndm instead of rndm. 202// utility functions, to use rmg_rndm instead of rndm.
241static inline int 203static inline int
242rmg_find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop) 204rmg_find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines