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

Comparing deliantra/server/random_maps/floor.C (file contents):
Revision 1.3 by root, Sun Sep 3 09:00:09 2006 UTC vs.
Revision 1.4 by root, Sun Sep 10 16:06:37 2006 UTC

1
1/* 2/*
2 * static char *rcsid_floor_c = 3 * static char *rcsid_floor_c =
3 * "$Id: floor.C,v 1.3 2006/09/03 09:00:09 root Exp $"; 4 * "$Id: floor.C,v 1.4 2006/09/10 16:06:37 root Exp $";
4 */ 5 */
5 6
6/* 7/*
7 CrossFire, A Multiplayer game for X-windows 8 CrossFire, A Multiplayer game for X-windows
8 9
31#include <random_map.h> 32#include <random_map.h>
32#include <rproto.h> 33#include <rproto.h>
33 34
34/* make a map and layout the floor. */ 35/* make a map and layout the floor. */
35 36
37mapstruct *
36mapstruct *make_map_floor(char **layout, char *floorstyle,RMParms *RP) { 38make_map_floor (char **layout, char *floorstyle, RMParms * RP)
39{
37 char styledirname[256]; 40 char styledirname[256];
38 char stylefilepath[256]; 41 char stylefilepath[256];
39 mapstruct *style_map=0; 42 mapstruct *style_map = 0;
40 object *the_floor; 43 object *the_floor;
41 mapstruct *newMap =0; 44 mapstruct *newMap = 0;
42 45
43 /* allocate the map */ 46 /* allocate the map */
44 newMap = get_empty_map(RP->Xsize,RP->Ysize); 47 newMap = get_empty_map (RP->Xsize, RP->Ysize);
45 48
46 /* get the style map */ 49 /* get the style map */
47 sprintf(styledirname,"%s","/styles/floorstyles"); 50 sprintf (styledirname, "%s", "/styles/floorstyles");
48 sprintf(stylefilepath,"%s/%s",styledirname,floorstyle); 51 sprintf (stylefilepath, "%s/%s", styledirname, floorstyle);
49 style_map = find_style(styledirname,floorstyle,-1); 52 style_map = find_style (styledirname, floorstyle, -1);
50 if(style_map == 0) return newMap; 53 if (style_map == 0)
54 return newMap;
51 55
52 /* fill up the map with the given floor style */ 56 /* fill up the map with the given floor style */
53 if((the_floor=pick_random_object(style_map))!=NULL) { 57 if ((the_floor = pick_random_object (style_map)) != NULL)
58 {
54 int i,j; 59 int i, j;
60
55 for(i=0;i<RP->Xsize;i++) 61 for (i = 0; i < RP->Xsize; i++)
56 for(j=0;j<RP->Ysize;j++) { 62 for (j = 0; j < RP->Ysize; j++)
63 {
57 object *thisfloor=arch_to_object(the_floor->arch); 64 object *thisfloor = arch_to_object (the_floor->arch);
58 thisfloor->x = i; thisfloor->y = j; 65
66 thisfloor->x = i;
67 thisfloor->y = j;
59 insert_ob_in_map(thisfloor,newMap,thisfloor,INS_NO_MERGE | INS_NO_WALK_ON); 68 insert_ob_in_map (thisfloor, newMap, thisfloor, INS_NO_MERGE | INS_NO_WALK_ON);
60 } 69 }
61 } 70 }
62 return newMap; 71 return newMap;
63} 72}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines