ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/test.C
Revision: 1.6
Committed: Tue Apr 15 03:00:24 2008 UTC (16 years, 1 month ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_5, rel-2_52
Changes since 1.5: +5 -5 lines
Log Message:
new logging thread, fix bugs in random map generator

File Contents

# Content
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 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
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 }
28 }
29
30 main ()
31 {
32 int Xsize, Ysize;
33 char **layout, **biglayout;
34
35 SRANDOM (time (0));
36
37 Xsize = rndm (30) + 10;
38 Ysize = rndm (20) + 10;
39
40
41 /* put your layout here */
42 layout = roguelike_layout_gen (Xsize, Ysize, 0);
43 /*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 /*layout = map_gen_onion(Xsize,Ysize,0,0); */
48
49 dump_layout (layout, Xsize, Ysize);
50 printf ("\nExpanding layout...\n");
51
52 biglayout = expand2x (layout, Xsize, Ysize);
53 dump_layout (biglayout, Xsize * 2 - 1, Ysize * 2 - 1);
54 }