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.57 by elmex, Tue Apr 13 18:10:54 2010 UTC vs.
Revision 1.60 by root, Wed Apr 14 21:36:32 2010 UTC

699 * or remover object. 699 * or remover object.
700 */ 700 */
701void 701void
702apply_map_builder (object *pl, int dir) 702apply_map_builder (object *pl, int dir)
703{ 703{
704 object *builder = 0;
705 object *tmp = 0;
706 object *tmp2 = 0;
707 int x, y; 704 int x, y;
708 705
709 if (!pl->type == PLAYER) 706 if (!pl->type == PLAYER)
710 return; 707 return;
711 708
735 * The square must have only buildable items 732 * The square must have only buildable items
736 * Exception: marking runes are all right, 733 * Exception: marking runes are all right,
737 * since they are used for special things like connecting doors / buttons 734 * since they are used for special things like connecting doors / buttons
738 */ 735 */
739 736
740 tmp = GET_MAP_OB (pl->map, x, y); 737 object *tmp = GET_MAP_OB (pl->map, x, y);
741 if (!tmp) 738 if (!tmp)
742 { 739 {
743 /* Nothing, meaning player is standing next to an undefined square... */ 740 /* Nothing, meaning player is standing next to an undefined square... */
744 LOG (llevError, "apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, &pl->map->path); 741 LOG (llevError, "apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, &pl->map->path);
745 new_draw_info (NDI_UNIQUE, 0, pl, "You'd better not build here, it looks weird."); 742 new_draw_info (NDI_UNIQUE, 0, pl, "You'd better not build here, it looks weird.");
746 return; 743 return;
747 } 744 }
748 745
749 if (INVOKE_PLAYER (BUILD, pl->contr, ARG_OBJECT (builder), ARG_MAP (pl->map), ARG_INT (x), ARG_INT (y))) 746 object *builder = pl->contr->ranged_ob;
750 return;
751 747
752 tmp2 = find_marked_object (pl); 748 object *tmp2 = pl->mark ();
749
753 while (tmp) 750 while (tmp)
754 { 751 {
755 if (!tmp->flag [FLAG_IS_BUILDABLE] && (tmp->type != SIGN || tmp->arch->archname != shstr_rune_mark)) 752 if (!tmp->flag [FLAG_IS_BUILDABLE] && (tmp->type != SIGN || tmp->arch->archname != shstr_rune_mark))
756 { 753 {
757 /* The item building function already has it's own special 754 /* The item building function already has it's own special
758 * checks for this 755 * checks for this
759 */ 756 */
760 if (!tmp2 || tmp2->subtype != ST_MAT_ITEM) 757 if (!tmp2 || tmp2->subtype != ST_MAT_ITEM)
761 { 758 {
759 if (!INVOKE_PLAYER (BUILD, pl->contr, ARG_OBJECT (builder), ARG_MAP (pl->map), ARG_INT (x), ARG_INT (y), ARG_INT (0)))
762 new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here."); 760 new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here.");
761
763 return; 762 return;
764 } 763 }
765 } 764 }
766 765
767 tmp = tmp->above; 766 tmp = tmp->above;
768 } 767 }
769 768
770 /* Now we know the square is ok */ 769 /* Now we know the square is ok */
771 builder = pl->contr->ranged_ob; 770 if (INVOKE_PLAYER (BUILD, pl->contr, ARG_OBJECT (builder), ARG_MAP (pl->map), ARG_INT (x), ARG_INT (y), ARG_INT (1)))
771 return;
772 772
773 if (builder->subtype == ST_BD_REMOVE) 773 if (builder->subtype == ST_BD_REMOVE)
774 /* Remover -> call specific function and bail out */ 774 /* Remover -> call specific function and bail out */
775 { 775 {
776 apply_builder_remove (pl, dir); 776 apply_builder_remove (pl, dir);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines