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

Comparing deliantra/server/server/build_map.C (file contents):
Revision 1.9 by elmex, Mon Dec 4 15:15:34 2006 UTC vs.
Revision 1.34 by root, Mon Sep 29 10:20:49 2008 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
4 Copyright (C) 2001 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
6 7 *
7 This program is free software; you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version. 11 * (at your option) any later version.
11 12 *
12 This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 16 * GNU General Public License for more details.
16 17 *
17 You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 *
20 21 * The authors can be reached via e-mail to <support@deliantra.net>
21 The authors can be reached via e-mail to <crossfire@schmorp.de>
22*/ 22 */
23 23
24#include <global.h> 24#include <global.h>
25#include <living.h> 25#include <living.h>
26#include <spells.h> 26#include <spells.h>
27#include <skills.h> 27#include <skills.h>
38 38
39 ob = GET_MAP_OB (map, x, y); 39 ob = GET_MAP_OB (map, x, y);
40 while (ob) 40 while (ob)
41 { 41 {
42 /* if ob is not a marking rune or floor, then check special cases */ 42 /* if ob is not a marking rune or floor, then check special cases */
43 if (strcmp (ob->arch->name, "rune_mark") && ob->type != FLOOR) 43 if (strcmp (ob->arch->archname, "rune_mark") && ob->type != FLOOR)
44 { 44 {
45 switch (tmp->type) 45 switch (tmp->type)
46 { 46 {
47 case SIGN: 47 case SIGN:
48 case MAGIC_EAR: 48 case MAGIC_EAR:
82 82
83 rune = GET_MAP_OB (map, x, y); 83 rune = GET_MAP_OB (map, x, y);
84 while (rune) 84 while (rune)
85 { 85 {
86 next = rune->above; 86 next = rune->above;
87
87 if ((rune->type == SIGN) && (!strcmp (rune->arch->name, "rune_mark"))) 88 if (rune->type == SIGN && !strcmp (rune->arch->archname, "rune_mark"))
88 { 89 rune->destroy (true);
89 remove_ob (rune); 90
90 free_object (rune);
91 }
92 rune = next; 91 rune = next;
93 } 92 }
94} 93}
95 94
96/** 95/**
107 int itest = 0; 106 int itest = 0;
108 oblinkpt *obp; 107 oblinkpt *obp;
109 108
110 while (itest++ < 1000) 109 while (itest++ < 1000)
111 { 110 {
112 connected = 1 + rand () % 20000; 111 connected = rndm (0x20000000UL) + 0x60000000UL;
112
113 for (obp = map->buttons; obp && (obp->value != connected); obp = obp->next); 113 for (obp = map->buttons; obp && (obp->value != connected); obp = obp->next)
114 ;
114 115
115 if (!obp) 116 if (!obp)
116 return connected; 117 return connected;
117 } 118 }
118 119
119 return -1; 120 return -1;
120} 121}
121
122 122
123/** 123/**
124 * Helper function for door/button/connected item building. 124 * Helper function for door/button/connected item building.
125 * 125 *
126 * Will search the specified spot for a marking rune. 126 * Will search the specified spot for a marking rune.
146 } 146 }
147 147
148 /* Now, find force in player's inventory */ 148 /* Now, find force in player's inventory */
149 force = pl->inv; 149 force = pl->inv;
150 while (force 150 while (force
151 && ((force->type != FORCE) || (!force->slaying) || (strcmp (force->slaying, pl->map->path)) || (!force->msg) 151 && ((force->type != FORCE) || !force->slaying || force->slaying != pl->map->path || !force->msg
152 || (strcmp (force->msg, rune->msg)))) 152 || force->msg != rune->msg))
153 force = force->below; 153 force = force->below;
154 154
155 if (!force) 155 if (!force)
156 /* No force, need to create & insert one */ 156 /* No force, need to create & insert one */
157 { 157 {
162 new_draw_info (NDI_UNIQUE, 0, pl, "Could not create more groups."); 162 new_draw_info (NDI_UNIQUE, 0, pl, "Could not create more groups.");
163 return -1; 163 return -1;
164 } 164 }
165 165
166 force = get_archetype (FORCE_NAME); 166 force = get_archetype (FORCE_NAME);
167 force->speed = 0;
168 update_ob_speed (force);
169 force->slaying = pl->map->path; 167 force->slaying = pl->map->path;
170 force->msg = rune->msg; 168 force->msg = rune->msg;
171 force->path_attuned = connected; 169 force->path_attuned = connected;
170 force->set_speed (0);
172 insert_ob_in_ob (force, pl); 171 insert_ob_in_ob (force, pl);
173 172
174 return connected; 173 return connected;
175 } 174 }
176 175
182 * Returns the marking rune on the square, for purposes of building connections 181 * Returns the marking rune on the square, for purposes of building connections
183 */ 182 */
184object * 183object *
185get_connection_rune (object *pl, short x, short y) 184get_connection_rune (object *pl, short x, short y)
186{ 185{
187 object *rune;
188
189 rune = GET_MAP_OB (pl->map, x, y); 186 object *rune = GET_MAP_OB (pl->map, x, y);
187
190 while (rune && ((rune->type != SIGN) || (strcmp (rune->arch->name, "rune_mark")))) 188 while (rune && ((rune->type != SIGN) || (strcmp (rune->arch->archname, "rune_mark"))))
191 rune = rune->above; 189 rune = rune->above;
190
192 return rune; 191 return rune;
193} 192}
194 193
195/** 194/**
196 * Returns the book/scroll on the current square, for purposes of building 195 * Returns the book/scroll on the current square, for purposes of building
197 */ 196 */
198object * 197object *
199get_msg_book (object *pl, short x, short y) 198get_msg_book (object *pl, short x, short y)
200{ 199{
201 object *book;
202
203 book = GET_MAP_OB (pl->map, x, y); 200 object *book = GET_MAP_OB (pl->map, x, y);
201
204 while (book && (book->type != BOOK)) 202 while (book && (book->type != BOOK))
205 book = book->above; 203 book = book->above;
204
206 return book; 205 return book;
207} 206}
208 207
209/** 208/**
210 * Returns first item of type WALL. 209 * Returns first item of type BUILDABLE_WALL.
211 */ 210 */
212object * 211object *
213get_wall (maptile *map, int x, int y) 212get_wall (maptile *map, int x, int y)
214{ 213{
215 object *wall;
216
217 wall = GET_MAP_OB (map, x, y); 214 object *wall = GET_MAP_OB (map, x, y);
215
218 while (wall && (WALL != wall->type)) 216 while (wall && (BUILDABLE_WALL != wall->type))
219 {
220 wall = wall->above; 217 wall = wall->above;
221 }
222 218
223 return wall; 219 return wall;
224} 220}
225 221
226/** 222/**
235 * Note: x & y must be valid map coordinates. 231 * Note: x & y must be valid map coordinates.
236 */ 232 */
237void 233void
238fix_walls (maptile *map, int x, int y) 234fix_walls (maptile *map, int x, int y)
239{ 235{
240 int connect;
241 object *wall;
242 char archetype[MAX_BUF]; 236 char archetype[MAX_BUF];
243 char *underscore; 237 char *underscore;
244 uint32 old_flags[4];
245 struct archetype *new_arch; 238 struct archetype *new_arch;
246 int flag;
247
248 239
249 /* First, find the wall on that spot */ 240 /* First, find the wall on that spot */
250 wall = get_wall (map, x, y); 241 object *wall = get_wall (map, x, y);
251 if (!wall) 242 if (!wall)
252 /* Nothing -> bail out */ 243 /* Nothing -> bail out */
253 return; 244 return;
254 245
255 /* Find base name */ 246 /* Find base name */
256 strcpy (archetype, wall->arch->name); 247 assign (archetype, wall->arch->archname);
257 underscore = strchr (archetype, '_'); 248 underscore = strchr (archetype, '_');
258 249
250 /* search for the first _ before a number */
251 while (underscore && !isdigit (*(underscore + 1)))
252 underscore = strchr (underscore + 1, '_');
253
259 if (!underscore || (!isdigit (*(underscore + 1)))) 254 if (!underscore || !isdigit (*(underscore + 1)))
260 /* Not in a format we can change, bail out */ 255 /* Not in a format we can change, bail out */
261 return; 256 return;
262 257
263 underscore++; 258 underscore++;
264 *underscore = '\0'; 259 *underscore = '\0';
265 260
266 connect = 0; 261 int connect = 0;
267 262
268 if ((x > 0) && get_wall (map, x - 1, y)) 263 if ((x > 0) && get_wall (map, x - 1, y))
269 connect |= 1; 264 connect |= 1;
270 if ((x < MAP_WIDTH (map) - 1) && get_wall (map, x + 1, y)) 265 if ((x < map->width - 1) && get_wall (map, x + 1, y))
271 connect |= 2; 266 connect |= 2;
272 267
273 if ((y > 0) && get_wall (map, x, y - 1)) 268 if ((y > 0) && get_wall (map, x, y - 1))
274 connect |= 4; 269 connect |= 4;
275 270
276 if ((y < MAP_HEIGHT (map) - 1) && get_wall (map, x, y + 1)) 271 if ((y < map->height - 1) && get_wall (map, x, y + 1))
277 connect |= 8; 272 connect |= 8;
278 273
279 switch (connect) 274 switch (connect)
280 { 275 {
281 case 0: 276 case 0:
354 return; 349 return;
355 350
356 /* Now delete current wall, and insert new one 351 /* Now delete current wall, and insert new one
357 * We save flags to avoid any trouble with buildable/non buildable, and so on 352 * We save flags to avoid any trouble with buildable/non buildable, and so on
358 */ 353 */
359 for (flag = 0; flag < 4; flag++) 354 object::flags_t old_flags = wall->flag; // elmex: this is where C++ pays off
360 old_flags[flag] = wall->flags[flag]; 355
361 remove_ob (wall); 356 wall->destroy (true);
362 free_object (wall);
363 357
364 wall = arch_to_object (new_arch); 358 wall = arch_to_object (new_arch);
365 wall->type = WALL; 359 wall->type = BUILDABLE_WALL;
366 insert_ob_in_map_at (wall, map, NULL, INS_ABOVE_FLOOR_ONLY, x, y); 360 insert_ob_in_map_at (wall, map, NULL, INS_ABOVE_FLOOR_ONLY, x, y);
367 for (flag = 0; flag < 4; flag++)
368 wall->flags[flag] = old_flags[flag]; 361 wall->flag = old_flags;
369} 362}
370 363
371/** 364/**
372 * \brief Floor building function 365 * \brief Floor building function
373 * 366 *
401 if (tmp) 394 if (tmp)
402 { 395 {
403 while (tmp) 396 while (tmp)
404 { 397 {
405 above = tmp->above; 398 above = tmp->above;
406 if (WALL == tmp->type) 399 if (BUILDABLE_WALL == tmp->type)
407 { 400 {
408 /* There was a wall, remove it & keep its archetype to make new walls */ 401 /* There was a wall, remove it & keep its archetype to make new walls */
409 new_wall = tmp->arch; 402 new_wall = tmp->arch;
410 remove_ob (tmp); 403 tmp->destroy (true);
411 free_object (tmp);
412 sprintf (message, "You destroy the wall and redo the floor."); 404 sprintf (message, "You destroy the wall and redo the floor.");
413 } 405 }
414 else if ((FLOOR == tmp->type) || (QUERY_FLAG (tmp, FLAG_IS_FLOOR))) 406 else if ((FLOOR == tmp->type) || (QUERY_FLAG (tmp, FLAG_IS_FLOOR)))
415 { 407 {
416 remove_ob (tmp); 408 tmp->destroy (true);
417 free_object (tmp);
418 floor_removed = 1; 409 floor_removed = 1;
419 } 410 }
420 else 411 else
421 { 412 {
422 if (floor_removed) 413 if (floor_removed)
464 /* Insert wall if exists. Note: if it doesn't, the map is weird... */ 455 /* Insert wall if exists. Note: if it doesn't, the map is weird... */
465 if (new_wall) 456 if (new_wall)
466 { 457 {
467 tmp = arch_to_object (new_wall); 458 tmp = arch_to_object (new_wall);
468 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 459 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
469 tmp->type = WALL; 460 tmp->type = BUILDABLE_WALL;
470 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt); 461 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt);
471 } 462 }
472 } 463 }
473 } 464 }
474 465
482 if (!OUT_OF_REAL_MAP (pl->map, xt, yt)) 473 if (!OUT_OF_REAL_MAP (pl->map, xt, yt))
483 fix_walls (pl->map, xt, yt); 474 fix_walls (pl->map, xt, yt);
484 } 475 }
485 476
486 /* Now remove raw item from inventory */ 477 /* Now remove raw item from inventory */
487 decrease_ob (material); 478 material->decrease ();
488 479
489 /* And tell player about the fix */ 480 /* And tell player about the fix */
490 new_draw_info (NDI_UNIQUE, 0, pl, message); 481 new_draw_info (NDI_UNIQUE, 0, pl, message);
491} 482}
492 483
526 /* Grab existing wall, if any */ 517 /* Grab existing wall, if any */
527 current_wall = NULL; 518 current_wall = NULL;
528 tmp = GET_MAP_OB (pl->map, x, y); 519 tmp = GET_MAP_OB (pl->map, x, y);
529 while (tmp && !current_wall) 520 while (tmp && !current_wall)
530 { 521 {
531 if (WALL == tmp->type) 522 if (BUILDABLE_WALL == tmp->type)
532 current_wall = tmp; 523 current_wall = tmp;
533 524
534 tmp = tmp->above; 525 tmp = tmp->above;
535 } 526 }
536 527
544 LOG (llevError, "apply_builder_wall: unable to find archetype %s\n", &material->slaying); 535 LOG (llevError, "apply_builder_wall: unable to find archetype %s\n", &material->slaying);
545 return; 536 return;
546 } 537 }
547 538
548 tmp = arch_to_object (new_wall); 539 tmp = arch_to_object (new_wall);
549 tmp->type = WALL; 540 tmp->type = BUILDABLE_WALL;
550 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 541 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
551 insert_ob_in_map_at (tmp, pl->map, 0, INS_ABOVE_FLOOR_ONLY, x, y); 542 insert_ob_in_map_at (tmp, pl->map, 0, INS_ABOVE_FLOOR_ONLY, x, y);
552 543
553 /* If existing wall, remove it, no need to fix other walls */ 544 /* If existing wall, remove it, no need to fix other walls */
554 if (current_wall) 545 if (current_wall)
555 { 546 {
556 remove_ob (current_wall); 547 current_wall->destroy (true);
557 free_object (current_wall);
558 fix_walls (pl->map, x, y); 548 fix_walls (pl->map, x, y);
559 sprintf (message, "You redecorate the wall to better suit your tastes."); 549 sprintf (message, "You redecorate the wall to better suit your tastes.");
560 } 550 }
561 else 551 else
562 { 552 {
570 fix_walls (pl->map, xt, yt); 560 fix_walls (pl->map, xt, yt);
571 } 561 }
572 } 562 }
573 563
574 /* Now remove item from inventory */ 564 /* Now remove item from inventory */
575 decrease_ob (material); 565 material->decrease ();
576 566
577 /* And tell player what happened */ 567 /* And tell player what happened */
578 new_draw_info (NDI_UNIQUE, 0, pl, message); 568 new_draw_info (NDI_UNIQUE, 0, pl, message);
579} 569}
580 570
617 if (!arch) 607 if (!arch)
618 return; 608 return;
619 609
620 tmp = arch_to_object (arch); 610 tmp = arch_to_object (arch);
621 611
622 if ((floor->above) && (!can_build_over (pl->map, tmp, x, y))) 612 if (!floor->flag[FLAG_IS_BUILDABLE] || (floor->above) && (!can_build_over (pl->map, tmp, x, y)))
623 /* Floor has something on top that interferes with building */ 613 /* Floor has something on top that interferes with building */
624 { 614 {
625 new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here."); 615 new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here.");
626 return; 616 return;
627 } 617 }
646 case PEDESTAL: 636 case PEDESTAL:
647 case CF_HANDLE: 637 case CF_HANDLE:
648 case MAGIC_EAR: 638 case MAGIC_EAR:
649 case SIGN: 639 case SIGN:
650 /* Signs don't need a connection, but but magic mouths do. */ 640 /* Signs don't need a connection, but but magic mouths do. */
651 if (tmp->type == SIGN && strcmp (tmp->arch->name, "magic_mouth")) 641 if (tmp->type == SIGN && strcmp (tmp->arch->archname, "magic_mouth"))
652 break; 642 break;
643
653 con_rune = get_connection_rune (pl, x, y); 644 con_rune = get_connection_rune (pl, x, y);
654 connected = find_or_create_connection_for_map (pl, x, y, con_rune); 645 connected = find_or_create_connection_for_map (pl, x, y, con_rune);
655 if (connected == -1) 646 if (connected == -1)
656 { 647 {
657 /* Player already informed of failure by the previous function */ 648 /* Player already informed of failure by the previous function */
658 free_object (tmp); 649 tmp->destroy (true);
659 return; 650 return;
660 } 651 }
652
661 /* Remove marking rune */ 653 /* Remove marking rune */
662 remove_ob (con_rune); 654 con_rune->destroy (true);
663 free_object (con_rune);
664 } 655 }
665 656
666 /* For magic mouths/ears, and signs, take the msg from a book of scroll */ 657 /* For magic mouths/ears, and signs, take the msg from a book of scroll */
667 if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR)) 658 if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR))
668 { 659 {
669 if (adjust_sign_msg (pl, x, y, tmp) == -1) 660 if (adjust_sign_msg (pl, x, y, tmp) == -1)
670 { 661 {
671 free_object (tmp); 662 tmp->destroy (true);
672 return; 663 return;
673 } 664 }
674 } 665 }
675 666
676 insert_ob_in_map_at (tmp, pl->map, floor, insert_flag, x, y); 667 insert_ob_in_map_at (tmp, pl->map, floor, insert_flag, x, y);
677 if (connected != 0) 668 if (connected != 0)
678 add_button_link (tmp, pl->map, connected); 669 add_button_link (tmp, pl->map, connected);
679 670
680 new_draw_info_format (NDI_UNIQUE, 0, pl, "You build the %s", query_name (tmp)); 671 new_draw_info_format (NDI_UNIQUE, 0, pl, "You build the %s", query_name (tmp));
681 decrease_ob_nr (item, 1); 672 item->decrease ();
682} 673}
683 674
684/** 675/**
685 * Item remover. 676 * Item remover.
686 * 677 *
699 item = GET_MAP_OB (pl->map, x, y); 690 item = GET_MAP_OB (pl->map, x, y);
700 if (!item) 691 if (!item)
701 { 692 {
702 /* Should not happen with previous tests, but we never know */ 693 /* Should not happen with previous tests, but we never know */
703 new_draw_info (NDI_UNIQUE, 0, pl, "Invalid square."); 694 new_draw_info (NDI_UNIQUE, 0, pl, "Invalid square.");
704 LOG (llevError, "apply_builder_remove: (null) square at (%d, %d, %s)\n", x, y, pl->map->path); 695 LOG (llevError, "apply_builder_remove: (null) square at (%d, %d, %s)\n", x, y, &pl->map->path);
705 return; 696 return;
706 } 697 }
707 698
708 if (item->type == FLOOR || QUERY_FLAG (item, FLAG_IS_FLOOR)) 699 if (item->type == FLOOR || QUERY_FLAG (item, FLAG_IS_FLOOR))
709 item = item->above; 700 item = item->above;
710 701
711 if (!item) 702 if (!item)
712 {
713 new_draw_info (NDI_UNIQUE, 0, pl, "Nothing to remove."); 703 new_draw_info (NDI_UNIQUE, 0, pl, "Nothing to remove.");
714 return; 704 else if (item->type == BUILDABLE_WALL)
715 }
716
717 /* Now remove object, with special cases (buttons & such) */
718 switch (item->type)
719 {
720 case WALL:
721 new_draw_info (NDI_UNIQUE, 0, pl, "Can't remove a wall with that, build a floor."); 705 new_draw_info (NDI_UNIQUE, 0, pl, "Can't remove a wall with that, build a floor.");
722 return; 706 else if (!item->flag [FLAG_IS_BUILDABLE])
723 707 new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't remove the %s, it's not buildable!", query_name (item));
724 case DOOR: 708 else
725 case BUTTON: 709 {
726 case GATE:
727 case TIMED_GATE:
728 case DETECTOR:
729 case PEDESTAL:
730 case CF_HANDLE:
731 case MAGIC_EAR:
732 case SIGN:
733 /* Special case: must unconnect */
734 if (QUERY_FLAG (item, FLAG_IS_LINKED))
735 remove_button_link (item);
736
737 /* Fall through */
738
739 default:
740 /* Remove generic item */
741 new_draw_info_format (NDI_UNIQUE, 0, pl, "You remove the %s", query_name (item)); 710 new_draw_info_format (NDI_UNIQUE, 0, pl, "You remove the %s", query_name (item));
742 remove_ob (item); 711 item->destroy (true);
743 free_object (item);
744 } 712 }
745} 713}
746 714
747/** 715/**
748 * Global building function 716 * Global building function
774 } 742 }
775 743
776 x = pl->x + freearr_x[dir]; 744 x = pl->x + freearr_x[dir];
777 y = pl->y + freearr_y[dir]; 745 y = pl->y + freearr_y[dir];
778 746
779 if ((1 > x) || (1 > y) || ((MAP_WIDTH (pl->map) - 2) < x) || ((MAP_HEIGHT (pl->map) - 2) < y)) 747 if ((1 > x) || (1 > y) || ((pl->map->width - 2) < x) || ((pl->map->height - 2) < y))
780 { 748 {
781 new_draw_info (NDI_UNIQUE, 0, pl, "Can't build on map edge..."); 749 new_draw_info (NDI_UNIQUE, 0, pl, "Can't build on map edge...");
782 return; 750 return;
783 } 751 }
784 752
791 759
792 tmp = GET_MAP_OB (pl->map, x, y); 760 tmp = GET_MAP_OB (pl->map, x, y);
793 if (!tmp) 761 if (!tmp)
794 { 762 {
795 /* Nothing, meaning player is standing next to an undefined square... */ 763 /* Nothing, meaning player is standing next to an undefined square... */
796 LOG (llevError, "apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, pl->map->path); 764 LOG (llevError, "apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, &pl->map->path);
797 new_draw_info (NDI_UNIQUE, 0, pl, "You'd better not build here, it looks weird."); 765 new_draw_info (NDI_UNIQUE, 0, pl, "You'd better not build here, it looks weird.");
798 return; 766 return;
799 } 767 }
768
800 tmp2 = find_marked_object (pl); 769 tmp2 = find_marked_object (pl);
801 while (tmp) 770 while (tmp)
802 { 771 {
803 if (!QUERY_FLAG (tmp, FLAG_IS_BUILDABLE) && ((tmp->type != SIGN) || (strcmp (tmp->arch->name, "rune_mark")))) 772 if (!QUERY_FLAG (tmp, FLAG_IS_BUILDABLE) && ((tmp->type != SIGN) || (strcmp (tmp->arch->archname, "rune_mark"))))
804 { 773 {
805 /* The item building function already has it's own special 774 /* The item building function already has it's own special
806 * checks for this 775 * checks for this
807 */ 776 */
808 if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM)) 777 if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM))
813 } 782 }
814 tmp = tmp->above; 783 tmp = tmp->above;
815 } 784 }
816 785
817 /* Now we know the square is ok */ 786 /* Now we know the square is ok */
818 builder = pl->contr->ranges[range_builder]; 787 builder = pl->contr->ranged_ob;
819 788
820 if (builder->subtype == ST_BD_REMOVE) 789 if (builder->subtype == ST_BD_REMOVE)
821 /* Remover -> call specific function and bail out */ 790 /* Remover -> call specific function and bail out */
822 { 791 {
823 apply_builder_remove (pl, dir); 792 apply_builder_remove (pl, dir);
891 tmp->msg = book->msg; 860 tmp->msg = book->msg;
892 861
893 if (tmp->invisible) 862 if (tmp->invisible)
894 { 863 {
895 if (book->custom_name != NULL) 864 if (book->custom_name != NULL)
896 {
897 snprintf (buf, sizeof (buf), "talking %s", &book->custom_name); 865 snprintf (buf, sizeof (buf), "talking %s", &book->custom_name);
898 }
899 else 866 else
900 {
901 snprintf (buf, sizeof (buf), "talking %s", &book->name); 867 snprintf (buf, sizeof (buf), "talking %s", &book->name);
902 } 868
903 tmp->name = buf; 869 tmp->name = buf;
904 870
905 if (book->name_pl != NULL) 871 if (book->name_pl != NULL)
906 { 872 {
907 snprintf (buf2, sizeof (buf2), "talking %s", &book->name_pl); 873 snprintf (buf2, sizeof (buf2), "talking %s", &book->name_pl);
909 } 875 }
910 876
911 tmp->face = book->face; 877 tmp->face = book->face;
912 tmp->invisible = 0; 878 tmp->invisible = 0;
913 } 879 }
914 remove_ob (book); 880
915 free_object (book); 881 book->destroy (true);
916 return 0; 882 return 0;
917} 883}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines