ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/test.c
Revision: 1.1.1.1 (vendor branch)
Committed: Fri Feb 3 07:14:23 2006 UTC (18 years, 3 months ago) by root
Content type: text/plain
Branch: UPSTREAM
CVS Tags: UPSTREAM_2006_03_15, LAST_C_VERSION, UPSTREAM_2006_02_22, difficulty_fix_merge_060810_2300, UPSTREAM_2006_02_03
Branch point for: difficulty_fix
Changes since 1.1: +0 -0 lines
Log Message:
initial import

File Contents

# User Rev Content
1 root 1.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 dump_layout(char **layout, int Xsize, int Ysize) {
15     int i,j;
16    
17     for(j=0;j<Ysize;j++) {
18     for(i=0;i<Xsize;i++) {
19     if(layout[i][j]==0) layout[i][j]=' ';
20     printf("%c",layout[i][j]);
21     }
22     printf("\n");
23     }
24     }
25    
26     main() {
27     int Xsize, Ysize;
28     char **layout, **biglayout;
29     SRANDOM(time(0));
30    
31     Xsize= RANDOM() %30 + 10;
32     Ysize= RANDOM() %20 + 10;
33    
34    
35     /* put your layout here */
36     layout = roguelike_layout_gen(Xsize,Ysize,0);
37     /*layout = make_snake_layout(Xsize,Ysize,0); */
38     /*layout = make_square_spiral_layout(Xsize,Ysize,0); */
39     /*layout = gen_corridor_rooms(Xsize, Ysize, 1); */
40     /*layout = maze_gen(Xsize,Ysize,0); */
41     /*layout = map_gen_onion(Xsize,Ysize,0,0);*/
42    
43     dump_layout(layout, Xsize, Ysize);
44     printf("\nExpanding layout...\n");
45    
46     biglayout = expand2x(layout, Xsize, Ysize);
47     dump_layout(biglayout, Xsize*2-1, Ysize*2-1);
48     }
49