|
|
1 | /* |
|
|
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
|
|
3 | * |
|
|
4 | * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team |
|
|
5 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
|
|
6 | * Copyright (©) 1994-2004 Crossfire Development Team (restored, original file without copyright notice) |
|
|
7 | * |
|
|
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
|
|
9 | * the terms of the Affero GNU General Public License as published by the |
|
|
10 | * Free Software Foundation, either version 3 of the License, or (at your |
|
|
11 | * option) any later version. |
|
|
12 | * |
|
|
13 | * This program is distributed in the hope that it will be useful, |
|
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
16 | * GNU General Public License for more details. |
|
|
17 | * |
|
|
18 | * You should have received a copy of the Affero GNU General Public License |
|
|
19 | * and the GNU General Public License along with this program. If not, see |
|
|
20 | * <http://www.gnu.org/licenses/>. |
|
|
21 | * |
|
|
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
|
|
23 | */ |
1 | |
24 | |
2 | /* peterm@langmuir.eecs.berkeley.edu: this function generates a random |
25 | /* peterm@langmuir.eecs.berkeley.edu: this function generates a random |
3 | snake-type layout. |
26 | snake-type maze. |
4 | |
27 | |
5 | input: xsize, ysize; |
28 | input: xsize, ysize; |
6 | output: a char** array with # and . for closed and open respectively. |
29 | output: a char** array with # and . for closed and open respectively. |
7 | |
30 | |
8 | a char value of 0 represents a blank space: a '#' is |
31 | a char value of 0 represents a blank space: a '#' is |
9 | a wall. |
32 | a wall. |
10 | |
33 | |
11 | */ |
34 | */ |
12 | |
35 | |
13 | #include <global.h> |
36 | #include <global.h> |
14 | #include "random_map.h" |
37 | #include <rmg.h> |
15 | #include "rproto.h" |
38 | #include "rproto.h" |
16 | |
39 | |
17 | void |
40 | void |
18 | make_snake_layout (Layout maze, int options) |
41 | make_snake_layout (layout &maze, int options) |
19 | { |
42 | { |
20 | int i, j; |
43 | int i, j; |
21 | |
44 | |
22 | maze->clear (); |
45 | maze.clear (); |
23 | maze->border (); |
46 | maze.border (); |
24 | |
47 | |
25 | int xsize = maze->w; |
48 | int xsize = maze.w; |
26 | int ysize = maze->h; |
49 | int ysize = maze.h; |
27 | |
50 | |
28 | /* Bail out if the size is too small to make a snake. */ |
51 | /* Bail out if the size is too small to make a snake. */ |
29 | if (xsize < 8 || ysize < 8) |
52 | if (xsize < 8 || ysize < 8) |
30 | return; |
53 | return; |
31 | |
54 | |