… | |
… | |
232 | * Note: x & y must be valid map coordinates. |
232 | * Note: x & y must be valid map coordinates. |
233 | */ |
233 | */ |
234 | void |
234 | void |
235 | fix_walls (maptile *map, int x, int y) |
235 | fix_walls (maptile *map, int x, int y) |
236 | { |
236 | { |
237 | int connect; |
|
|
238 | object *wall; |
237 | object *wall; |
239 | char archetype[MAX_BUF]; |
238 | char archetype[MAX_BUF]; |
240 | char *underscore; |
239 | char *underscore; |
241 | uint32 old_flags[4]; |
|
|
242 | struct archetype *new_arch; |
240 | struct archetype *new_arch; |
243 | int flag; |
|
|
244 | |
241 | |
245 | |
242 | |
246 | /* First, find the wall on that spot */ |
243 | /* First, find the wall on that spot */ |
247 | wall = get_wall (map, x, y); |
244 | wall = get_wall (map, x, y); |
248 | if (!wall) |
245 | if (!wall) |
… | |
… | |
262 | return; |
259 | return; |
263 | |
260 | |
264 | underscore++; |
261 | underscore++; |
265 | *underscore = '\0'; |
262 | *underscore = '\0'; |
266 | |
263 | |
267 | connect = 0; |
264 | int connect = 0; |
268 | |
265 | |
269 | if ((x > 0) && get_wall (map, x - 1, y)) |
266 | if ((x > 0) && get_wall (map, x - 1, y)) |
270 | connect |= 1; |
267 | connect |= 1; |
271 | if ((x < MAP_WIDTH (map) - 1) && get_wall (map, x + 1, y)) |
268 | if ((x < MAP_WIDTH (map) - 1) && get_wall (map, x + 1, y)) |
272 | connect |= 2; |
269 | connect |= 2; |
… | |
… | |
355 | return; |
352 | return; |
356 | |
353 | |
357 | /* Now delete current wall, and insert new one |
354 | /* Now delete current wall, and insert new one |
358 | * We save flags to avoid any trouble with buildable/non buildable, and so on |
355 | * We save flags to avoid any trouble with buildable/non buildable, and so on |
359 | */ |
356 | */ |
360 | for (flag = 0; flag < 4; flag++) |
357 | object::flags_t old_flags = wall->flags; // elmex: this is where C++ pays off |
361 | old_flags[flag] = wall->flags[flag]; |
|
|
362 | |
358 | |
363 | wall->destroy (); |
359 | wall->destroy (); |
364 | |
360 | |
365 | wall = arch_to_object (new_arch); |
361 | wall = arch_to_object (new_arch); |
366 | wall->type = BUILDABLE_WALL; |
362 | wall->type = BUILDABLE_WALL; |
367 | insert_ob_in_map_at (wall, map, NULL, INS_ABOVE_FLOOR_ONLY, x, y); |
363 | insert_ob_in_map_at (wall, map, NULL, INS_ABOVE_FLOOR_ONLY, x, y); |
368 | for (flag = 0; flag < 4; flag++) |
|
|
369 | wall->flags[flag] = old_flags[flag]; |
364 | wall->flags = old_flags; |
370 | } |
365 | } |
371 | |
366 | |
372 | /** |
367 | /** |
373 | * \brief Floor building function |
368 | * \brief Floor building function |
374 | * |
369 | * |
… | |
… | |
800 | return; |
795 | return; |
801 | } |
796 | } |
802 | tmp2 = find_marked_object (pl); |
797 | tmp2 = find_marked_object (pl); |
803 | while (tmp) |
798 | while (tmp) |
804 | { |
799 | { |
|
|
800 | LOG (llevDebug, "CHECK %s %d\n", &tmp->name, &tmp->arch->name, 1 * (QUERY_FLAG (tmp, FLAG_IS_BUILDABLE))); |
805 | if (!QUERY_FLAG (tmp, FLAG_IS_BUILDABLE) && ((tmp->type != SIGN) || (strcmp (tmp->arch->name, "rune_mark")))) |
801 | if (!QUERY_FLAG (tmp, FLAG_IS_BUILDABLE) && ((tmp->type != SIGN) || (strcmp (tmp->arch->name, "rune_mark")))) |
806 | { |
802 | { |
807 | /* The item building function already has it's own special |
803 | /* The item building function already has it's own special |
808 | * checks for this |
804 | * checks for this |
809 | */ |
805 | */ |