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.3 by root, Sun Sep 3 00:18:42 2006 UTC vs.
Revision 1.21 by root, Tue Apr 17 16:21:17 2007 UTC

1/* 1/*
2 * static char *rcsid_wall_c = 2 * CrossFire, A Multiplayer game for X-windows
3 * "$Id: wall.C,v 1.3 2006/09/03 00:18:42 root Exp $"; 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
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>
4 */ 23 */
5
6/*
7 CrossFire, A Multiplayer game for X-windows
8
9 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
10 Copyright (C) 1992 Frank Tore Johansen
11
12 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
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
26 The authors can be reached via e-mail at crossfire-devel@real-time.com
27*/
28 24
29#include <global.h> 25#include <global.h>
30#include <random_map.h> 26#include <random_map.h>
31#include <rproto.h> 27#include <rproto.h>
32 28
34 30
35 31
36/* given a layout and a coordinate, tell me which squares up/down/right/left 32/* given a layout and a coordinate, tell me which squares up/down/right/left
37 are occupied. */ 33 are occupied. */
38 34
35int
39int surround_flag(char **layout,int i,int j,RMParms *RP){ 36surround_flag (char **layout, int i, int j, random_map_params *RP)
37{
40 /* 1 = wall to left, 38 /* 1 = wall to left,
41 2 = wall to right, 39 2 = wall to right,
42 4 = wall above 40 4 = wall above
43 8 = wall below */ 41 8 = wall below */
42 int surround_index = 0;
43
44 if ((i > 0) && layout[i - 1][j] != 0)
44 int surround_index = 0; 45 surround_index |= 1;
45 if((i > 0) && layout[i-1][j]!=0) surround_index |=1;
46 if((i < RP->Xsize-1) && layout[i+1][j]!=0) surround_index |=2; 46 if ((i < RP->Xsize - 1) && layout[i + 1][j] != 0)
47 if((j > 0) && layout[i][j-1]!=0) surround_index |=4; 47 surround_index |= 2;
48 if ((j > 0) && layout[i][j - 1] != 0)
49 surround_index |= 4;
48 if((j < RP->Ysize-1) && layout[i][j+1]!=0) surround_index |=8; 50 if ((j < RP->Ysize - 1) && layout[i][j + 1] != 0)
51 surround_index |= 8;
49 return surround_index; 52 return surround_index;
50} 53}
51 54
52 55
53/* like surround_flag, but only walls count. 56/* like surround_flag, but only walls count.
54 */ 57 */
55 58
59int
56int surround_flag2(char **layout,int i,int j,RMParms *RP){ 60surround_flag2 (char **layout, int i, int j, random_map_params *RP)
61{
57 /* 1 = wall to left, 62 /* 1 = wall to left,
58 2 = wall to right, 63 2 = wall to right,
59 4 = wall above 64 4 = wall above
60 8 = wall below */ 65 8 = wall below */
66 int surround_index = 0;
67
68 if ((i > 0) && layout[i - 1][j] == '#')
61 int surround_index = 0; 69 surround_index |= 1;
62 if((i > 0) && layout[i-1][j]=='#') surround_index |=1;
63 if((i < RP->Xsize-1) && layout[i+1][j]=='#') surround_index |=2; 70 if ((i < RP->Xsize - 1) && layout[i + 1][j] == '#')
64 if((j > 0) && layout[i][j-1]=='#') surround_index |=4; 71 surround_index |= 2;
72 if ((j > 0) && layout[i][j - 1] == '#')
73 surround_index |= 4;
65 if((j < RP->Ysize-1) && layout[i][j+1]=='#') surround_index |=8; 74 if ((j < RP->Ysize - 1) && layout[i][j + 1] == '#')
75 surround_index |= 8;
66 return surround_index; 76 return surround_index;
67} 77}
68 78
69 79
70/* like surround_flag, except it checks a map, not a layout. 80/* like surround_flag, except it checks a map, not a layout.
71 * Since this is part of the random map code, presumption 81 * Since this is part of the random map code, presumption
72 * is that this is not a tiled map. 82 * is that this is not a tiled map.
73 * What is considered blocking and not is somewhat hard coded. 83 * What is considered blocking and not is somewhat hard coded.
74 */ 84 */
85int
75int surround_flag3(mapstruct *map,sint16 i,sint16 j,RMParms *RP){ 86surround_flag3 (maptile *map, sint16 i, sint16 j, random_map_params *RP)
87{
76 /* 88 /*
77 * 1 = blocked to left, 89 * 1 = blocked to left,
78 * 2 = blocked to right, 90 * 2 = blocked to right,
79 * 4 = blocked above 91 * 4 = blocked above
80 * 8 = blocked below 92 * 8 = blocked below
81 */ 93 */
82 94
83 int surround_index = 0; 95 int surround_index = 0;
84 96
97 // don't forget to update the mapspace!
98 if (i > 0) map->at (i - 1, j ).update ();
99 if (i < RP->Xsize - 1) map->at (i + 1, j ).update ();
100 if (j > 0) map->at (i , j - 1).update ();
101 if (j < RP->Ysize - 1) map->at (i , j + 1).update ();
102
85 if((i > 0) && (GET_MAP_MOVE_BLOCK(map, i-1,j) & ~MOVE_BLOCK_DEFAULT)) 103 if ((i > 0) && (GET_MAP_MOVE_BLOCK (map, i - 1, j) & MOVE_WALK))
86 surround_index |=1; 104 surround_index |= 1;
87 if((i < RP->Xsize-1) && (GET_MAP_MOVE_BLOCK(map, i+1,j) & ~MOVE_BLOCK_DEFAULT)) 105 if ((i < RP->Xsize - 1) && (GET_MAP_MOVE_BLOCK (map, i + 1, j) & MOVE_WALK))
88 surround_index |=2; 106 surround_index |= 2;
89 if((j > 0) && (GET_MAP_MOVE_BLOCK(map, i,j-1) & ~MOVE_BLOCK_DEFAULT)) 107 if ((j > 0) && (GET_MAP_MOVE_BLOCK (map, i, j - 1) & MOVE_WALK))
90 surround_index |=4; 108 surround_index |= 4;
91 if((j < RP->Ysize-1) && (GET_MAP_MOVE_BLOCK(map,i,j+1) & ~MOVE_BLOCK_DEFAULT)) 109 if ((j < RP->Ysize - 1) && (GET_MAP_MOVE_BLOCK (map, i, j + 1) & MOVE_WALK))
92 surround_index |=8; 110 surround_index |= 8;
93 111
94 return surround_index; 112 return surround_index;
95} 113}
96 114
97/* like surround_flag2, except it checks a map, not a layout. */ 115/* like surround_flag2, except it checks a map, not a layout. */
98 116
99int surround_flag4(mapstruct *map,int i,int j,RMParms *RP){ 117int
118surround_flag4 (maptile *map, int i, int j, random_map_params *RP)
119{
100 /* 1 = blocked to left, 120 /* 1 = blocked to left,
101 2 = blocked to right, 121 2 = blocked to right,
102 4 = blocked above 122 4 = blocked above
103 8 = blocked below */ 123 8 = blocked below */
124 int surround_index = 0;
125
126 if ((i > 0) && wall_blocked (map, i - 1, j))
104 int surround_index = 0; 127 surround_index |= 1;
105
106 if((i > 0) && wall_blocked(map,i-1,j)) surround_index |=1;
107 if((i < RP->Xsize-1) && wall_blocked(map,i+1,j)) surround_index |=2; 128 if ((i < RP->Xsize - 1) && wall_blocked (map, i + 1, j))
129 surround_index |= 2;
108 if((j > 0) && wall_blocked(map,i,j-1)) surround_index |=4; 130 if ((j > 0) && wall_blocked (map, i, j - 1))
131 surround_index |= 4;
109 if((j < RP->Ysize-1) && wall_blocked(map,i,j+1)) surround_index |=8; 132 if ((j < RP->Ysize - 1) && wall_blocked (map, i, j + 1))
133 surround_index |= 8;
110 134
111 return surround_index; 135 return surround_index;
112} 136}
113 137
114/* takes a map and a layout, and puts walls in the map (picked from 138/* takes a map and a layout, and puts walls in the map (picked from
115 w_style) at '#' marks. */ 139 w_style) at '#' marks. */
116 140
141void
117void make_map_walls(mapstruct *map,char **layout, char *w_style,RMParms *RP) { 142make_map_walls (maptile *map, char **layout, char *w_style, random_map_params *RP)
143{
118 char styledirname[256]; 144 char styledirname[1024];
119 char stylefilepath[256]; 145 char stylefilepath[1024];
120 mapstruct *style_map=0; 146 maptile *style_map = 0;
121 object *the_wall; 147 object *the_wall;
122 148
123 /* get the style map */ 149 /* get the style map */
124 if(!strcmp(w_style,"none")) return; 150 if (!strcmp (w_style, "none"))
151 return;
125 sprintf(styledirname,"%s","/styles/wallstyles"); 152 sprintf (styledirname, "%s", "/styles/wallstyles");
126 sprintf(stylefilepath,"%s/%s",styledirname,w_style); 153 sprintf (stylefilepath, "%s/%s", styledirname, w_style);
127 style_map = find_style(styledirname,w_style,-1); 154 style_map = find_style (styledirname, w_style, -1);
128 if(style_map == 0) return; 155 if (!style_map)
156 return;
129 157
130 /* fill up the map with the given floor style */ 158 /* fill up the map with the given floor style */
131 if((the_wall=pick_random_object(style_map))!=NULL) { 159 if ((the_wall = style_map->pick_random_object ()))
160 {
132 int i,j; 161 int i, j;
133 char *cp; 162 char *cp;
134 int joinedwalls=0; 163 int joinedwalls = 0;
135 object *thiswall; 164 object *thiswall;
136 165
137 sprintf(RP->wall_name,"%s", &the_wall->arch->name); 166 sprintf (RP->wall_name, "%s", &the_wall->arch->name);
138 if ((cp=strchr(RP->wall_name,'_'))!=NULL) { 167 if ((cp = strchr (RP->wall_name, '_')) != NULL)
168 {
139 *cp=0; 169 *cp = 0;
140 joinedwalls=1; 170 joinedwalls = 1;
141 } 171 }
142 172
143 for(i=0;i<RP->Xsize;i++) 173 for (i = 0; i < RP->Xsize; i++)
144 for(j=0;j<RP->Ysize;j++) { 174 for (j = 0; j < RP->Ysize; j++)
175 {
145 if(layout[i][j]=='#') { 176 if (layout[i][j] == '#')
177 {
146 if(joinedwalls) 178 if (joinedwalls)
147 thiswall=pick_joined_wall(the_wall,layout,i,j,RP); 179 thiswall = pick_joined_wall (the_wall, layout, i, j, RP);
148 else 180 else
149 thiswall=arch_to_object(the_wall->arch); 181 thiswall = arch_to_object (the_wall->arch);
150 thiswall->x = i; 182 thiswall->x = i;
151 thiswall->y = j; 183 thiswall->y = j;
152 thiswall->move_block = MOVE_ALL; 184 thiswall->move_block = MOVE_ALL;
153 insert_ob_in_map(thiswall,map,thiswall,INS_NO_MERGE | INS_NO_WALK_ON); 185 insert_ob_in_map (thiswall, map, thiswall, INS_NO_MERGE | INS_NO_WALK_ON);
154 } 186 }
155 } 187 }
156 } 188 }
157} 189}
158 190
159 191
160/* picks the right wall type for this square, to make it look nice, 192/* picks the right wall type for this square, to make it look nice,
161 and have everything nicely joined. It uses the layout. */ 193 and have everything nicely joined. It uses the layout. */
162 194
195object *
163object *pick_joined_wall(object *the_wall,char **layout,int i,int j,RMParms *RP) { 196pick_joined_wall (object *the_wall, char **layout, int i, int j, random_map_params *RP)
197{
164 /* 1 = wall to left, 198 /* 1 = wall to left,
165 2 = wall to right, 199 2 = wall to right,
166 4 = wall above 200 4 = wall above
167 8 = wall below */ 201 8 = wall below */
168 int surround_index=0; 202 int surround_index = 0;
169 int l; 203 int l;
170 char wall_name[64]; 204 char wall_name[1024];
171 archetype *wall_arch=0; 205 archetype *wall_arch = 0;
172 206
173 strcpy(wall_name,the_wall->arch->name); 207 assign (wall_name, the_wall->arch->name);
174 208
175 /* conventionally, walls are named like this: 209 /* conventionally, walls are named like this:
176 wallname_wallcode, where wallcode indicates 210 wallname_wallcode, where wallcode indicates
177 a joinedness, and wallname is the wall. 211 a joinedness, and wallname is the wall.
178 this code depends on the convention for 212 this code depends on the convention for
179 finding the right wall. */ 213 finding the right wall. */
180 214
181 /* extract the wall name, which is the text up to the leading _ */ 215 /* extract the wall name, which is the text up to the leading _ */
182 for(l=0;l<64;l++) { 216 for (l = 0; l < 64; l++)
217 {
183 if(wall_name[l]=='_') { 218 if (wall_name[l] == '_')
219 {
184 wall_name[l] = 0; 220 wall_name[l] = 0;
185 break;
186 }
187 }
188
189 surround_index = surround_flag2(layout,i,j,RP);
190
191 switch(surround_index) {
192 case 0:
193 strcat(wall_name,"_0");
194 break; 221 break;
195 case 1: 222 }
223 }
224
225 surround_index = surround_flag2 (layout, i, j, RP);
226
227 switch (surround_index)
228 {
229 case 0:
196 strcat(wall_name,"_1_3"); 230 strcat (wall_name, "_0");
197 break; 231 break;
198 case 2: 232 case 1:
199 strcat(wall_name,"_1_4"); 233 strcat (wall_name, "_1_3");
200 break; 234 break;
201 case 3: 235 case 2:
202 strcat(wall_name,"_2_1_2"); 236 strcat (wall_name, "_1_4");
203 break; 237 break;
204 case 4: 238 case 3:
205 strcat(wall_name,"_1_2"); 239 strcat (wall_name, "_2_1_2");
206 break; 240 break;
207 case 5: 241 case 4:
208 strcat(wall_name,"_2_2_4"); 242 strcat (wall_name, "_1_2");
209 break; 243 break;
210 case 6: 244 case 5:
211 strcat(wall_name,"_2_2_1"); 245 strcat (wall_name, "_2_2_4");
212 break; 246 break;
213 case 7: 247 case 6:
214 strcat(wall_name,"_3_1"); 248 strcat (wall_name, "_2_2_1");
215 break; 249 break;
216 case 8: 250 case 7:
217 strcat(wall_name,"_1_1"); 251 strcat (wall_name, "_3_1");
218 break; 252 break;
219 case 9: 253 case 8:
220 strcat(wall_name,"_2_2_3"); 254 strcat (wall_name, "_1_1");
221 break; 255 break;
222 case 10: 256 case 9:
223 strcat(wall_name,"_2_2_2"); 257 strcat (wall_name, "_2_2_3");
224 break; 258 break;
225 case 11: 259 case 10:
226 strcat(wall_name,"_3_3"); 260 strcat (wall_name, "_2_2_2");
227 break; 261 break;
228 case 12: 262 case 11:
229 strcat(wall_name,"_2_1_1"); 263 strcat (wall_name, "_3_3");
230 break; 264 break;
231 case 13: 265 case 12:
232 strcat(wall_name,"_3_4"); 266 strcat (wall_name, "_2_1_1");
233 break; 267 break;
234 case 14: 268 case 13:
235 strcat(wall_name,"_3_2"); 269 strcat (wall_name, "_3_4");
236 break; 270 break;
237 case 15: 271 case 14:
238 strcat(wall_name,"_4"); 272 strcat (wall_name, "_3_2");
239 break; 273 break;
274 case 15:
275 strcat (wall_name, "_4");
276 break;
240 } 277 }
241 wall_arch = find_archetype(wall_name); 278 wall_arch = archetype::find (wall_name);
242 if(wall_arch) return arch_to_object(wall_arch);
243 else {
244 nroferrors--;
245 return arch_to_object(the_wall->arch);
246 }
247 279
248 280 return wall_arch ? arch_to_object (wall_arch) : arch_to_object (the_wall->arch);
249} 281}
250 282
251 283
252/* this takes a map, and changes an existing wall to match what's blocked 284/* this takes a map, and changes an existing wall to match what's blocked
253 * around it, counting only doors and walls as blocked. If insert_flag is 285 * around it, counting only doors and walls as blocked. If insert_flag is
254 * 1, it will go ahead and insert the wall into the map. If not, it 286 * 1, it will go ahead and insert the wall into the map. If not, it
255 * will only return the wall which would belong there, and doesn't 287 * will only return the wall which would belong there, and doesn't
256 * remove anything. It depends on the 288 * remove anything. It depends on the
257 * global, previously-set variable, "wall_name" 289 * global, previously-set variable, "wall_name"
258 */ 290 */
259 291
292object *
260object * retrofit_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, random_map_params *RP)
294{
261 /* 1 = wall to left, 295 /* 1 = wall to left,
262 * 2 = wall to right, 296 * 2 = wall to right,
263 * 4 = wall above 297 * 4 = wall above
264 * 8 = wall below 298 * 8 = wall below
265 */ 299 */
266 int surround_index=0; 300 int surround_index = 0;
267 int l; 301 int l;
268 object *the_wall=0; 302 object *the_wall = 0;
269 object *new_wall=0; 303 object *new_wall = 0;
270 archetype * wall_arch=0; 304 archetype *wall_arch = 0;
271 305
272 /* first find the wall */ 306 /* first find the wall */
273 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)
274 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)
275 break; 309 break;
276 310
277 311
278 /* 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
279 * signal that later. 313 * signal that later.
280 */ 314 */
281 if(the_wall && (the_wall->type==DOOR || the_wall->type==LOCKED_DOOR) ) { 315 if (the_wall && (the_wall->type == DOOR || the_wall->type == LOCKED_DOOR))
316 {
282 the_wall=NULL; 317 the_wall = NULL;
283 /* if we're not supposed to insert a new wall where there wasn't one, 318 /* if we're not supposed to insert a new wall where there wasn't one,
284 * we've gotta leave. 319 * we've gotta leave.
285 */ 320 */
286 if(insert_flag==0) return 0; 321 if (insert_flag == 0)
322 return 0;
287 } 323 }
288 else if(the_wall==NULL) return NULL; 324 else if (the_wall == NULL)
325 return NULL;
289 326
290 /* canonicalize the wall name */ 327 /* canonicalize the wall name */
291 for(l=0;l<64;l++) { 328 for (l = 0; l < 64; l++)
329 {
292 if(RP->wall_name[l]=='_') { 330 if (RP->wall_name[l] == '_')
331 {
293 RP->wall_name[l] = 0; 332 RP->wall_name[l] = 0;
294 break; 333 break;
295 } 334 }
296 } 335 }
297 336
298 surround_index = surround_flag4(the_map,i,j,RP); 337 surround_index = surround_flag4 (the_map, i, j, RP);
299 /* This would be a lot cleaner to just us a lookup table, 338 /* This would be a lot cleaner to just us a lookup table,
300 * eg, wall_suffix[surround_index] 339 * eg, wall_suffix[surround_index]
301 */ 340 */
302 switch(surround_index) { 341 switch (surround_index)
342 {
303 case 0: 343 case 0:
304 strcat(RP->wall_name,"_0"); 344 strcat (RP->wall_name, "_0");
305 break; 345 break;
306 case 1: 346 case 1:
307 strcat(RP->wall_name,"_1_3"); 347 strcat (RP->wall_name, "_1_3");
308 break; 348 break;
309 case 2: 349 case 2:
310 strcat(RP->wall_name,"_1_4"); 350 strcat (RP->wall_name, "_1_4");
311 break; 351 break;
312 case 3: 352 case 3:
313 strcat(RP->wall_name,"_2_1_2"); 353 strcat (RP->wall_name, "_2_1_2");
314 break; 354 break;
315 case 4: 355 case 4:
316 strcat(RP->wall_name,"_1_2"); 356 strcat (RP->wall_name, "_1_2");
317 break; 357 break;
318 case 5: 358 case 5:
319 strcat(RP->wall_name,"_2_2_4"); 359 strcat (RP->wall_name, "_2_2_4");
320 break; 360 break;
321 case 6: 361 case 6:
322 strcat(RP->wall_name,"_2_2_1"); 362 strcat (RP->wall_name, "_2_2_1");
323 break; 363 break;
324 case 7: 364 case 7:
325 strcat(RP->wall_name,"_3_1"); 365 strcat (RP->wall_name, "_3_1");
326 break; 366 break;
327 case 8: 367 case 8:
328 strcat(RP->wall_name,"_1_1"); 368 strcat (RP->wall_name, "_1_1");
329 break; 369 break;
330 case 9: 370 case 9:
331 strcat(RP->wall_name,"_2_2_3"); 371 strcat (RP->wall_name, "_2_2_3");
332 break; 372 break;
333 case 10: 373 case 10:
334 strcat(RP->wall_name,"_2_2_2"); 374 strcat (RP->wall_name, "_2_2_2");
335 break; 375 break;
336 case 11: 376 case 11:
337 strcat(RP->wall_name,"_3_3"); 377 strcat (RP->wall_name, "_3_3");
338 break; 378 break;
339 case 12: 379 case 12:
340 strcat(RP->wall_name,"_2_1_1"); 380 strcat (RP->wall_name, "_2_1_1");
341 break; 381 break;
342 case 13: 382 case 13:
343 strcat(RP->wall_name,"_3_4"); 383 strcat (RP->wall_name, "_3_4");
344 break; 384 break;
345 case 14: 385 case 14:
346 strcat(RP->wall_name,"_3_2"); 386 strcat (RP->wall_name, "_3_2");
347 break; 387 break;
348 case 15: 388 case 15:
349 strcat(RP->wall_name,"_4"); 389 strcat (RP->wall_name, "_4");
350 break; 390 break;
351 } 391 }
392
352 wall_arch = find_archetype(RP->wall_name); 393 wall_arch = archetype::find (RP->wall_name);
353 if(wall_arch!=NULL) { 394
395 if (!wall_arch)
396 {
354 new_wall=arch_to_object(wall_arch); 397 new_wall = arch_to_object (wall_arch);
355 new_wall->x = i; 398 new_wall->x = i;
356 new_wall->y = j; 399 new_wall->y = j;
400
357 if(the_wall && the_wall->map) { 401 if (the_wall && the_wall->map)
358 remove_ob(the_wall); 402 {
359 free_object(the_wall); 403 the_wall->remove ();
404 the_wall->destroy ();
360 } 405 }
406
361 the_wall->move_block = MOVE_ALL; 407 the_wall->move_block = MOVE_ALL;
362 insert_ob_in_map(new_wall,the_map,new_wall,INS_NO_MERGE | INS_NO_WALK_ON); 408 insert_ob_in_map (new_wall, the_map, new_wall, INS_NO_MERGE | INS_NO_WALK_ON);
363 } 409 }
364 else 410
365 nroferrors--; /* it's OK not to find an arch. */
366 return new_wall; 411 return new_wall;
367} 412}
368
369

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines