ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/test.C
Revision: 1.2
Committed: Sun Sep 10 16:06:37 2006 UTC (17 years, 8 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.1: +32 -26 lines
Log Message:
indent

File Contents

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