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.2 by root, Sun Sep 10 16:06:37 2006 UTC vs.
Revision 1.6 by pippijn, Sat Jan 6 14:42:30 2007 UTC

1 1
2/* 2/*
3 CrossFire, A Multiplayer game for X-windows 3 CrossFire, A Multiplayer game for X-windows
4 4
5 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 Copyright (C) 1994 Mark Wedel 6 Copyright (C) 1994 Mark Wedel
6 Copyright (C) 1992 Frank Tore Johansen 7 Copyright (C) 1992 Frank Tore Johansen
7 8
8 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
151connect_spirals (int xsize, int ysize, int sym, char **layout) 152connect_spirals (int xsize, int ysize, int sym, char **layout)
152{ 153{
153 154
154 int i, j, ic = xsize / 2, jc = ysize / 2; 155 int i, j, ic = xsize / 2, jc = ysize / 2;
155 156
156 if (sym == X_SYM) 157 if (sym == SYMMETRY_X)
157 { 158 {
158 layout[ic][jc] = 0; 159 layout[ic][jc] = 0;
159 /* go left from map center */ 160 /* go left from map center */
160 for (i = ic - 1, j = jc; i > 0 && layout[i][j] == '#'; i--) 161 for (i = ic - 1, j = jc; i > 0 && layout[i][j] == '#'; i--)
161 layout[i][j] = 0; 162 layout[i][j] = 0;
162 /* go right */ 163 /* go right */
163 for (i = ic + 1, j = jc; i < xsize - 1 && layout[i][j] == '#'; i++) 164 for (i = ic + 1, j = jc; i < xsize - 1 && layout[i][j] == '#'; i++)
164 layout[i][j] = 0; 165 layout[i][j] = 0;
165 } 166 }
166 167
167 if (sym == Y_SYM) 168 if (sym == SYMMETRY_Y)
168 { 169 {
169 170
170 layout[ic][jc] = 0; 171 layout[ic][jc] = 0;
171 /* go up */ 172 /* go up */
172 for (i = ic, j = jc - 1; j > 0 && layout[i][j] == '#'; j--) 173 for (i = ic, j = jc - 1; j > 0 && layout[i][j] == '#'; j--)
174 /* go down */ 175 /* go down */
175 for (i = ic, j = jc + 1; j < ysize - 1 && layout[i][j] == '#'; j++) 176 for (i = ic, j = jc + 1; j < ysize - 1 && layout[i][j] == '#'; j++)
176 layout[i][j] = 0; 177 layout[i][j] = 0;
177 } 178 }
178 179
179 if (sym == XY_SYM) 180 if (sym == SYMMETRY_XY)
180 { 181 {
181 /* go left from map center */ 182 /* go left from map center */
182 layout[ic][jc / 2] = 0; 183 layout[ic][jc / 2] = 0;
183 layout[ic / 2][jc] = 0; 184 layout[ic / 2][jc] = 0;
184 layout[ic][jc / 2 + jc] = 0; 185 layout[ic][jc / 2 + jc] = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines