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

Comparing deliantra/server/random_maps/room_gen_spiral.C (file contents):
Revision 1.3 by root, Thu Sep 14 22:34:02 2006 UTC vs.
Revision 1.7 by pippijn, Mon Jan 15 21:06:19 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 * CrossFire, A Multiplayer game for X-windows
3 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
4 Copyright (C) 1994 Mark Wedel 5 * Copyright (C) 1994 Mark Wedel
5 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
6 7 *
7 This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 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
9 the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 11 * (at your option) any later version.
11 12 *
12 This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 16 * GNU General Public License for more details.
16 17 *
17 You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 21 *
21 The author can be reached via e-mail to mark@pyramid.com 22 * The author can be reached via e-mail to mark@pyramid.com
22*/ 23 */
23 24
24 25
25/* The onion room generator: 26/* The onion room generator:
26Onion rooms are like this: 27Onion rooms are like this:
27 28
150connect_spirals (int xsize, int ysize, int sym, char **layout) 151connect_spirals (int xsize, int ysize, int sym, char **layout)
151{ 152{
152 153
153 int i, j, ic = xsize / 2, jc = ysize / 2; 154 int i, j, ic = xsize / 2, jc = ysize / 2;
154 155
155 if (sym == X_SYM) 156 if (sym == SYMMETRY_X)
156 { 157 {
157 layout[ic][jc] = 0; 158 layout[ic][jc] = 0;
158 /* go left from map center */ 159 /* go left from map center */
159 for (i = ic - 1, j = jc; i > 0 && layout[i][j] == '#'; i--) 160 for (i = ic - 1, j = jc; i > 0 && layout[i][j] == '#'; i--)
160 layout[i][j] = 0; 161 layout[i][j] = 0;
161 /* go right */ 162 /* go right */
162 for (i = ic + 1, j = jc; i < xsize - 1 && layout[i][j] == '#'; i++) 163 for (i = ic + 1, j = jc; i < xsize - 1 && layout[i][j] == '#'; i++)
163 layout[i][j] = 0; 164 layout[i][j] = 0;
164 } 165 }
165 166
166 if (sym == Y_SYM) 167 if (sym == SYMMETRY_Y)
167 { 168 {
168 169
169 layout[ic][jc] = 0; 170 layout[ic][jc] = 0;
170 /* go up */ 171 /* go up */
171 for (i = ic, j = jc - 1; j > 0 && layout[i][j] == '#'; j--) 172 for (i = ic, j = jc - 1; j > 0 && layout[i][j] == '#'; j--)
173 /* go down */ 174 /* go down */
174 for (i = ic, j = jc + 1; j < ysize - 1 && layout[i][j] == '#'; j++) 175 for (i = ic, j = jc + 1; j < ysize - 1 && layout[i][j] == '#'; j++)
175 layout[i][j] = 0; 176 layout[i][j] = 0;
176 } 177 }
177 178
178 if (sym == XY_SYM) 179 if (sym == SYMMETRY_XY)
179 { 180 {
180 /* go left from map center */ 181 /* go left from map center */
181 layout[ic][jc / 2] = 0; 182 layout[ic][jc / 2] = 0;
182 layout[ic / 2][jc] = 0; 183 layout[ic / 2][jc] = 0;
183 layout[ic][jc / 2 + jc] = 0; 184 layout[ic][jc / 2 + jc] = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines