Crossfire Server, Branches 1.12  R18729
test.c
Go to the documentation of this file.
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 char **map_gen_spiral(int, int, int);
8 char **roguelike_layout_gen(int xsize, int ysize, int options);
9 char **make_snake_layout(int xsize, int ysize);
10 char **make_square_spiral_layout(int xsize, int ysize);
11 char **gen_corridor_rooms(int, int, int);
12 
13 void dump_layout(char **layout, int Xsize, int Ysize) {
14  int i, j;
15 
16  for (j = 0; j < Ysize; j++) {
17  for (i = 0; i < Xsize; i++) {
18  if (layout[i][j] == 0)
19  layout[i][j] = ' ';
20  printf("%c", layout[i][j]);
21  }
22  printf("\n");
23  }
24 }
25 
26 int 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  /* put your layout here */
35  layout = roguelike_layout_gen(Xsize, Ysize, 0);
36  /*layout = make_snake_layout(Xsize, Ysize, 0); */
37  /*layout = make_square_spiral_layout(Xsize, Ysize, 0); */
38  /*layout = gen_corridor_rooms(Xsize, Ysize, 1); */
39  /*layout = maze_gen(Xsize, Ysize, 0); */
40  /*layout = map_gen_onion(Xsize, Ysize, 0, 0);*/
41 
42  dump_layout(layout, Xsize, Ysize);
43  printf("\nExpanding layout...\n");
44 
45  biglayout = expand2x(layout, Xsize, Ysize);
46  dump_layout(biglayout, Xsize*2-1, Ysize*2-1);
47  return 0;
48 }
static struct Command_Line_Options options[]
Definition: init.c:234
char ** gen_corridor_rooms(int, int, int)
char ** expand2x(char **layout, int xsize, int ysize)
Definition: expand2x.c:39
char ** roguelike_layout_gen(int xsize, int ysize, int options)
Definition: rogue_layout.c:69
char ** map_gen_spiral(int, int, int)
void dump_layout(char **layout, int Xsize, int Ysize)
Definition: test.c:13
int main()
Definition: test.c:26
char ** make_square_spiral_layout(int xsize, int ysize)
Definition: square_spiral.c:90
char ** make_snake_layout(int xsize, int ysize)
Definition: snake.c:20