… | |
… | |
222 | { |
222 | { |
223 | new_draw_info (NDI_UNIQUE, 0, pl, "You need to put a book or scroll with the message."); |
223 | new_draw_info (NDI_UNIQUE, 0, pl, "You need to put a book or scroll with the message."); |
224 | return -1; |
224 | return -1; |
225 | } |
225 | } |
226 | |
226 | |
|
|
227 | if (tmp->type == MAGIC_EAR) |
|
|
228 | { |
|
|
229 | snprintf (buf, sizeof (buf), "@match %s", &(book->msg)); |
|
|
230 | tmp->msg = buf; |
|
|
231 | } |
|
|
232 | else |
227 | tmp->msg = book->msg; |
233 | tmp->msg = book->msg; |
228 | |
234 | |
229 | if (tmp->invisible) |
235 | if (tmp->invisible) |
230 | { |
236 | { |
231 | if (book->custom_name) |
237 | if (book->custom_name) |
232 | snprintf (buf, sizeof (buf), "talking %s", &book->custom_name); |
238 | snprintf (buf, sizeof (buf), "talking %s", &book->custom_name); |
… | |
… | |
699 | * or remover object. |
705 | * or remover object. |
700 | */ |
706 | */ |
701 | void |
707 | void |
702 | apply_map_builder (object *pl, int dir) |
708 | apply_map_builder (object *pl, int dir) |
703 | { |
709 | { |
704 | object *builder = 0; |
|
|
705 | object *tmp = 0; |
|
|
706 | object *tmp2 = 0; |
|
|
707 | int x, y; |
710 | int x, y; |
708 | |
711 | |
709 | if (!pl->type == PLAYER) |
712 | if (!pl->type == PLAYER) |
710 | return; |
713 | return; |
711 | |
714 | |
… | |
… | |
735 | * The square must have only buildable items |
738 | * The square must have only buildable items |
736 | * Exception: marking runes are all right, |
739 | * Exception: marking runes are all right, |
737 | * since they are used for special things like connecting doors / buttons |
740 | * since they are used for special things like connecting doors / buttons |
738 | */ |
741 | */ |
739 | |
742 | |
740 | tmp = GET_MAP_OB (pl->map, x, y); |
743 | object *tmp = GET_MAP_OB (pl->map, x, y); |
741 | if (!tmp) |
744 | if (!tmp) |
742 | { |
745 | { |
743 | /* Nothing, meaning player is standing next to an undefined square... */ |
746 | /* 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); |
747 | 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."); |
748 | new_draw_info (NDI_UNIQUE, 0, pl, "You'd better not build here, it looks weird."); |
746 | return; |
749 | return; |
747 | } |
750 | } |
748 | |
751 | |
749 | if (INVOKE_PLAYER (BUILD, pl->contr, ARG_OBJECT (builder), ARG_MAP (pl->map), ARG_INT (x), ARG_INT (y))) |
752 | object *builder = pl->contr->ranged_ob; |
750 | return; |
|
|
751 | |
753 | |
752 | tmp2 = find_marked_object (pl); |
754 | object *tmp2 = pl->mark (); |
|
|
755 | |
753 | while (tmp) |
756 | while (tmp) |
754 | { |
757 | { |
755 | if (!tmp->flag [FLAG_IS_BUILDABLE] && (tmp->type != SIGN || tmp->arch->archname != shstr_rune_mark)) |
758 | if (!tmp->flag [FLAG_IS_BUILDABLE] && (tmp->type != SIGN || tmp->arch->archname != shstr_rune_mark)) |
756 | { |
759 | { |
757 | /* The item building function already has it's own special |
760 | /* The item building function already has it's own special |
758 | * checks for this |
761 | * checks for this |
759 | */ |
762 | */ |
760 | if (!tmp2 || tmp2->subtype != ST_MAT_ITEM) |
763 | if (!tmp2 || tmp2->subtype != ST_MAT_ITEM) |
761 | { |
764 | { |
|
|
765 | 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."); |
766 | new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here."); |
|
|
767 | |
763 | return; |
768 | return; |
764 | } |
769 | } |
765 | } |
770 | } |
766 | |
771 | |
767 | tmp = tmp->above; |
772 | tmp = tmp->above; |
768 | } |
773 | } |
769 | |
774 | |
770 | /* Now we know the square is ok */ |
775 | /* Now we know the square is ok */ |
771 | builder = pl->contr->ranged_ob; |
776 | if (INVOKE_PLAYER (BUILD, pl->contr, ARG_OBJECT (builder), ARG_MAP (pl->map), ARG_INT (x), ARG_INT (y), ARG_INT (1))) |
|
|
777 | return; |
772 | |
778 | |
773 | if (builder->subtype == ST_BD_REMOVE) |
779 | if (builder->subtype == ST_BD_REMOVE) |
774 | /* Remover -> call specific function and bail out */ |
780 | /* Remover -> call specific function and bail out */ |
775 | { |
781 | { |
776 | apply_builder_remove (pl, dir); |
782 | apply_builder_remove (pl, dir); |