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.1 by elmex, Sun Aug 13 17:16:03 2006 UTC vs.
Revision 1.11 by pippijn, Sat Jan 6 14:42:30 2007 UTC

1/*
2 * static char *rcsid_floor_c =
3 * "$Id: floor.C,v 1.1 2006/08/13 17:16:03 elmex Exp $";
4 */
5 1
6/* 2/*
7 CrossFire, A Multiplayer game for X-windows 3 CrossFire, A Multiplayer game for X-windows
8 4
5 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
9 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 6 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
10 Copyright (C) 1992 Frank Tore Johansen 7 Copyright (C) 1992 Frank Tore Johansen
11 8
12 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
21 18
22 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software 20 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 22
26 The authors can be reached via e-mail at crossfire-devel@real-time.com 23 The authors can be reached via e-mail at <crossfire@schmorp.de>
27*/ 24*/
28 25
29 26
30#include <global.h> 27#include <global.h>
31#include <random_map.h> 28#include <random_map.h>
32#include <rproto.h> 29#include <rproto.h>
33 30
34/* make a map and layout the floor. */ 31/* make a map and layout the floor. */
35 32
33maptile *
36mapstruct *make_map_floor(char **layout, char *floorstyle,RMParms *RP) { 34make_map_floor (char **layout, char *floorstyle, random_map_params *RP)
35{
37 char styledirname[256]; 36 char styledirname[1024];
38 char stylefilepath[256]; 37 char stylefilepath[1024];
39 mapstruct *style_map=0; 38 maptile *style_map = 0;
40 object *the_floor; 39 object *the_floor;
41 mapstruct *newMap =0; /* (mapstruct *) calloc(sizeof(mapstruct),1); */ 40 maptile *newMap = 0;
42 41
43 /* allocate the map */ 42 /* allocate the map */
44 newMap = get_empty_map(RP->Xsize,RP->Ysize); 43 newMap = new maptile (RP->Xsize, RP->Ysize);
45 44
46 /* get the style map */ 45 /* get the style map */
47 sprintf(styledirname,"%s","/styles/floorstyles"); 46 sprintf (styledirname, "%s", "/styles/floorstyles");
48 sprintf(stylefilepath,"%s/%s",styledirname,floorstyle); 47 sprintf (stylefilepath, "%s/%s", styledirname, floorstyle);
49 style_map = find_style(styledirname,floorstyle,-1); 48 style_map = find_style (styledirname, floorstyle, -1);
50 if(style_map == 0) return newMap; 49 if (style_map == 0)
50 return newMap;
51 51
52 /* fill up the map with the given floor style */ 52 /* fill up the map with the given floor style */
53 if((the_floor=pick_random_object(style_map))!=NULL) { 53 if ((the_floor = pick_random_object (style_map)) != NULL)
54 int i,j; 54 {
55 int i, j;
56
55 for(i=0;i<RP->Xsize;i++) 57 for (i = 0; i < RP->Xsize; i++)
56 for(j=0;j<RP->Ysize;j++) { 58 for (j = 0; j < RP->Ysize; j++)
59 {
57 object *thisfloor=arch_to_object(the_floor->arch); 60 object *thisfloor = arch_to_object (the_floor->arch);
58 thisfloor->x = i; thisfloor->y = j; 61
62 thisfloor->x = i;
63 thisfloor->y = j;
59 insert_ob_in_map(thisfloor,newMap,thisfloor,INS_NO_MERGE | INS_NO_WALK_ON); 64 insert_ob_in_map (thisfloor, newMap, thisfloor, INS_NO_MERGE | INS_NO_WALK_ON);
60 } 65 }
61 } 66 }
62 return newMap; 67 return newMap;
63} 68}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines