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.13 by elmex, Wed Dec 20 12:13:47 2006 UTC

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->name, "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/**
205 book = book->above; 204 book = book->above;
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; 214 object *wall;
216 215
217 wall = GET_MAP_OB (map, x, y); 216 wall = GET_MAP_OB (map, x, y);
218 while (wall && (WALL != wall->type)) 217 while (wall && (BUILDABLE_WALL != wall->type))
219 wall = wall->above; 218 wall = wall->above;
220 219
221 return wall; 220 return wall;
222} 221}
223 222
358 /* Now delete current wall, and insert new one 357 /* Now delete current wall, and insert new one
359 * We save flags to avoid any trouble with buildable/non buildable, and so on 358 * We save flags to avoid any trouble with buildable/non buildable, and so on
360 */ 359 */
361 for (flag = 0; flag < 4; flag++) 360 for (flag = 0; flag < 4; flag++)
362 old_flags[flag] = wall->flags[flag]; 361 old_flags[flag] = wall->flags[flag];
363 wall->remove (); 362
364 wall->destroy (0); 363 wall->destroy ();
365 364
366 wall = arch_to_object (new_arch); 365 wall = arch_to_object (new_arch);
367 wall->type = WALL; 366 wall->type = BUILDABLE_WALL;
368 insert_ob_in_map_at (wall, map, NULL, INS_ABOVE_FLOOR_ONLY, x, y); 367 insert_ob_in_map_at (wall, map, NULL, INS_ABOVE_FLOOR_ONLY, x, y);
369 for (flag = 0; flag < 4; flag++) 368 for (flag = 0; flag < 4; flag++)
370 wall->flags[flag] = old_flags[flag]; 369 wall->flags[flag] = old_flags[flag];
371} 370}
372 371
403 if (tmp) 402 if (tmp)
404 { 403 {
405 while (tmp) 404 while (tmp)
406 { 405 {
407 above = tmp->above; 406 above = tmp->above;
408 if (WALL == tmp->type) 407 if (BUILDABLE_WALL == tmp->type)
409 { 408 {
410 /* There was a wall, remove it & keep its archetype to make new walls */ 409 /* There was a wall, remove it & keep its archetype to make new walls */
411 new_wall = tmp->arch; 410 new_wall = tmp->arch;
412 tmp->remove ();
413 tmp->destroy (0); 411 tmp->destroy ();
414 sprintf (message, "You destroy the wall and redo the floor."); 412 sprintf (message, "You destroy the wall and redo the floor.");
415 } 413 }
416 else if ((FLOOR == tmp->type) || (QUERY_FLAG (tmp, FLAG_IS_FLOOR))) 414 else if ((FLOOR == tmp->type) || (QUERY_FLAG (tmp, FLAG_IS_FLOOR)))
417 { 415 {
418 tmp->remove ();
419 tmp->destroy (0); 416 tmp->destroy ();
420 floor_removed = 1; 417 floor_removed = 1;
421 } 418 }
422 else 419 else
423 { 420 {
424 if (floor_removed) 421 if (floor_removed)
466 /* Insert wall if exists. Note: if it doesn't, the map is weird... */ 463 /* Insert wall if exists. Note: if it doesn't, the map is weird... */
467 if (new_wall) 464 if (new_wall)
468 { 465 {
469 tmp = arch_to_object (new_wall); 466 tmp = arch_to_object (new_wall);
470 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 467 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
471 tmp->type = WALL; 468 tmp->type = BUILDABLE_WALL;
472 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt); 469 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt);
473 } 470 }
474 } 471 }
475 } 472 }
476 473
528 /* Grab existing wall, if any */ 525 /* Grab existing wall, if any */
529 current_wall = NULL; 526 current_wall = NULL;
530 tmp = GET_MAP_OB (pl->map, x, y); 527 tmp = GET_MAP_OB (pl->map, x, y);
531 while (tmp && !current_wall) 528 while (tmp && !current_wall)
532 { 529 {
533 if (WALL == tmp->type) 530 if (BUILDABLE_WALL == tmp->type)
534 current_wall = tmp; 531 current_wall = tmp;
535 532
536 tmp = tmp->above; 533 tmp = tmp->above;
537 } 534 }
538 535
546 LOG (llevError, "apply_builder_wall: unable to find archetype %s\n", &material->slaying); 543 LOG (llevError, "apply_builder_wall: unable to find archetype %s\n", &material->slaying);
547 return; 544 return;
548 } 545 }
549 546
550 tmp = arch_to_object (new_wall); 547 tmp = arch_to_object (new_wall);
551 tmp->type = WALL; 548 tmp->type = BUILDABLE_WALL;
552 SET_FLAG (tmp, FLAG_IS_BUILDABLE); 549 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
553 insert_ob_in_map_at (tmp, pl->map, 0, INS_ABOVE_FLOOR_ONLY, x, y); 550 insert_ob_in_map_at (tmp, pl->map, 0, INS_ABOVE_FLOOR_ONLY, x, y);
554 551
555 /* If existing wall, remove it, no need to fix other walls */ 552 /* If existing wall, remove it, no need to fix other walls */
556 if (current_wall) 553 if (current_wall)
557 { 554 {
558 current_wall->remove ();
559 current_wall->destroy (0); 555 current_wall->destroy ();
560 fix_walls (pl->map, x, y); 556 fix_walls (pl->map, x, y);
561 sprintf (message, "You redecorate the wall to better suit your tastes."); 557 sprintf (message, "You redecorate the wall to better suit your tastes.");
562 } 558 }
563 else 559 else
564 { 560 {
655 con_rune = get_connection_rune (pl, x, y); 651 con_rune = get_connection_rune (pl, x, y);
656 connected = find_or_create_connection_for_map (pl, x, y, con_rune); 652 connected = find_or_create_connection_for_map (pl, x, y, con_rune);
657 if (connected == -1) 653 if (connected == -1)
658 { 654 {
659 /* Player already informed of failure by the previous function */ 655 /* Player already informed of failure by the previous function */
660 tmp->destroy (0); 656 tmp->destroy ();
661 return; 657 return;
662 } 658 }
663 /* Remove marking rune */ 659 /* Remove marking rune */
664 con_rune->remove ();
665 con_rune->destroy (0); 660 con_rune->destroy ();
666 } 661 }
667 662
668 /* For magic mouths/ears, and signs, take the msg from a book of scroll */ 663 /* For magic mouths/ears, and signs, take the msg from a book of scroll */
669 if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR)) 664 if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR))
670 { 665 {
671 if (adjust_sign_msg (pl, x, y, tmp) == -1) 666 if (adjust_sign_msg (pl, x, y, tmp) == -1)
672 { 667 {
673 tmp->destroy (0); 668 tmp->destroy ();
674 return; 669 return;
675 } 670 }
676 } 671 }
677 672
678 insert_ob_in_map_at (tmp, pl->map, floor, insert_flag, x, y); 673 insert_ob_in_map_at (tmp, pl->map, floor, insert_flag, x, y);
717 } 712 }
718 713
719 /* Now remove object, with special cases (buttons & such) */ 714 /* Now remove object, with special cases (buttons & such) */
720 switch (item->type) 715 switch (item->type)
721 { 716 {
722 case WALL: 717 case BUILDABLE_WALL:
723 new_draw_info (NDI_UNIQUE, 0, pl, "Can't remove a wall with that, build a floor."); 718 new_draw_info (NDI_UNIQUE, 0, pl, "Can't remove a wall with that, build a floor.");
724 return; 719 return;
725 720
726 case DOOR: 721 case DOOR:
727 case BUTTON: 722 case BUTTON:
738 733
739 /* Fall through */ 734 /* Fall through */
740 735
741 default: 736 default:
742 /* Remove generic item */ 737 /* Remove generic item */
738 if (!QUERY_FLAG (item, FLAG_IS_BUILDABLE))
739 {
740 new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't remove the %s, it's not buildable!", query_name (item));
741 return;
742 }
743
743 new_draw_info_format (NDI_UNIQUE, 0, pl, "You remove the %s", query_name (item)); 744 new_draw_info_format (NDI_UNIQUE, 0, pl, "You remove the %s", query_name (item));
744 item->remove ();
745 item->destroy (0); 745 item->destroy ();
746 } 746 }
747} 747}
748 748
749/** 749/**
750 * Global building function 750 * Global building function
911 } 911 }
912 912
913 tmp->face = book->face; 913 tmp->face = book->face;
914 tmp->invisible = 0; 914 tmp->invisible = 0;
915 } 915 }
916 book->remove (); 916
917 book->destroy (0); 917 book->destroy ();
918 return 0; 918 return 0;
919} 919}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines