Crossfire Server, Branch 1.12  R12190
test.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <global.h>
00003 #include <expand2x.h>
00004 
00005 /* this is a testing program for layouts.  It's
00006    included here for convenience only.  */
00007 char **map_gen_spiral(int, int, int);
00008 char **roguelike_layout_gen(int xsize, int ysize, int options);
00009 char **make_snake_layout(int xsize, int ysize);
00010 char **make_square_spiral_layout(int xsize, int ysize);
00011 char **gen_corridor_rooms(int, int, int);
00012 
00013 void dump_layout(char **layout, int Xsize, int Ysize) {
00014     int i, j;
00015 
00016     for (j = 0; j < Ysize; j++) {
00017         for (i = 0; i < Xsize; i++) {
00018             if (layout[i][j] == 0)
00019                 layout[i][j] = ' ';
00020             printf("%c", layout[i][j]);
00021         }
00022         printf("\n");
00023     }
00024 }
00025 
00026 int main() {
00027     int Xsize, Ysize;
00028     char **layout, **biglayout;
00029     SRANDOM(time(0));
00030 
00031     Xsize = RANDOM()%30+10;
00032     Ysize = RANDOM()%20+10;
00033 
00034     /* put your layout here */
00035     layout = roguelike_layout_gen(Xsize, Ysize, 0);
00036     /*layout = make_snake_layout(Xsize, Ysize, 0); */
00037     /*layout = make_square_spiral_layout(Xsize, Ysize, 0); */
00038     /*layout = gen_corridor_rooms(Xsize, Ysize, 1); */
00039     /*layout = maze_gen(Xsize, Ysize, 0); */
00040     /*layout = map_gen_onion(Xsize, Ysize, 0, 0);*/
00041 
00042     dump_layout(layout, Xsize, Ysize);
00043     printf("\nExpanding layout...\n");
00044 
00045     biglayout = expand2x(layout, Xsize, Ysize);
00046     dump_layout(biglayout, Xsize*2-1, Ysize*2-1);
00047     return 0;
00048 }