ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/test.c
Revision: 1.2
Committed: Sun Aug 13 17:16:03 2006 UTC (17 years, 9 months ago) by elmex
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
Made server compile with C++.
Removed cfanim plugin and crossedit.
C++ here we come.

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 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