ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/test.C
Revision: 1.9
Committed: Thu Jul 1 01:22:44 2010 UTC (13 years, 10 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +0 -0 lines
State: FILE REMOVED
Log Message:
got rid of Layout, better memory management etc.

File Contents

# Content
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 */
23
24 #include <stdio.h>
25 #include <global.h>
26 #include <expand2x.h>
27
28 /* this is a testing program for layouts. It's
29 included here for convenience only. */
30 Layout map_gen_spiral (int, int, int);
31 Layout roguelike_layout_gen (int xsize, int ysize, int options);
32 Layout make_snake_layout (int xsize, int ysize, int options);
33 Layout make_square_spiral_layout (int xsize, int ysize, int options);
34 Layout gen_corridor_rooms (int, int, int);
35
36 void
37 dump_layout (char **layout, int Xsize, int Ysize)
38 {
39 int i, j;
40
41 for (j = 0; j < Ysize; j++)
42 {
43 for (i = 0; i < Xsize; i++)
44 {
45 if (layout[i][j] == 0)
46 layout[i][j] = ' ';
47 printf ("%c", layout[i][j]);
48 }
49 printf ("\n");
50 }
51 }
52
53 main ()
54 {
55 int Xsize, Ysize;
56 char **layout, **biglayout;
57
58 SRANDOM (time (0));
59
60 Xsize = rmg_rndm (30) + 10;
61 Ysize = rmg_rndm (20) + 10;
62
63
64 /* put your layout here */
65 layout = roguelike_layout_gen (Xsize, Ysize, 0);
66 /*layout = make_snake_layout(Xsize,Ysize,0); */
67 /*layout = make_square_spiral_layout(Xsize,Ysize,0); */
68 /*layout = gen_corridor_rooms(Xsize, Ysize, 1); */
69 /*layout = maze_gen(Xsize,Ysize,0); */
70 /*layout = map_gen_onion(Xsize,Ysize,0,0); */
71
72 dump_layout (layout, Xsize, Ysize);
73 printf ("\nExpanding layout...\n");
74
75 biglayout = expand2x (layout, Xsize, Ysize);
76 dump_layout (biglayout, Xsize * 2 - 1, Ysize * 2 - 1);
77 }