ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/test.C
Revision: 1.8
Committed: Sat Nov 7 18:32:45 2009 UTC (14 years, 6 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-3_0, rel-2_92, rel-2_93
Changes since 1.7: +23 -0 lines
Log Message:
add copyright notices to .C files

File Contents

# User Rev Content
1 root 1.8 /*
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 elmex 1.1 #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 root 1.6 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 root 1.2
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 elmex 1.1 }
51     }
52    
53 root 1.2 main ()
54     {
55 elmex 1.1 int Xsize, Ysize;
56     char **layout, **biglayout;
57    
58 root 1.2 SRANDOM (time (0));
59    
60 root 1.7 Xsize = rmg_rndm (30) + 10;
61     Ysize = rmg_rndm (20) + 10;
62 elmex 1.1
63    
64     /* put your layout here */
65 root 1.2 layout = roguelike_layout_gen (Xsize, Ysize, 0);
66 elmex 1.1 /*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 root 1.2 /*layout = map_gen_onion(Xsize,Ysize,0,0); */
71 elmex 1.1
72 root 1.2 dump_layout (layout, Xsize, Ysize);
73     printf ("\nExpanding layout...\n");
74 elmex 1.1
75 root 1.2 biglayout = expand2x (layout, Xsize, Ysize);
76     dump_layout (biglayout, Xsize * 2 - 1, Ysize * 2 - 1);
77 elmex 1.1 }