1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
… | |
… | |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #ifndef RANDOM_MAP_H |
24 | #ifndef RANDOM_MAP_H |
25 | #define RANDOM_MAP_H |
25 | #define RANDOM_MAP_H |
|
|
26 | |
|
|
27 | #include "util.h" |
26 | |
28 | |
27 | struct random_map_params |
29 | struct random_map_params |
28 | { |
30 | { |
29 | char wallstyle[512]; |
31 | char wallstyle[512]; |
30 | char wall_name[512]; |
32 | char wall_name[512]; |
… | |
… | |
122 | // 12 has been experimentally :( determined ot be a lot more stable |
124 | // 12 has been experimentally :( determined ot be a lot more stable |
123 | // than 11 or 10, leading to the assumption that something inherently |
125 | // than 11 or 10, leading to the assumption that something inherently |
124 | // needs a minimum size of at least 12 |
126 | // needs a minimum size of at least 12 |
125 | #define MIN_RANDOM_MAP_SIZE 12 |
127 | #define MIN_RANDOM_MAP_SIZE 12 |
126 | |
128 | |
|
|
129 | struct LayoutData : zero_initialised |
|
|
130 | { |
|
|
131 | char **col; |
|
|
132 | int w, h; |
|
|
133 | |
|
|
134 | LayoutData (int w, int h); |
|
|
135 | ~LayoutData (); |
|
|
136 | |
|
|
137 | operator char **() |
|
|
138 | { |
|
|
139 | return col; |
|
|
140 | } |
|
|
141 | |
|
|
142 | void clear (char fill = 0); |
|
|
143 | void border (char fill = '#'); |
|
|
144 | }; |
|
|
145 | |
|
|
146 | struct Layout |
|
|
147 | { |
|
|
148 | LayoutData *ptr; |
|
|
149 | |
|
|
150 | Layout () |
|
|
151 | { |
|
|
152 | } |
|
|
153 | |
|
|
154 | Layout (int xsize, int ysize) |
|
|
155 | : ptr (new LayoutData (xsize, ysize)) |
|
|
156 | { |
|
|
157 | } |
|
|
158 | |
|
|
159 | Layout (random_map_params *RP) |
|
|
160 | : ptr (new LayoutData (RP->Xsize, RP->Ysize)) |
|
|
161 | { |
|
|
162 | } |
|
|
163 | |
|
|
164 | void free () |
|
|
165 | { |
|
|
166 | delete ptr; |
|
|
167 | } |
|
|
168 | |
|
|
169 | LayoutData *operator ->() const |
|
|
170 | { |
|
|
171 | return ptr; |
|
|
172 | } |
|
|
173 | |
|
|
174 | operator char **() const |
|
|
175 | { |
|
|
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 ); |
|
|
184 | } |
|
|
185 | }; |
|
|
186 | |
127 | #endif |
187 | #endif |
128 | |
188 | |