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

Comparing deliantra/server/random_maps/decor.C (file contents):
Revision 1.2 by root, Sun Sep 10 16:06:37 2006 UTC vs.
Revision 1.6 by root, Wed Dec 20 09:14:22 2006 UTC

1
2/*
3 * static char *rcsid_decor_ =
4 * "$Id: decor.C,v 1.2 2006/09/10 16:06:37 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
22 16
23 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 20
27 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at <crossfire@schmorp.de>
28*/ 22*/
29 23
30 24
31#include <global.h> 25#include <global.h>
32#include <random_map.h> 26#include <random_map.h>
35#define NR_DECOR_OPTIONS 1 29#define NR_DECOR_OPTIONS 1
36 30
37/* return a simple count of objects in the map at x,y. */ 31/* return a simple count of objects in the map at x,y. */
38 32
39int 33int
40obj_count_in_map (mapstruct *map, int x, int y) 34obj_count_in_map (maptile *map, int x, int y)
41{ 35{
42 int count = 0; 36 int count = 0;
43 object *tmp; 37 object *tmp;
44 38
45 for (tmp = get_map_ob (map, x, y); tmp != NULL; tmp = tmp->above) 39 for (tmp = GET_MAP_OB (map, x, y); tmp != NULL; tmp = tmp->above)
46 count++; 40 count++;
47 return count; 41 return count;
48} 42}
49 43
50/* put the decor into the map. Right now, it's very primitive. */ 44/* put the decor into the map. Right now, it's very primitive. */
51 45
52void 46void
53put_decor (mapstruct *map, char **maze, char *decorstyle, int decor_option, RMParms * RP) 47put_decor (maptile *map, char **maze, char *decorstyle, int decor_option, RMParms * RP)
54{ 48{
55 mapstruct *decor_map; 49 maptile *decor_map;
56 char style_name[256]; 50 char style_name[256];
57 51
58 sprintf (style_name, "/styles/decorstyles"); 52 sprintf (style_name, "/styles/decorstyles");
59 53
60 decor_map = find_style (style_name, decorstyle, -1); 54 decor_map = find_style (style_name, decorstyle, -1);
83 { /* empty */ 77 { /* empty */
84 object *this_object; 78 object *this_object;
85 79
86 new_decor_object = pick_random_object (decor_map); 80 new_decor_object = pick_random_object (decor_map);
87 this_object = arch_to_object (new_decor_object->arch); 81 this_object = arch_to_object (new_decor_object->arch);
88 copy_object (new_decor_object, this_object); 82 new_decor_object->copy_to (this_object);
89 this_object->x = x; 83 this_object->x = x;
90 this_object->y = y; 84 this_object->y = y;
91 /* it screws things up if decor can stop people */ 85 /* it screws things up if decor can stop people */
92 this_object->move_block = MOVE_BLOCK_DEFAULT; 86 this_object->move_block = MOVE_BLOCK_DEFAULT;
93 insert_ob_in_map (this_object, map, NULL, 0); 87 insert_ob_in_map (this_object, map, NULL, 0);
109 { 103 {
110 object *new_decor_object, *this_object; 104 object *new_decor_object, *this_object;
111 105
112 new_decor_object = pick_random_object (decor_map); 106 new_decor_object = pick_random_object (decor_map);
113 this_object = arch_to_object (new_decor_object->arch); 107 this_object = arch_to_object (new_decor_object->arch);
114 copy_object (new_decor_object, this_object); 108 new_decor_object->copy_to (this_object);
115 this_object->x = i; 109 this_object->x = i;
116 this_object->y = j; 110 this_object->y = j;
117 /* it screws things up if decor can stop people */ 111 /* it screws things up if decor can stop people */
118 this_object->move_block = MOVE_BLOCK_DEFAULT; 112 this_object->move_block = MOVE_BLOCK_DEFAULT;
119 insert_ob_in_map (this_object, map, NULL, 0); 113 insert_ob_in_map (this_object, map, NULL, 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines