ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/test.C
(Generate patch)

Comparing deliantra/server/random_maps/test.C (file contents):
Revision 1.1 by elmex, Sun Aug 13 17:16:03 2006 UTC vs.
Revision 1.5 by root, Fri Apr 11 21:09:53 2008 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines