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.12 by root, Tue Dec 12 21:39:57 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:
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
88 if ((rune->type == SIGN) && (!strcmp (rune->arch->name, "rune_mark"))) 88 if (rune->type == SIGN && !strcmp (rune->arch->archname, "rune_mark"))
89 rune->destroy (); 89 rune->destroy (true);
90 90
91 rune = next; 91 rune = next;
92 } 92 }
93} 93}
94 94
106 int itest = 0; 106 int itest = 0;
107 oblinkpt *obp; 107 oblinkpt *obp;
108 108
109 while (itest++ < 1000) 109 while (itest++ < 1000)
110 { 110 {
111 connected = 1 + rand () % 20000; 111 connected = rndm (0x20000000UL) + 0x60000000UL;
112
112 for (obp = map->buttons; obp && (obp->value != connected); obp = obp->next); 113 for (obp = map->buttons; obp && (obp->value != connected); obp = obp->next)
114 ;
113 115
114 if (!obp) 116 if (!obp)
115 return connected; 117 return connected;
116 } 118 }
117 119
118 return -1; 120 return -1;
119} 121}
120
121 122
122/** 123/**
123 * Helper function for door/button/connected item building. 124 * Helper function for door/button/connected item building.
124 * 125 *
125 * Will search the specified spot for a marking rune. 126 * Will search the specified spot for a marking rune.
145 } 146 }
146 147
147 /* Now, find force in player's inventory */ 148 /* Now, find force in player's inventory */
148 force = pl->inv; 149 force = pl->inv;
149 while (force 150 while (force
150 && ((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
151 || (strcmp (force->msg, rune->msg)))) 152 || force->msg != rune->msg))
152 force = force->below; 153 force = force->below;
153 154
154 if (!force) 155 if (!force)
155 /* No force, need to create & insert one */ 156 /* No force, need to create & insert one */
156 { 157 {
161 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.");
162 return -1; 163 return -1;
163 } 164 }
164 165
165 force = get_archetype (FORCE_NAME); 166 force = get_archetype (FORCE_NAME);
166 force->speed = 0;
167 update_ob_speed (force);
168 force->slaying = pl->map->path; 167 force->slaying = pl->map->path;
169 force->msg = rune->msg; 168 force->msg = rune->msg;
170 force->path_attuned = connected; 169 force->path_attuned = connected;
170 force->set_speed (0);
171 insert_ob_in_ob (force, pl); 171 insert_ob_in_ob (force, pl);
172 172
173 return connected; 173 return connected;
174 } 174 }
175 175
181 * 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
182 */ 182 */
183object * 183object *
184get_connection_rune (object *pl, short x, short y) 184get_connection_rune (object *pl, short x, short y)
185{ 185{
186 object *rune;
187
188 rune = GET_MAP_OB (pl->map, x, y); 186 object *rune = GET_MAP_OB (pl->map, x, y);
187
189 while (rune && ((rune->type != SIGN) || (strcmp (rune->arch->name, "rune_mark")))) 188 while (rune && ((rune->type != SIGN) || (strcmp (rune->arch->archname, "rune_mark"))))
190 rune = rune->above; 189 rune = rune->above;
190
191 return rune; 191 return rune;
192} 192}
193 193
194/** 194/**
195 * 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
196 */ 196 */
197object * 197object *
198get_msg_book (object *pl, short x, short y) 198get_msg_book (object *pl, short x, short y)
199{ 199{
200 object *book;
201
202 book = GET_MAP_OB (pl->map, x, y); 200 object *book = GET_MAP_OB (pl->map, x, y);
201
203 while (book && (book->type != BOOK)) 202 while (book && (book->type != BOOK))
204 book = book->above; 203 book = book->above;
204
205 return book; 205 return book;
206} 206}
207 207
208/** 208/**
209 * Returns first item of type WALL. 209 * Returns first item of type BUILDABLE_WALL.
210 */ 210 */
211object * 211object *
212get_wall (maptile *map, int x, int y) 212get_wall (maptile *map, int x, int y)
213{ 213{
214 object *wall;
215
216 wall = GET_MAP_OB (map, x, y); 214 object *wall = GET_MAP_OB (map, x, y);
215
217 while (wall && (WALL != wall->type)) 216 while (wall && (BUILDABLE_WALL != wall->type))
218 wall = wall->above; 217 wall = wall->above;
219 218
220 return wall; 219 return wall;
221} 220}
222 221
232 * Note: x & y must be valid map coordinates. 231 * Note: x & y must be valid map coordinates.
233 */ 232 */
234void 233void
235fix_walls (maptile *map, int x, int y) 234fix_walls (maptile *map, int x, int y)
236{ 235{
237 int connect;
238 object *wall;
239 char archetype[MAX_BUF]; 236 char archetype[MAX_BUF];
240 char *underscore; 237 char *underscore;
241 uint32 old_flags[4];
242 struct archetype *new_arch; 238 struct archetype *new_arch;
243 int flag;
244
245 239
246 /* First, find the wall on that spot */ 240 /* First, find the wall on that spot */
247 wall = get_wall (map, x, y); 241 object *wall = get_wall (map, x, y);
248 if (!wall) 242 if (!wall)
249 /* Nothing -> bail out */ 243 /* Nothing -> bail out */
250 return; 244 return;
251 245
252 /* Find base name */ 246 /* Find base name */
253 strcpy (archetype, wall->arch->name); 247 assign (archetype, wall->arch->archname);
254 underscore = strchr (archetype, '_'); 248 underscore = strchr (archetype, '_');
255 249
256 /* search for the first _ before a number */ 250 /* search for the first _ before a number */
257 while (underscore && !isdigit (*(underscore + 1))) 251 while (underscore && !isdigit (*(underscore + 1)))
258 underscore = strchr (underscore + 1, '_'); 252 underscore = strchr (underscore + 1, '_');
262 return; 256 return;
263 257
264 underscore++; 258 underscore++;
265 *underscore = '\0'; 259 *underscore = '\0';
266 260
267 connect = 0; 261 int connect = 0;
268 262
269 if ((x > 0) && get_wall (map, x - 1, y)) 263 if ((x > 0) && get_wall (map, x - 1, y))
270 connect |= 1; 264 connect |= 1;
271 if ((x < MAP_WIDTH (map) - 1) && get_wall (map, x + 1, y)) 265 if ((x < map->width - 1) && get_wall (map, x + 1, y))
272 connect |= 2; 266 connect |= 2;
273 267
274 if ((y > 0) && get_wall (map, x, y - 1)) 268 if ((y > 0) && get_wall (map, x, y - 1))
275 connect |= 4; 269 connect |= 4;
276 270
277 if ((y < MAP_HEIGHT (map) - 1) && get_wall (map, x, y + 1)) 271 if ((y < map->height - 1) && get_wall (map, x, y + 1))
278 connect |= 8; 272 connect |= 8;
279 273
280 switch (connect) 274 switch (connect)
281 { 275 {
282 case 0: 276 case 0:
355 return; 349 return;
356 350
357 /* Now delete current wall, and insert new one 351 /* Now delete current wall, and insert new one
358 * 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
359 */ 353 */
360 for (flag = 0; flag < 4; flag++) 354 object::flags_t old_flags = wall->flag; // elmex: this is where C++ pays off
361 old_flags[flag] = wall->flags[flag];
362 355
363 wall->destroy (); 356 wall->destroy (true);
364 357
365 wall = arch_to_object (new_arch); 358 wall = arch_to_object (new_arch);
366 wall->type = WALL; 359 wall->type = BUILDABLE_WALL;
367 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);
368 for (flag = 0; flag < 4; flag++)
369 wall->flags[flag] = old_flags[flag]; 361 wall->flag = old_flags;
370} 362}
371 363
372/** 364/**
373 * \brief Floor building function 365 * \brief Floor building function
374 * 366 *
402 if (tmp) 394 if (tmp)
403 { 395 {
404 while (tmp) 396 while (tmp)
405 { 397 {
406 above = tmp->above; 398 above = tmp->above;
407 if (WALL == tmp->type) 399 if (BUILDABLE_WALL == tmp->type)
408 { 400 {
409 /* 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 */
410 new_wall = tmp->arch; 402 new_wall = tmp->arch;
411 tmp->destroy (); 403 tmp->destroy (true);
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 tmp->destroy (); 408 tmp->destroy (true);
417 floor_removed = 1; 409 floor_removed = 1;
418 } 410 }
419 else 411 else
420 { 412 {
421 if (floor_removed) 413 if (floor_removed)
463 /* 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... */
464 if (new_wall) 456 if (new_wall)
465 { 457 {
466 tmp = arch_to_object (new_wall); 458 tmp = arch_to_object (new_wall);
467 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 459 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
468 tmp->type = WALL; 460 tmp->type = BUILDABLE_WALL;
469 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);
470 } 462 }
471 } 463 }
472 } 464 }
473 465
481 if (!OUT_OF_REAL_MAP (pl->map, xt, yt)) 473 if (!OUT_OF_REAL_MAP (pl->map, xt, yt))
482 fix_walls (pl->map, xt, yt); 474 fix_walls (pl->map, xt, yt);
483 } 475 }
484 476
485 /* Now remove raw item from inventory */ 477 /* Now remove raw item from inventory */
486 decrease_ob (material); 478 material->decrease ();
487 479
488 /* And tell player about the fix */ 480 /* And tell player about the fix */
489 new_draw_info (NDI_UNIQUE, 0, pl, message); 481 new_draw_info (NDI_UNIQUE, 0, pl, message);
490} 482}
491 483
525 /* Grab existing wall, if any */ 517 /* Grab existing wall, if any */
526 current_wall = NULL; 518 current_wall = NULL;
527 tmp = GET_MAP_OB (pl->map, x, y); 519 tmp = GET_MAP_OB (pl->map, x, y);
528 while (tmp && !current_wall) 520 while (tmp && !current_wall)
529 { 521 {
530 if (WALL == tmp->type) 522 if (BUILDABLE_WALL == tmp->type)
531 current_wall = tmp; 523 current_wall = tmp;
532 524
533 tmp = tmp->above; 525 tmp = tmp->above;
534 } 526 }
535 527
543 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);
544 return; 536 return;
545 } 537 }
546 538
547 tmp = arch_to_object (new_wall); 539 tmp = arch_to_object (new_wall);
548 tmp->type = WALL; 540 tmp->type = BUILDABLE_WALL;
549 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 541 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
550 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);
551 543
552 /* If existing wall, remove it, no need to fix other walls */ 544 /* If existing wall, remove it, no need to fix other walls */
553 if (current_wall) 545 if (current_wall)
554 { 546 {
555 current_wall->destroy (); 547 current_wall->destroy (true);
556 fix_walls (pl->map, x, y); 548 fix_walls (pl->map, x, y);
557 sprintf (message, "You redecorate the wall to better suit your tastes."); 549 sprintf (message, "You redecorate the wall to better suit your tastes.");
558 } 550 }
559 else 551 else
560 { 552 {
568 fix_walls (pl->map, xt, yt); 560 fix_walls (pl->map, xt, yt);
569 } 561 }
570 } 562 }
571 563
572 /* Now remove item from inventory */ 564 /* Now remove item from inventory */
573 decrease_ob (material); 565 material->decrease ();
574 566
575 /* And tell player what happened */ 567 /* And tell player what happened */
576 new_draw_info (NDI_UNIQUE, 0, pl, message); 568 new_draw_info (NDI_UNIQUE, 0, pl, message);
577} 569}
578 570
615 if (!arch) 607 if (!arch)
616 return; 608 return;
617 609
618 tmp = arch_to_object (arch); 610 tmp = arch_to_object (arch);
619 611
620 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)))
621 /* Floor has something on top that interferes with building */ 613 /* Floor has something on top that interferes with building */
622 { 614 {
623 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.");
624 return; 616 return;
625 } 617 }
644 case PEDESTAL: 636 case PEDESTAL:
645 case CF_HANDLE: 637 case CF_HANDLE:
646 case MAGIC_EAR: 638 case MAGIC_EAR:
647 case SIGN: 639 case SIGN:
648 /* Signs don't need a connection, but but magic mouths do. */ 640 /* Signs don't need a connection, but but magic mouths do. */
649 if (tmp->type == SIGN && strcmp (tmp->arch->name, "magic_mouth")) 641 if (tmp->type == SIGN && strcmp (tmp->arch->archname, "magic_mouth"))
650 break; 642 break;
643
651 con_rune = get_connection_rune (pl, x, y); 644 con_rune = get_connection_rune (pl, x, y);
652 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);
653 if (connected == -1) 646 if (connected == -1)
654 { 647 {
655 /* Player already informed of failure by the previous function */ 648 /* Player already informed of failure by the previous function */
656 tmp->destroy (); 649 tmp->destroy (true);
657 return; 650 return;
658 } 651 }
652
659 /* Remove marking rune */ 653 /* Remove marking rune */
660 con_rune->destroy (); 654 con_rune->destroy (true);
661 } 655 }
662 656
663 /* 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 */
664 if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR)) 658 if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR))
665 { 659 {
666 if (adjust_sign_msg (pl, x, y, tmp) == -1) 660 if (adjust_sign_msg (pl, x, y, tmp) == -1)
667 { 661 {
668 tmp->destroy (); 662 tmp->destroy (true);
669 return; 663 return;
670 } 664 }
671 } 665 }
672 666
673 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);
674 if (connected != 0) 668 if (connected != 0)
675 add_button_link (tmp, pl->map, connected); 669 add_button_link (tmp, pl->map, connected);
676 670
677 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));
678 decrease_ob_nr (item, 1); 672 item->decrease ();
679} 673}
680 674
681/** 675/**
682 * Item remover. 676 * Item remover.
683 * 677 *
696 item = GET_MAP_OB (pl->map, x, y); 690 item = GET_MAP_OB (pl->map, x, y);
697 if (!item) 691 if (!item)
698 { 692 {
699 /* Should not happen with previous tests, but we never know */ 693 /* Should not happen with previous tests, but we never know */
700 new_draw_info (NDI_UNIQUE, 0, pl, "Invalid square."); 694 new_draw_info (NDI_UNIQUE, 0, pl, "Invalid square.");
701 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);
702 return; 696 return;
703 } 697 }
704 698
705 if (item->type == FLOOR || QUERY_FLAG (item, FLAG_IS_FLOOR)) 699 if (item->type == FLOOR || QUERY_FLAG (item, FLAG_IS_FLOOR))
706 item = item->above; 700 item = item->above;
707 701
708 if (!item) 702 if (!item)
709 {
710 new_draw_info (NDI_UNIQUE, 0, pl, "Nothing to remove."); 703 new_draw_info (NDI_UNIQUE, 0, pl, "Nothing to remove.");
711 return; 704 else if (item->type == BUILDABLE_WALL)
712 }
713
714 /* Now remove object, with special cases (buttons & such) */
715 switch (item->type)
716 {
717 case WALL:
718 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.");
719 return; 706 else if (!item->flag [FLAG_IS_BUILDABLE])
720 707 new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't remove the %s, it's not buildable!", query_name (item));
721 case DOOR: 708 else
722 case BUTTON: 709 {
723 case GATE:
724 case TIMED_GATE:
725 case DETECTOR:
726 case PEDESTAL:
727 case CF_HANDLE:
728 case MAGIC_EAR:
729 case SIGN:
730 /* Special case: must unconnect */
731 if (QUERY_FLAG (item, FLAG_IS_LINKED))
732 remove_button_link (item);
733
734 /* Fall through */
735
736 default:
737 /* Remove generic item */
738 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));
739 item->destroy (); 711 item->destroy (true);
740 } 712 }
741} 713}
742 714
743/** 715/**
744 * Global building function 716 * Global building function
770 } 742 }
771 743
772 x = pl->x + freearr_x[dir]; 744 x = pl->x + freearr_x[dir];
773 y = pl->y + freearr_y[dir]; 745 y = pl->y + freearr_y[dir];
774 746
775 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))
776 { 748 {
777 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...");
778 return; 750 return;
779 } 751 }
780 752
787 759
788 tmp = GET_MAP_OB (pl->map, x, y); 760 tmp = GET_MAP_OB (pl->map, x, y);
789 if (!tmp) 761 if (!tmp)
790 { 762 {
791 /* Nothing, meaning player is standing next to an undefined square... */ 763 /* Nothing, meaning player is standing next to an undefined square... */
792 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);
793 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.");
794 return; 766 return;
795 } 767 }
768
796 tmp2 = find_marked_object (pl); 769 tmp2 = find_marked_object (pl);
797 while (tmp) 770 while (tmp)
798 { 771 {
799 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"))))
800 { 773 {
801 /* The item building function already has it's own special 774 /* The item building function already has it's own special
802 * checks for this 775 * checks for this
803 */ 776 */
804 if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM)) 777 if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM))
809 } 782 }
810 tmp = tmp->above; 783 tmp = tmp->above;
811 } 784 }
812 785
813 /* Now we know the square is ok */ 786 /* Now we know the square is ok */
814 builder = pl->contr->ranges[range_builder]; 787 builder = pl->contr->ranged_ob;
815 788
816 if (builder->subtype == ST_BD_REMOVE) 789 if (builder->subtype == ST_BD_REMOVE)
817 /* Remover -> call specific function and bail out */ 790 /* Remover -> call specific function and bail out */
818 { 791 {
819 apply_builder_remove (pl, dir); 792 apply_builder_remove (pl, dir);
887 tmp->msg = book->msg; 860 tmp->msg = book->msg;
888 861
889 if (tmp->invisible) 862 if (tmp->invisible)
890 { 863 {
891 if (book->custom_name != NULL) 864 if (book->custom_name != NULL)
892 {
893 snprintf (buf, sizeof (buf), "talking %s", &book->custom_name); 865 snprintf (buf, sizeof (buf), "talking %s", &book->custom_name);
894 }
895 else 866 else
896 {
897 snprintf (buf, sizeof (buf), "talking %s", &book->name); 867 snprintf (buf, sizeof (buf), "talking %s", &book->name);
898 } 868
899 tmp->name = buf; 869 tmp->name = buf;
900 870
901 if (book->name_pl != NULL) 871 if (book->name_pl != NULL)
902 { 872 {
903 snprintf (buf2, sizeof (buf2), "talking %s", &book->name_pl); 873 snprintf (buf2, sizeof (buf2), "talking %s", &book->name_pl);
906 876
907 tmp->face = book->face; 877 tmp->face = book->face;
908 tmp->invisible = 0; 878 tmp->invisible = 0;
909 } 879 }
910 880
911 book->destroy (); 881 book->destroy (true);
912 return 0; 882 return 0;
913} 883}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines