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.11 by root, Tue Dec 12 20:53:03 2006 UTC vs.
Revision 1.36 by root, Thu Jan 1 11:41:17 2009 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 (ob->arch->archname != shstr_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 && rune->arch->archname == shstr_rune_mark)
88 {
89 rune->remove ();
90 rune->destroy (0); 89 rune->destroy ();
91 } 90
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 || rune->arch->archname != shstr_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 wall = wall->above; 217 wall = wall->above;
220 218
221 return wall; 219 return wall;
222} 220}
223 221
233 * Note: x & y must be valid map coordinates. 231 * Note: x & y must be valid map coordinates.
234 */ 232 */
235void 233void
236fix_walls (maptile *map, int x, int y) 234fix_walls (maptile *map, int x, int y)
237{ 235{
238 int connect;
239 object *wall;
240 char archetype[MAX_BUF]; 236 char archetype[MAX_BUF];
241 char *underscore; 237 char *underscore;
242 uint32 old_flags[4];
243 struct archetype *new_arch; 238 struct archetype *new_arch;
244 int flag;
245
246 239
247 /* First, find the wall on that spot */ 240 /* First, find the wall on that spot */
248 wall = get_wall (map, x, y); 241 object *wall = get_wall (map, x, y);
249 if (!wall) 242 if (!wall)
250 /* Nothing -> bail out */ 243 /* Nothing -> bail out */
251 return; 244 return;
252 245
253 /* Find base name */ 246 /* Find base name */
254 strcpy (archetype, wall->arch->name); 247 assign (archetype, wall->arch->archname);
255 underscore = strchr (archetype, '_'); 248 underscore = strchr (archetype, '_');
256 249
257 /* search for the first _ before a number */ 250 /* search for the first _ before a number */
258 while (underscore && !isdigit (*(underscore + 1))) 251 while (underscore && !isdigit (*(underscore + 1)))
259 underscore = strchr (underscore + 1, '_'); 252 underscore = strchr (underscore + 1, '_');
263 return; 256 return;
264 257
265 underscore++; 258 underscore++;
266 *underscore = '\0'; 259 *underscore = '\0';
267 260
268 connect = 0; 261 int connect = 0;
269 262
270 if ((x > 0) && get_wall (map, x - 1, y)) 263 if ((x > 0) && get_wall (map, x - 1, y))
271 connect |= 1; 264 connect |= 1;
272 if ((x < MAP_WIDTH (map) - 1) && get_wall (map, x + 1, y)) 265 if ((x < map->width - 1) && get_wall (map, x + 1, y))
273 connect |= 2; 266 connect |= 2;
274 267
275 if ((y > 0) && get_wall (map, x, y - 1)) 268 if ((y > 0) && get_wall (map, x, y - 1))
276 connect |= 4; 269 connect |= 4;
277 270
278 if ((y < MAP_HEIGHT (map) - 1) && get_wall (map, x, y + 1)) 271 if ((y < map->height - 1) && get_wall (map, x, y + 1))
279 connect |= 8; 272 connect |= 8;
280 273
281 switch (connect) 274 switch (connect)
282 { 275 {
283 case 0: 276 case 0:
356 return; 349 return;
357 350
358 /* Now delete current wall, and insert new one 351 /* Now delete current wall, and insert new one
359 * 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
360 */ 353 */
361 for (flag = 0; flag < 4; flag++) 354 object::flags_t old_flags = wall->flag; // elmex: this is where C++ pays off
362 old_flags[flag] = wall->flags[flag]; 355
363 wall->remove ();
364 wall->destroy (0); 356 wall->destroy ();
365 357
366 wall = arch_to_object (new_arch); 358 wall = arch_to_object (new_arch);
367 wall->type = WALL; 359 wall->type = BUILDABLE_WALL;
368 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);
369 for (flag = 0; flag < 4; flag++)
370 wall->flags[flag] = old_flags[flag]; 361 wall->flag = old_flags;
371} 362}
372 363
373/** 364/**
374 * \brief Floor building function 365 * \brief Floor building function
375 * 366 *
403 if (tmp) 394 if (tmp)
404 { 395 {
405 while (tmp) 396 while (tmp)
406 { 397 {
407 above = tmp->above; 398 above = tmp->above;
408 if (WALL == tmp->type) 399 if (BUILDABLE_WALL == tmp->type)
409 { 400 {
410 /* 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 */
411 new_wall = tmp->arch; 402 new_wall = tmp->arch;
412 tmp->remove ();
413 tmp->destroy (0); 403 tmp->destroy ();
414 sprintf (message, "You destroy the wall and redo the floor."); 404 sprintf (message, "You destroy the wall and redo the floor.");
415 } 405 }
416 else if ((FLOOR == tmp->type) || (QUERY_FLAG (tmp, FLAG_IS_FLOOR))) 406 else if ((FLOOR == tmp->type) || (QUERY_FLAG (tmp, FLAG_IS_FLOOR)))
417 { 407 {
418 tmp->remove ();
419 tmp->destroy (0); 408 tmp->destroy ();
420 floor_removed = 1; 409 floor_removed = 1;
421 } 410 }
422 else 411 else
423 { 412 {
424 if (floor_removed) 413 if (floor_removed)
466 /* 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... */
467 if (new_wall) 456 if (new_wall)
468 { 457 {
469 tmp = arch_to_object (new_wall); 458 tmp = arch_to_object (new_wall);
470 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 459 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
471 tmp->type = WALL; 460 tmp->type = BUILDABLE_WALL;
472 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);
473 } 462 }
474 } 463 }
475 } 464 }
476 465
484 if (!OUT_OF_REAL_MAP (pl->map, xt, yt)) 473 if (!OUT_OF_REAL_MAP (pl->map, xt, yt))
485 fix_walls (pl->map, xt, yt); 474 fix_walls (pl->map, xt, yt);
486 } 475 }
487 476
488 /* Now remove raw item from inventory */ 477 /* Now remove raw item from inventory */
489 decrease_ob (material); 478 material->decrease ();
490 479
491 /* And tell player about the fix */ 480 /* And tell player about the fix */
492 new_draw_info (NDI_UNIQUE, 0, pl, message); 481 new_draw_info (NDI_UNIQUE, 0, pl, message);
493} 482}
494 483
528 /* Grab existing wall, if any */ 517 /* Grab existing wall, if any */
529 current_wall = NULL; 518 current_wall = NULL;
530 tmp = GET_MAP_OB (pl->map, x, y); 519 tmp = GET_MAP_OB (pl->map, x, y);
531 while (tmp && !current_wall) 520 while (tmp && !current_wall)
532 { 521 {
533 if (WALL == tmp->type) 522 if (BUILDABLE_WALL == tmp->type)
534 current_wall = tmp; 523 current_wall = tmp;
535 524
536 tmp = tmp->above; 525 tmp = tmp->above;
537 } 526 }
538 527
546 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);
547 return; 536 return;
548 } 537 }
549 538
550 tmp = arch_to_object (new_wall); 539 tmp = arch_to_object (new_wall);
551 tmp->type = WALL; 540 tmp->type = BUILDABLE_WALL;
552 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 541 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
553 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);
554 543
555 /* If existing wall, remove it, no need to fix other walls */ 544 /* If existing wall, remove it, no need to fix other walls */
556 if (current_wall) 545 if (current_wall)
557 { 546 {
558 current_wall->remove ();
559 current_wall->destroy (0); 547 current_wall->destroy ();
560 fix_walls (pl->map, x, y); 548 fix_walls (pl->map, x, y);
561 sprintf (message, "You redecorate the wall to better suit your tastes."); 549 sprintf (message, "You redecorate the wall to better suit your tastes.");
562 } 550 }
563 else 551 else
564 { 552 {
572 fix_walls (pl->map, xt, yt); 560 fix_walls (pl->map, xt, yt);
573 } 561 }
574 } 562 }
575 563
576 /* Now remove item from inventory */ 564 /* Now remove item from inventory */
577 decrease_ob (material); 565 material->decrease ();
578 566
579 /* And tell player what happened */ 567 /* And tell player what happened */
580 new_draw_info (NDI_UNIQUE, 0, pl, message); 568 new_draw_info (NDI_UNIQUE, 0, pl, message);
581} 569}
582 570
619 if (!arch) 607 if (!arch)
620 return; 608 return;
621 609
622 tmp = arch_to_object (arch); 610 tmp = arch_to_object (arch);
623 611
624 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)))
625 /* Floor has something on top that interferes with building */ 613 /* Floor has something on top that interferes with building */
626 { 614 {
627 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.");
628 return; 616 return;
629 } 617 }
638 insert_flag = INS_ABOVE_FLOOR_ONLY; 626 insert_flag = INS_ABOVE_FLOOR_ONLY;
639 627
640 connected = 0; 628 connected = 0;
641 switch (tmp->type) 629 switch (tmp->type)
642 { 630 {
643 case DOOR: 631 case DOOR:
644 case GATE: 632 case GATE:
645 case BUTTON: 633 case BUTTON:
646 case DETECTOR: 634 case DETECTOR:
647 case TIMED_GATE: 635 case TIMED_GATE:
648 case PEDESTAL: 636 case PEDESTAL:
649 case CF_HANDLE: 637 case CF_HANDLE:
650 case MAGIC_EAR: 638 case MAGIC_EAR:
651 case SIGN: 639 case SIGN:
652 /* Signs don't need a connection, but but magic mouths do. */ 640 /* Signs don't need a connection, but but magic mouths do. */
653 if (tmp->type == SIGN && strcmp (tmp->arch->name, "magic_mouth")) 641 if (tmp->type == SIGN && tmp->arch->archname != shstr_magic_mouth)
654 break; 642 break;
643
655 con_rune = get_connection_rune (pl, x, y); 644 con_rune = get_connection_rune (pl, x, y);
656 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);
657 if (connected == -1) 646 if (connected == -1)
658 { 647 {
659 /* Player already informed of failure by the previous function */ 648 /* Player already informed of failure by the previous function */
660 tmp->destroy (0); 649 tmp->destroy ();
661 return; 650 return;
662 } 651 }
652
663 /* Remove marking rune */ 653 /* Remove marking rune */
664 con_rune->remove ();
665 con_rune->destroy (0); 654 con_rune->destroy ();
666 } 655 }
667 656
668 /* 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 */
669 if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR)) 658 if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR))
670 { 659 {
671 if (adjust_sign_msg (pl, x, y, tmp) == -1) 660 if (adjust_sign_msg (pl, x, y, tmp) == -1)
672 { 661 {
673 tmp->destroy (0); 662 tmp->destroy ();
674 return; 663 return;
675 } 664 }
676 } 665 }
677 666
678 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);
679 if (connected != 0) 668 if (connected != 0)
680 add_button_link (tmp, pl->map, connected); 669 add_button_link (tmp, pl->map, connected);
681 670
682 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));
683 decrease_ob_nr (item, 1); 672 item->decrease ();
684} 673}
685 674
686/** 675/**
687 * Item remover. 676 * Item remover.
688 * 677 *
701 item = GET_MAP_OB (pl->map, x, y); 690 item = GET_MAP_OB (pl->map, x, y);
702 if (!item) 691 if (!item)
703 { 692 {
704 /* Should not happen with previous tests, but we never know */ 693 /* Should not happen with previous tests, but we never know */
705 new_draw_info (NDI_UNIQUE, 0, pl, "Invalid square."); 694 new_draw_info (NDI_UNIQUE, 0, pl, "Invalid square.");
706 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);
707 return; 696 return;
708 } 697 }
709 698
710 if (item->type == FLOOR || QUERY_FLAG (item, FLAG_IS_FLOOR)) 699 if (item->type == FLOOR || QUERY_FLAG (item, FLAG_IS_FLOOR))
711 item = item->above; 700 item = item->above;
712 701
713 if (!item) 702 if (!item)
714 {
715 new_draw_info (NDI_UNIQUE, 0, pl, "Nothing to remove."); 703 new_draw_info (NDI_UNIQUE, 0, pl, "Nothing to remove.");
716 return; 704 else if (item->type == BUILDABLE_WALL)
717 }
718
719 /* Now remove object, with special cases (buttons & such) */
720 switch (item->type)
721 {
722 case WALL:
723 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.");
724 return; 706 else if (!item->flag [FLAG_IS_BUILDABLE])
725 707 new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't remove the %s, it's not buildable!", query_name (item));
726 case DOOR: 708 else
727 case BUTTON: 709 {
728 case GATE:
729 case TIMED_GATE:
730 case DETECTOR:
731 case PEDESTAL:
732 case CF_HANDLE:
733 case MAGIC_EAR:
734 case SIGN:
735 /* Special case: must unconnect */
736 if (QUERY_FLAG (item, FLAG_IS_LINKED))
737 remove_button_link (item);
738
739 /* Fall through */
740
741 default:
742 /* Remove generic item */
743 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));
744 item->remove ();
745 item->destroy (0); 711 item->destroy ();
746 } 712 }
747} 713}
748 714
749/** 715/**
750 * Global building function 716 * Global building function
776 } 742 }
777 743
778 x = pl->x + freearr_x[dir]; 744 x = pl->x + freearr_x[dir];
779 y = pl->y + freearr_y[dir]; 745 y = pl->y + freearr_y[dir];
780 746
781 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))
782 { 748 {
783 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...");
784 return; 750 return;
785 } 751 }
786 752
793 759
794 tmp = GET_MAP_OB (pl->map, x, y); 760 tmp = GET_MAP_OB (pl->map, x, y);
795 if (!tmp) 761 if (!tmp)
796 { 762 {
797 /* Nothing, meaning player is standing next to an undefined square... */ 763 /* Nothing, meaning player is standing next to an undefined square... */
798 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);
799 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.");
800 return; 766 return;
801 } 767 }
768
802 tmp2 = find_marked_object (pl); 769 tmp2 = find_marked_object (pl);
803 while (tmp) 770 while (tmp)
804 { 771 {
805 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 || tmp->arch->archname != shstr_rune_mark))
806 { 773 {
807 /* The item building function already has it's own special 774 /* The item building function already has it's own special
808 * checks for this 775 * checks for this
809 */ 776 */
810 if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM)) 777 if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM))
815 } 782 }
816 tmp = tmp->above; 783 tmp = tmp->above;
817 } 784 }
818 785
819 /* Now we know the square is ok */ 786 /* Now we know the square is ok */
820 builder = pl->contr->ranges[range_builder]; 787 builder = pl->contr->ranged_ob;
821 788
822 if (builder->subtype == ST_BD_REMOVE) 789 if (builder->subtype == ST_BD_REMOVE)
823 /* Remover -> call specific function and bail out */ 790 /* Remover -> call specific function and bail out */
824 { 791 {
825 apply_builder_remove (pl, dir); 792 apply_builder_remove (pl, dir);
893 tmp->msg = book->msg; 860 tmp->msg = book->msg;
894 861
895 if (tmp->invisible) 862 if (tmp->invisible)
896 { 863 {
897 if (book->custom_name != NULL) 864 if (book->custom_name != NULL)
898 {
899 snprintf (buf, sizeof (buf), "talking %s", &book->custom_name); 865 snprintf (buf, sizeof (buf), "talking %s", &book->custom_name);
900 }
901 else 866 else
902 {
903 snprintf (buf, sizeof (buf), "talking %s", &book->name); 867 snprintf (buf, sizeof (buf), "talking %s", &book->name);
904 } 868
905 tmp->name = buf; 869 tmp->name = buf;
906 870
907 if (book->name_pl != NULL) 871 if (book->name_pl != NULL)
908 { 872 {
909 snprintf (buf2, sizeof (buf2), "talking %s", &book->name_pl); 873 snprintf (buf2, sizeof (buf2), "talking %s", &book->name_pl);
911 } 875 }
912 876
913 tmp->face = book->face; 877 tmp->face = book->face;
914 tmp->invisible = 0; 878 tmp->invisible = 0;
915 } 879 }
916 book->remove (); 880
917 book->destroy (0); 881 book->destroy ();
918 return 0; 882 return 0;
919} 883}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines