ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/test.C
Revision: 1.7
Committed: Sun May 4 14:12:38 2008 UTC (16 years ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_82, rel-2_81, rel-2_80, rel-2_6, rel-2_7, rel-2_72, rel-2_73, rel-2_71, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_54, rel-2_55, rel-2_56, rel-2_79, rel-2_53, rel-2_90, rel-2_78, rel-2_61
Changes since 1.6: +2 -2 lines
Log Message:
lotsa

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.6 Layout map_gen_spiral (int, int, int);
8     Layout roguelike_layout_gen (int xsize, int ysize, int options);
9     Layout make_snake_layout (int xsize, int ysize, int options);
10     Layout make_square_spiral_layout (int xsize, int ysize, int options);
11     Layout gen_corridor_rooms (int, int, int);
12 root 1.2
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 root 1.7 Xsize = rmg_rndm (30) + 10;
38     Ysize = rmg_rndm (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 }