ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/test.C
Revision: 1.3
Committed: Thu Sep 14 22:34:03 2006 UTC (17 years, 8 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.2: +0 -1 lines
Log Message:
indent

File Contents

# User Rev Content
1 elmex 1.1 #include <stdio.h>
2     #include <global.h>
3     #include <expand2x.h>
4    
5     /* this is a testing program for layouts. It's
6     included here for convenience only. */
7 root 1.2 char **map_gen_spiral (int, int, int);
8     char **roguelike_layout_gen (int xsize, int ysize, int options);
9     char **make_snake_layout (int xsize, int ysize, int options);
10     char **make_square_spiral_layout (int xsize, int ysize, int options);
11     char **gen_corridor_rooms (int, int, int);
12    
13     void
14     dump_layout (char **layout, int Xsize, int Ysize)
15     {
16     int i, j;
17    
18     for (j = 0; j < Ysize; j++)
19     {
20     for (i = 0; i < Xsize; i++)
21     {
22     if (layout[i][j] == 0)
23     layout[i][j] = ' ';
24     printf ("%c", layout[i][j]);
25     }
26     printf ("\n");
27 elmex 1.1 }
28     }
29    
30 root 1.2 main ()
31     {
32 elmex 1.1 int Xsize, Ysize;
33     char **layout, **biglayout;
34    
35 root 1.2 SRANDOM (time (0));
36    
37     Xsize = RANDOM () % 30 + 10;
38     Ysize = RANDOM () % 20 + 10;
39 elmex 1.1
40    
41     /* put your layout here */
42 root 1.2 layout = roguelike_layout_gen (Xsize, Ysize, 0);
43 elmex 1.1 /*layout = make_snake_layout(Xsize,Ysize,0); */
44     /*layout = make_square_spiral_layout(Xsize,Ysize,0); */
45     /*layout = gen_corridor_rooms(Xsize, Ysize, 1); */
46     /*layout = maze_gen(Xsize,Ysize,0); */
47 root 1.2 /*layout = map_gen_onion(Xsize,Ysize,0,0); */
48 elmex 1.1
49 root 1.2 dump_layout (layout, Xsize, Ysize);
50     printf ("\nExpanding layout...\n");
51 elmex 1.1
52 root 1.2 biglayout = expand2x (layout, Xsize, Ysize);
53     dump_layout (biglayout, Xsize * 2 - 1, Ysize * 2 - 1);
54 elmex 1.1 }