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.18 by root, Mon Apr 14 22:41:17 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;
132 int w, h; 143 int w, h;
133 144
134 MazeData (int w, int h); 145 LayoutData (int w, int h);
135 ~MazeData (); 146 ~LayoutData ();
136 147
137 operator char **() 148 operator char **()
138 { 149 {
139 return col; 150 return col;
140 } 151 }
141 152
142 void clear (char fill = 0); 153 void clear (char fill = 0);
143 void border (char fill = '#'); 154 void border (char fill = '#');
144}; 155};
145 156
146struct Maze 157struct Layout
147{ 158{
148 MazeData *ptr; 159 LayoutData *ptr;
149 160
150 Maze () 161 Layout ()
151 { 162 {
152 } 163 }
153 164
154 Maze (int xsize, int ysize) 165 Layout (int xsize, int ysize)
155 : ptr (new MazeData (xsize, ysize)) 166 : ptr (new LayoutData (xsize, ysize))
156 { 167 {
157 } 168 }
158 169
159 Maze (random_map_params *RP) 170 Layout (random_map_params *RP)
160 : ptr (new MazeData (RP->Xsize, RP->Ysize)) 171 : ptr (new LayoutData (RP->Xsize, RP->Ysize))
161 { 172 {
162 } 173 }
163 174
164 void free () 175 void free ()
165 { 176 {
166 delete ptr; 177 delete ptr;
167 } 178 }
168 179
169 MazeData *operator ->() const 180 LayoutData *operator ->() const
170 { 181 {
171 return ptr; 182 return ptr;
172 } 183 }
173 184
174 operator char **() const 185 operator char **() const
175 { 186 {
176 return *ptr; 187 return *ptr;
177 } 188 }
178 189
179 void swap (Maze &maze) 190 void swap (const Layout &layout) const
180 { 191 {
181 MazeData *p = maze.ptr; 192 ::swap (layout.ptr->col, ptr->col);
182 maze.ptr = ptr; 193 ::swap (layout.ptr->w , ptr->w );
183 ptr = p; 194 ::swap (layout.ptr->h , ptr->h );
184 } 195 }
185}; 196};
186 197
187#endif 198#endif
188 199

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines