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

Comparing deliantra/server/random_maps/rogue_layout.C (file contents):
Revision 1.10 by root, Sun May 4 14:12:37 2008 UTC vs.
Revision 1.12 by root, Sat Nov 7 18:32:45 2009 UTC

1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 *
4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) Crossfire Development Team (restored, original file without copyright notice)
6 *
7 * Deliantra is free software: you can redistribute it and/or modify it under
8 * the terms of the Affero GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the Affero GNU General Public License
18 * and the GNU General Public License along with this program. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 * The authors can be reached via e-mail to <support@deliantra.net>
22 */
1 23
2/* generate a rogue/nethack-like layout */ 24/* generate a rogue/nethack-like layout */
3#include <global.h> 25#include <global.h>
4#include <random_map.h> 26#include <random_map.h>
5#include <math.h> 27#include <rproto.h>
6 28
7typedef struct 29typedef struct
8{ 30{
9 int x; 31 int x;
10 int y; /* coordinates of room centers */ 32 int y; /* coordinates of room centers */
301 maze[i - 1][j] = 'D'; 323 maze[i - 1][j] = 'D';
302 } 324 }
303 else if (maze[i][j] != 'D' && maze[i][j] != '.') 325 else if (maze[i][j] != 'D' && maze[i][j] != '.')
304 maze[i][j] = 0; 326 maze[i][j] = 0;
305 } 327 }
328
306 j = MIN (y1, y2); 329 j = min (y1, y2);
330
307 if (maze[i][j] == '.') 331 if (maze[i][j] == '.')
308 in_wall = 0; 332 in_wall = 0;
333
309 if (maze[i][j] == 0 || maze[i][j] == '#') 334 if (maze[i][j] == 0 || maze[i][j] == '#')
310 in_wall = 1; 335 in_wall = 1;
336
311 for ( /* j set already */ ; j < MAX (y1, y2); j++) 337 for ( /* j set already */ ; j < max (y1, y2); j++)
312 { 338 {
313 if (in_wall == 0 && maze[i][j] == '#') 339 if (in_wall == 0 && maze[i][j] == '#')
314 { 340 {
315 in_wall = 1; 341 in_wall = 1;
316 maze[i][j] = 'D'; 342 maze[i][j] = 'D';
354 } 380 }
355 else if (maze[i][j] != 'D' && maze[i][j] != '.') 381 else if (maze[i][j] != 'D' && maze[i][j] != '.')
356 maze[i][j] = 0; 382 maze[i][j] = 0;
357 } 383 }
358 384
359 i = MIN (x1, x2); 385 i = min (x1, x2);
386
360 if (maze[i][j] == '.') 387 if (maze[i][j] == '.')
361 in_wall = 0; 388 in_wall = 0;
389
362 if (maze[i][j] == 0 || maze[i][j] == '#') 390 if (maze[i][j] == 0 || maze[i][j] == '#')
363 in_wall = 1; 391 in_wall = 1;
392
364 for ( /* i set already */ ; i < MAX (x1, x2); i++) 393 for ( /* i set already */ ; i < max (x1, x2); i++)
365 { 394 {
366 if (in_wall == 0 && maze[i][j] == '#') 395 if (in_wall == 0 && maze[i][j] == '#')
367 { 396 {
368 in_wall = 1; 397 in_wall = 1;
369 maze[i][j] = 'D'; 398 maze[i][j] = 'D';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines