ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/floor.C
Revision: 1.9
Committed: Sun Dec 31 19:02:24 2006 UTC (17 years, 5 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.8: +2 -1 lines
Log Message:
reindent, minor changes

File Contents

# Content
1
2 /*
3 CrossFire, A Multiplayer game for X-windows
4
5 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
6 Copyright (C) 1992 Frank Tore Johansen
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 The authors can be reached via e-mail at <crossfire@schmorp.de>
23 */
24
25
26 #include <global.h>
27 #include <random_map.h>
28 #include <rproto.h>
29
30 /* make a map and layout the floor. */
31
32 maptile *
33 make_map_floor (char **layout, char *floorstyle, random_map_params *RP)
34 {
35 char styledirname[256];
36 char stylefilepath[256];
37 maptile *style_map = 0;
38 object *the_floor;
39 maptile *newMap = 0;
40
41 /* allocate the map */
42 newMap = new maptile (RP->Xsize, RP->Ysize);
43
44 /* get the style map */
45 sprintf (styledirname, "%s", "/styles/floorstyles");
46 sprintf (stylefilepath, "%s/%s", styledirname, floorstyle);
47 style_map = find_style (styledirname, floorstyle, -1);
48 if (style_map == 0)
49 return newMap;
50
51 /* fill up the map with the given floor style */
52 if ((the_floor = pick_random_object (style_map)) != NULL)
53 {
54 int i, j;
55
56 for (i = 0; i < RP->Xsize; i++)
57 for (j = 0; j < RP->Ysize; j++)
58 {
59 object *thisfloor = arch_to_object (the_floor->arch);
60
61 thisfloor->x = i;
62 thisfloor->y = j;
63 insert_ob_in_map (thisfloor, newMap, thisfloor, INS_NO_MERGE | INS_NO_WALK_ON);
64 }
65 }
66 return newMap;
67 }