--- deliantra/server/random_maps/rogue_layout.C 2008/05/04 14:12:37 1.10 +++ deliantra/server/random_maps/rogue_layout.C 2010/06/30 20:51:02 1.13 @@ -1,8 +1,30 @@ +/* + * This file is part of Deliantra, the Roguelike Realtime MMORPG. + * + * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) Crossfire Development Team (restored, original file without copyright notice) + * + * Deliantra is free software: you can redistribute it and/or modify it under + * the terms of the Affero GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the Affero GNU General Public License + * and the GNU General Public License along with this program. If not, see + * . + * + * The authors can be reached via e-mail to + */ /* generate a rogue/nethack-like layout */ #include #include -#include +#include typedef struct { @@ -65,7 +87,7 @@ return; } - maze->clear ('#'); + maze->fill ('#'); /* decide on the number of rooms */ nrooms = rmg_rndm (10) + 6; @@ -303,12 +325,16 @@ else if (maze[i][j] != 'D' && maze[i][j] != '.') maze[i][j] = 0; } - j = MIN (y1, y2); + + j = min (y1, y2); + if (maze[i][j] == '.') in_wall = 0; + if (maze[i][j] == 0 || maze[i][j] == '#') in_wall = 1; - for ( /* j set already */ ; j < MAX (y1, y2); j++) + + for ( /* j set already */ ; j < max (y1, y2); j++) { if (in_wall == 0 && maze[i][j] == '#') { @@ -356,12 +382,15 @@ maze[i][j] = 0; } - i = MIN (x1, x2); + i = min (x1, x2); + if (maze[i][j] == '.') in_wall = 0; + if (maze[i][j] == 0 || maze[i][j] == '#') in_wall = 1; - for ( /* i set already */ ; i < MAX (x1, x2); i++) + + for ( /* i set already */ ; i < max (x1, x2); i++) { if (in_wall == 0 && maze[i][j] == '#') {