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

Comparing deliantra/server/random_maps/wall.C (file contents):
Revision 1.5 by root, Thu Sep 14 21:16:12 2006 UTC vs.
Revision 1.10 by root, Wed Dec 20 09:14:22 2006 UTC

1
2/*
3 * static char *rcsid_wall_c =
4 * "$Id: wall.C,v 1.5 2006/09/14 21:16:12 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#include <global.h> 24#include <global.h>
31#include <random_map.h> 25#include <random_map.h>
32#include <rproto.h> 26#include <rproto.h>
86 * Since this is part of the random map code, presumption 80 * Since this is part of the random map code, presumption
87 * is that this is not a tiled map. 81 * is that this is not a tiled map.
88 * What is considered blocking and not is somewhat hard coded. 82 * What is considered blocking and not is somewhat hard coded.
89 */ 83 */
90int 84int
91surround_flag3 (mapstruct *map, sint16 i, sint16 j, RMParms * RP) 85surround_flag3 (maptile *map, sint16 i, sint16 j, RMParms * RP)
92{ 86{
93 /* 87 /*
94 * 1 = blocked to left, 88 * 1 = blocked to left,
95 * 2 = blocked to right, 89 * 2 = blocked to right,
96 * 4 = blocked above 90 * 4 = blocked above
112} 106}
113 107
114/* like surround_flag2, except it checks a map, not a layout. */ 108/* like surround_flag2, except it checks a map, not a layout. */
115 109
116int 110int
117surround_flag4 (mapstruct *map, int i, int j, RMParms * RP) 111surround_flag4 (maptile *map, int i, int j, RMParms * RP)
118{ 112{
119 /* 1 = blocked to left, 113 /* 1 = blocked to left,
120 2 = blocked to right, 114 2 = blocked to right,
121 4 = blocked above 115 4 = blocked above
122 8 = blocked below */ 116 8 = blocked below */
136 130
137/* takes a map and a layout, and puts walls in the map (picked from 131/* takes a map and a layout, and puts walls in the map (picked from
138 w_style) at '#' marks. */ 132 w_style) at '#' marks. */
139 133
140void 134void
141make_map_walls (mapstruct *map, char **layout, char *w_style, RMParms * RP) 135make_map_walls (maptile *map, char **layout, char *w_style, RMParms * RP)
142{ 136{
143 char styledirname[256]; 137 char styledirname[256];
144 char stylefilepath[256]; 138 char stylefilepath[256];
145 mapstruct *style_map = 0; 139 maptile *style_map = 0;
146 object *the_wall; 140 object *the_wall;
147 141
148 /* get the style map */ 142 /* get the style map */
149 if (!strcmp (w_style, "none")) 143 if (!strcmp (w_style, "none"))
150 return; 144 return;
294 * remove anything. It depends on the 288 * remove anything. It depends on the
295 * global, previously-set variable, "wall_name" 289 * global, previously-set variable, "wall_name"
296 */ 290 */
297 291
298object * 292object *
299retrofit_joined_wall (mapstruct *the_map, int i, int j, int insert_flag, RMParms * RP) 293retrofit_joined_wall (maptile *the_map, int i, int j, int insert_flag, RMParms * RP)
300{ 294{
301 /* 1 = wall to left, 295 /* 1 = wall to left,
302 * 2 = wall to right, 296 * 2 = wall to right,
303 * 4 = wall above 297 * 4 = wall above
304 * 8 = wall below 298 * 8 = wall below
308 object *the_wall = 0; 302 object *the_wall = 0;
309 object *new_wall = 0; 303 object *new_wall = 0;
310 archetype *wall_arch = 0; 304 archetype *wall_arch = 0;
311 305
312 /* first find the wall */ 306 /* first find the wall */
313 for (the_wall = get_map_ob (the_map, i, j); the_wall != NULL; the_wall = the_wall->above) 307 for (the_wall = GET_MAP_OB (the_map, i, j); the_wall != NULL; the_wall = the_wall->above)
314 if ((the_wall->move_type & MOVE_WALK) && the_wall->type != EXIT && the_wall->type != TELEPORTER) 308 if ((the_wall->move_type & MOVE_WALK) && the_wall->type != EXIT && the_wall->type != TELEPORTER)
315 break; 309 break;
316 310
317 311
318 /* if what we found is a door, don't remove it, set the_wall to NULL to 312 /* if what we found is a door, don't remove it, set the_wall to NULL to
401 new_wall = arch_to_object (wall_arch); 395 new_wall = arch_to_object (wall_arch);
402 new_wall->x = i; 396 new_wall->x = i;
403 new_wall->y = j; 397 new_wall->y = j;
404 if (the_wall && the_wall->map) 398 if (the_wall && the_wall->map)
405 { 399 {
406 remove_ob (the_wall); 400 the_wall->remove ();
407 free_object (the_wall); 401 the_wall->destroy ();
408 } 402 }
409 the_wall->move_block = MOVE_ALL; 403 the_wall->move_block = MOVE_ALL;
410 insert_ob_in_map (new_wall, the_map, new_wall, INS_NO_MERGE | INS_NO_WALK_ON); 404 insert_ob_in_map (new_wall, the_map, new_wall, INS_NO_MERGE | INS_NO_WALK_ON);
411 } 405 }
412 else 406 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines