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 (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * 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 |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * 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, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * 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 |
19 | * along with this program; if not, write to the Free Software |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
|
21 | * |
20 | * |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
22 | */ |
24 | |
23 | |
25 | #include <global.h> |
24 | #include <global.h> |
26 | #include <living.h> |
25 | #include <living.h> |
27 | #include <spells.h> |
26 | #include <spells.h> |
… | |
… | |
39 | |
38 | |
40 | ob = GET_MAP_OB (map, x, y); |
39 | ob = GET_MAP_OB (map, x, y); |
41 | while (ob) |
40 | while (ob) |
42 | { |
41 | { |
43 | /* 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 */ |
44 | if (strcmp (ob->arch->name, "rune_mark") && ob->type != FLOOR) |
43 | if (ob->arch->archname != shstr_rune_mark && ob->type != FLOOR) |
45 | { |
44 | { |
46 | switch (tmp->type) |
45 | switch (tmp->type) |
47 | { |
46 | { |
48 | case SIGN: |
47 | case SIGN: |
49 | case MAGIC_EAR: |
48 | case MAGIC_EAR: |
50 | /* Allow signs and magic ears to be built on books */ |
49 | /* Allow signs and magic ears to be built on books */ |
51 | if (ob->type != BOOK) |
50 | if (ob->type != BOOK) |
52 | { |
|
|
53 | return 0; |
|
|
54 | } |
|
|
55 | break; |
|
|
56 | case BUTTON: |
|
|
57 | case DETECTOR: |
|
|
58 | case PEDESTAL: |
|
|
59 | case CF_HANDLE: |
|
|
60 | /* Allow buttons and levers to be built under gates */ |
|
|
61 | if (ob->type != GATE && ob->type != DOOR) |
|
|
62 | { |
|
|
63 | return 0; |
|
|
64 | } |
|
|
65 | break; |
|
|
66 | default: |
|
|
67 | return 0; |
51 | return 0; |
|
|
52 | break; |
|
|
53 | case BUTTON: |
|
|
54 | case DETECTOR: |
|
|
55 | case PEDESTAL: |
|
|
56 | case CF_HANDLE: |
|
|
57 | /* Allow buttons and levers to be built under gates */ |
|
|
58 | if (ob->type != GATE && ob->type != DOOR) |
|
|
59 | return 0; |
|
|
60 | break; |
|
|
61 | default: |
|
|
62 | return 0; |
68 | } |
63 | } |
69 | } |
64 | } |
|
|
65 | |
70 | ob = ob->above; |
66 | ob = ob->above; |
71 | } |
67 | } |
72 | return 1; |
68 | return 1; |
73 | } |
69 | } |
74 | |
70 | |
… | |
… | |
84 | rune = GET_MAP_OB (map, x, y); |
80 | rune = GET_MAP_OB (map, x, y); |
85 | while (rune) |
81 | while (rune) |
86 | { |
82 | { |
87 | next = rune->above; |
83 | next = rune->above; |
88 | |
84 | |
89 | if ((rune->type == SIGN) && (!strcmp (rune->arch->name, "rune_mark"))) |
85 | if (rune->type == SIGN && rune->arch->archname == shstr_rune_mark) |
90 | rune->destroy (); |
86 | rune->destroy (); |
91 | |
87 | |
92 | rune = next; |
88 | rune = next; |
93 | } |
89 | } |
94 | } |
90 | } |
… | |
… | |
98 | * \param map: map for which to find a value |
94 | * \param map: map for which to find a value |
99 | * \return 'connected' value with no item, or -1 if failure. |
95 | * \return 'connected' value with no item, or -1 if failure. |
100 | * |
96 | * |
101 | * Tries 1000 random values, then returns -1. |
97 | * Tries 1000 random values, then returns -1. |
102 | */ |
98 | */ |
103 | int |
99 | static shstr_tmp |
104 | find_unused_connected_value (maptile *map) |
100 | find_unused_connected_value (maptile *map) |
105 | { |
101 | { |
106 | int connected = 0; |
102 | for (int i = 1000; --i; ) |
107 | int itest = 0; |
|
|
108 | oblinkpt *obp; |
|
|
109 | |
|
|
110 | while (itest++ < 1000) |
|
|
111 | { |
|
|
112 | connected = 1 + rand () % 20000; |
|
|
113 | for (obp = map->buttons; obp && (obp->value != connected); obp = obp->next); |
|
|
114 | |
|
|
115 | if (!obp) |
|
|
116 | return connected; |
|
|
117 | } |
103 | { |
|
|
104 | char buf[64]; |
118 | |
105 | |
119 | return -1; |
106 | snprintf (buf, sizeof (buf), "built-%x", rndm (0xf0000000U) + 0x10000000U); |
120 | } |
|
|
121 | |
107 | |
|
|
108 | shstr id (buf); |
|
|
109 | |
|
|
110 | if (!map->find_link (id)) |
|
|
111 | return id; |
|
|
112 | } |
|
|
113 | |
|
|
114 | return shstr_tmp (); |
|
|
115 | } |
122 | |
116 | |
123 | /** |
117 | /** |
124 | * Helper function for door/button/connected item building. |
118 | * Helper function for door/button/connected item building. |
125 | * |
119 | * |
126 | * Will search the specified spot for a marking rune. |
120 | * Will search the specified spot for a marking rune. |
… | |
… | |
128 | * Else, searches a force in op's inventory matching the map's name |
122 | * Else, searches a force in op's inventory matching the map's name |
129 | * and the rune's text. |
123 | * and the rune's text. |
130 | * If found, returns the connection value associated |
124 | * If found, returns the connection value associated |
131 | * else searches a new connection value, and adds the force to the player. |
125 | * else searches a new connection value, and adds the force to the player. |
132 | */ |
126 | */ |
133 | int |
127 | static shstr_tmp |
134 | find_or_create_connection_for_map (object *pl, short x, short y, object *rune) |
128 | find_or_create_connection_for_map (object *pl, short x, short y, object *rune) |
135 | { |
129 | { |
136 | object *force; |
130 | object *force; |
137 | int connected; |
|
|
138 | |
131 | |
139 | if (!rune) |
132 | if (!rune) |
140 | rune = get_connection_rune (pl, x, y); |
133 | rune = get_connection_rune (pl, x, y); |
141 | |
134 | |
142 | if (!rune) |
135 | if (!rune) |
143 | { |
136 | { |
144 | new_draw_info (NDI_UNIQUE, 0, pl, "You need to put a marking rune with the group name."); |
137 | new_draw_info (NDI_UNIQUE, 0, pl, "You need to put a marking rune with the group name."); |
145 | return -1; |
138 | return shstr_tmp (); |
146 | } |
139 | } |
147 | |
140 | |
148 | /* Now, find force in player's inventory */ |
141 | /* Now, find force in player's inventory */ |
149 | force = pl->inv; |
142 | force = pl->inv; |
150 | while (force |
143 | while (force |
… | |
… | |
154 | |
147 | |
155 | if (!force) |
148 | if (!force) |
156 | /* No force, need to create & insert one */ |
149 | /* No force, need to create & insert one */ |
157 | { |
150 | { |
158 | /* Find unused value */ |
151 | /* Find unused value */ |
159 | connected = find_unused_connected_value (pl->map); |
152 | shstr_tmp id = find_unused_connected_value (pl->map); |
160 | if (connected == -1) |
153 | |
|
|
154 | if (!id) |
161 | { |
155 | { |
162 | new_draw_info (NDI_UNIQUE, 0, pl, "Could not create more groups."); |
156 | new_draw_info (NDI_UNIQUE, 0, pl, "Could not create more groups."); |
163 | return -1; |
157 | return shstr_tmp (); |
164 | } |
158 | } |
165 | |
159 | |
166 | force = get_archetype (FORCE_NAME); |
160 | force = get_archetype (FORCE_NAME); |
167 | force->slaying = pl->map->path; |
161 | force->slaying = pl->map->path; |
168 | force->msg = rune->msg; |
162 | force->msg = rune->msg; |
169 | force->path_attuned = connected; |
163 | force->race = id; |
170 | force->set_speed (0); |
164 | force->set_speed (0); |
|
|
165 | |
171 | insert_ob_in_ob (force, pl); |
166 | insert_ob_in_ob (force, pl); |
172 | |
167 | |
173 | return connected; |
168 | return id; |
174 | } |
169 | } |
175 | |
170 | |
176 | /* Found the force, everything's easy. */ |
171 | /* Found the force, everything's easy. */ |
177 | return force->path_attuned; |
172 | return force->race; |
178 | } |
173 | } |
179 | |
174 | |
180 | /** |
175 | /** |
181 | * Returns the marking rune on the square, for purposes of building connections |
176 | * Returns the marking rune on the square, for purposes of building connections |
182 | */ |
177 | */ |
183 | object * |
178 | object * |
184 | get_connection_rune (object *pl, short x, short y) |
179 | get_connection_rune (object *pl, short x, short y) |
185 | { |
180 | { |
186 | object *rune; |
|
|
187 | |
|
|
188 | rune = GET_MAP_OB (pl->map, x, y); |
181 | object *rune = GET_MAP_OB (pl->map, x, y); |
|
|
182 | |
189 | while (rune && ((rune->type != SIGN) || (strcmp (rune->arch->name, "rune_mark")))) |
183 | while (rune && (rune->type != SIGN || rune->arch->archname != shstr_rune_mark)) |
190 | rune = rune->above; |
184 | rune = rune->above; |
|
|
185 | |
191 | return rune; |
186 | return rune; |
192 | } |
187 | } |
193 | |
188 | |
194 | /** |
189 | /** |
195 | * Returns the book/scroll on the current square, for purposes of building |
190 | * Returns the book/scroll on the current square, for purposes of building |
196 | */ |
191 | */ |
197 | object * |
192 | object * |
198 | get_msg_book (object *pl, short x, short y) |
193 | get_msg_book (object *pl, short x, short y) |
199 | { |
194 | { |
200 | object *book; |
|
|
201 | |
|
|
202 | book = GET_MAP_OB (pl->map, x, y); |
195 | object *book = GET_MAP_OB (pl->map, x, y); |
|
|
196 | |
203 | while (book && (book->type != BOOK)) |
197 | while (book && (book->type != BOOK)) |
204 | book = book->above; |
198 | book = book->above; |
|
|
199 | |
205 | return book; |
200 | return book; |
206 | } |
201 | } |
207 | |
202 | |
208 | /** |
203 | /** |
209 | * Returns first item of type BUILDABLE_WALL. |
204 | * Returns first item of type BUILDABLE_WALL. |
210 | */ |
205 | */ |
211 | object * |
206 | object * |
212 | get_wall (maptile *map, int x, int y) |
207 | get_wall (maptile *map, int x, int y) |
213 | { |
208 | { |
214 | object *wall; |
|
|
215 | |
|
|
216 | wall = GET_MAP_OB (map, x, y); |
209 | object *wall = GET_MAP_OB (map, x, y); |
|
|
210 | |
217 | while (wall && (BUILDABLE_WALL != wall->type)) |
211 | while (wall && (BUILDABLE_WALL != wall->type)) |
218 | wall = wall->above; |
212 | wall = wall->above; |
219 | |
213 | |
220 | return wall; |
214 | return wall; |
221 | } |
215 | } |
… | |
… | |
232 | * Note: x & y must be valid map coordinates. |
226 | * Note: x & y must be valid map coordinates. |
233 | */ |
227 | */ |
234 | void |
228 | void |
235 | fix_walls (maptile *map, int x, int y) |
229 | fix_walls (maptile *map, int x, int y) |
236 | { |
230 | { |
237 | object *wall; |
|
|
238 | char archetype[MAX_BUF]; |
231 | char archetype[MAX_BUF]; |
239 | char *underscore; |
232 | char *underscore; |
240 | struct archetype *new_arch; |
233 | struct archetype *new_arch; |
241 | |
234 | |
242 | |
|
|
243 | /* First, find the wall on that spot */ |
235 | /* First, find the wall on that spot */ |
244 | wall = get_wall (map, x, y); |
236 | object *wall = get_wall (map, x, y); |
245 | if (!wall) |
237 | if (!wall) |
246 | /* Nothing -> bail out */ |
238 | /* Nothing -> bail out */ |
247 | return; |
239 | return; |
248 | |
240 | |
249 | /* Find base name */ |
241 | /* Find base name */ |
250 | assign (archetype, wall->arch->name); |
242 | assign (archetype, wall->arch->archname); |
251 | underscore = strchr (archetype, '_'); |
243 | underscore = strchr (archetype, '_'); |
252 | |
244 | |
253 | /* search for the first _ before a number */ |
245 | /* search for the first _ before a number */ |
254 | while (underscore && !isdigit (*(underscore + 1))) |
246 | while (underscore && !isdigit (*(underscore + 1))) |
255 | underscore = strchr (underscore + 1, '_'); |
247 | underscore = strchr (underscore + 1, '_'); |
… | |
… | |
412 | floor_removed = 1; |
404 | floor_removed = 1; |
413 | } |
405 | } |
414 | else |
406 | else |
415 | { |
407 | { |
416 | if (floor_removed) |
408 | if (floor_removed) |
|
|
409 | { |
|
|
410 | /* This is the first item that was above the floor */ |
417 | above_floor = tmp; |
411 | above_floor = tmp; |
|
|
412 | floor_removed = 0; |
|
|
413 | } |
418 | } |
414 | } |
419 | |
415 | |
420 | tmp = above; |
416 | tmp = above; |
421 | } |
417 | } |
422 | } |
418 | } |
… | |
… | |
476 | if (!OUT_OF_REAL_MAP (pl->map, xt, yt)) |
472 | if (!OUT_OF_REAL_MAP (pl->map, xt, yt)) |
477 | fix_walls (pl->map, xt, yt); |
473 | fix_walls (pl->map, xt, yt); |
478 | } |
474 | } |
479 | |
475 | |
480 | /* Now remove raw item from inventory */ |
476 | /* Now remove raw item from inventory */ |
481 | decrease_ob (material); |
477 | material->decrease (); |
482 | |
478 | |
483 | /* And tell player about the fix */ |
479 | /* And tell player about the fix */ |
484 | new_draw_info (NDI_UNIQUE, 0, pl, message); |
480 | new_draw_info (NDI_UNIQUE, 0, pl, message); |
485 | } |
481 | } |
486 | |
482 | |
… | |
… | |
563 | fix_walls (pl->map, xt, yt); |
559 | fix_walls (pl->map, xt, yt); |
564 | } |
560 | } |
565 | } |
561 | } |
566 | |
562 | |
567 | /* Now remove item from inventory */ |
563 | /* Now remove item from inventory */ |
568 | decrease_ob (material); |
564 | material->decrease (); |
569 | |
565 | |
570 | /* And tell player what happened */ |
566 | /* And tell player what happened */ |
571 | new_draw_info (NDI_UNIQUE, 0, pl, message); |
567 | new_draw_info (NDI_UNIQUE, 0, pl, message); |
572 | } |
568 | } |
573 | |
569 | |
… | |
… | |
585 | object *tmp; |
581 | object *tmp; |
586 | struct archetype *arch; |
582 | struct archetype *arch; |
587 | int insert_flag; |
583 | int insert_flag; |
588 | object *floor; |
584 | object *floor; |
589 | object *con_rune; |
585 | object *con_rune; |
590 | int connected; |
|
|
591 | |
586 | |
592 | /* Find floor */ |
587 | /* Find floor */ |
593 | floor = GET_MAP_OB (pl->map, x, y); |
588 | floor = GET_MAP_OB (pl->map, x, y); |
594 | if (!floor) |
589 | if (!floor) |
595 | { |
590 | { |
… | |
… | |
610 | if (!arch) |
605 | if (!arch) |
611 | return; |
606 | return; |
612 | |
607 | |
613 | tmp = arch_to_object (arch); |
608 | tmp = arch_to_object (arch); |
614 | |
609 | |
615 | if ((floor->above) && (!can_build_over (pl->map, tmp, x, y))) |
610 | if (!floor->flag[FLAG_IS_BUILDABLE] || (floor->above) && (!can_build_over (pl->map, tmp, x, y))) |
616 | /* Floor has something on top that interferes with building */ |
611 | /* Floor has something on top that interferes with building */ |
617 | { |
612 | { |
618 | new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here."); |
613 | new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here."); |
619 | return; |
614 | return; |
620 | } |
615 | } |
621 | |
616 | |
622 | SET_FLAG (tmp, FLAG_IS_BUILDABLE); |
617 | SET_FLAG (tmp, FLAG_IS_BUILDABLE); |
623 | SET_FLAG (tmp, FLAG_NO_PICK); |
618 | SET_FLAG (tmp, FLAG_NO_PICK); |
624 | |
619 | |
625 | /* |
620 | /* |
626 | * This doesn't work on non unique maps. pedestals under floor will not be saved... |
621 | * Str 1 is a flag that the item [pedestal] should go below the floor. |
627 | insert_flag = ( item->stats.Str == 1 ) ? INS_BELOW_ORIGINATOR : INS_ABOVE_FLOOR_ONLY; |
622 | * Items under the floor on non-unique maps will not be saved, |
|
|
623 | * so make the item itself unique in this situation. |
628 | */ |
624 | */ |
629 | insert_flag = INS_ABOVE_FLOOR_ONLY; |
625 | insert_flag = ( item->stats.Str == 1 ) ? INS_BELOW_ORIGINATOR : INS_ABOVE_FLOOR_ONLY; |
|
|
626 | if (insert_flag == INS_BELOW_ORIGINATOR && !pl->map->no_reset) |
|
|
627 | SET_FLAG (tmp, FLAG_UNIQUE); |
630 | |
628 | |
631 | connected = 0; |
629 | shstr_tmp connected; |
|
|
630 | |
632 | switch (tmp->type) |
631 | switch (tmp->type) |
633 | { |
632 | { |
634 | case DOOR: |
633 | case DOOR: |
635 | case GATE: |
634 | case GATE: |
636 | case BUTTON: |
635 | case BUTTON: |
637 | case DETECTOR: |
636 | case DETECTOR: |
638 | case TIMED_GATE: |
637 | case TIMED_GATE: |
639 | case PEDESTAL: |
638 | case PEDESTAL: |
640 | case CF_HANDLE: |
639 | case CF_HANDLE: |
641 | case MAGIC_EAR: |
640 | case MAGIC_EAR: |
642 | case SIGN: |
641 | case SIGN: |
643 | /* Signs don't need a connection, but but magic mouths do. */ |
642 | /* Signs don't need a connection, but but magic mouths do. */ |
644 | if (tmp->type == SIGN && strcmp (tmp->arch->name, "magic_mouth")) |
643 | if (tmp->type == SIGN && tmp->arch->archname != shstr_magic_mouth) |
645 | break; |
644 | break; |
|
|
645 | |
646 | con_rune = get_connection_rune (pl, x, y); |
646 | con_rune = get_connection_rune (pl, x, y); |
647 | connected = find_or_create_connection_for_map (pl, x, y, con_rune); |
647 | connected = find_or_create_connection_for_map (pl, x, y, con_rune); |
648 | if (connected == -1) |
648 | if (!connected) |
649 | { |
649 | { |
650 | /* Player already informed of failure by the previous function */ |
650 | /* Player already informed of failure by the previous function */ |
651 | tmp->destroy (); |
651 | tmp->destroy (); |
652 | return; |
652 | return; |
653 | } |
653 | } |
|
|
654 | |
654 | /* Remove marking rune */ |
655 | /* Remove marking rune */ |
655 | con_rune->destroy (); |
656 | con_rune->destroy (); |
656 | } |
657 | } |
657 | |
658 | |
658 | /* For magic mouths/ears, and signs, take the msg from a book of scroll */ |
659 | /* For magic mouths/ears, and signs, take the msg from a book of scroll */ |
659 | if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR)) |
660 | if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR)) |
660 | { |
661 | { |
… | |
… | |
664 | return; |
665 | return; |
665 | } |
666 | } |
666 | } |
667 | } |
667 | |
668 | |
668 | insert_ob_in_map_at (tmp, pl->map, floor, insert_flag, x, y); |
669 | insert_ob_in_map_at (tmp, pl->map, floor, insert_flag, x, y); |
669 | if (connected != 0) |
670 | if (connected) |
670 | add_button_link (tmp, pl->map, connected); |
671 | tmp->add_link (pl->map, connected); |
671 | |
672 | |
672 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You build the %s", query_name (tmp)); |
673 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You build the %s", query_name (tmp)); |
673 | decrease_ob_nr (item, 1); |
674 | item->decrease (); |
674 | } |
675 | } |
675 | |
676 | |
676 | /** |
677 | /** |
677 | * Item remover. |
678 | * Item remover. |
678 | * |
679 | * |
… | |
… | |
764 | /* Nothing, meaning player is standing next to an undefined square... */ |
765 | /* Nothing, meaning player is standing next to an undefined square... */ |
765 | LOG (llevError, "apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, &pl->map->path); |
766 | LOG (llevError, "apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, &pl->map->path); |
766 | new_draw_info (NDI_UNIQUE, 0, pl, "You'd better not build here, it looks weird."); |
767 | new_draw_info (NDI_UNIQUE, 0, pl, "You'd better not build here, it looks weird."); |
767 | return; |
768 | return; |
768 | } |
769 | } |
|
|
770 | |
769 | tmp2 = find_marked_object (pl); |
771 | tmp2 = find_marked_object (pl); |
770 | while (tmp) |
772 | while (tmp) |
771 | { |
773 | { |
772 | if (!QUERY_FLAG (tmp, FLAG_IS_BUILDABLE) && ((tmp->type != SIGN) || (strcmp (tmp->arch->name, "rune_mark")))) |
774 | if (!QUERY_FLAG (tmp, FLAG_IS_BUILDABLE) && (tmp->type != SIGN || tmp->arch->archname != shstr_rune_mark)) |
773 | { |
775 | { |
774 | /* The item building function already has it's own special |
776 | /* The item building function already has it's own special |
775 | * checks for this |
777 | * checks for this |
776 | */ |
778 | */ |
777 | if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM)) |
779 | if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM)) |
… | |
… | |
782 | } |
784 | } |
783 | tmp = tmp->above; |
785 | tmp = tmp->above; |
784 | } |
786 | } |
785 | |
787 | |
786 | /* Now we know the square is ok */ |
788 | /* Now we know the square is ok */ |
787 | builder = pl->contr->ranges[range_builder]; |
789 | builder = pl->contr->ranged_ob; |
788 | |
790 | |
789 | if (builder->subtype == ST_BD_REMOVE) |
791 | if (builder->subtype == ST_BD_REMOVE) |
790 | /* Remover -> call specific function and bail out */ |
792 | /* Remover -> call specific function and bail out */ |
791 | { |
793 | { |
792 | apply_builder_remove (pl, dir); |
794 | apply_builder_remove (pl, dir); |
… | |
… | |
860 | tmp->msg = book->msg; |
862 | tmp->msg = book->msg; |
861 | |
863 | |
862 | if (tmp->invisible) |
864 | if (tmp->invisible) |
863 | { |
865 | { |
864 | if (book->custom_name != NULL) |
866 | if (book->custom_name != NULL) |
865 | { |
|
|
866 | snprintf (buf, sizeof (buf), "talking %s", &book->custom_name); |
867 | snprintf (buf, sizeof (buf), "talking %s", &book->custom_name); |
867 | } |
|
|
868 | else |
868 | else |
869 | { |
|
|
870 | snprintf (buf, sizeof (buf), "talking %s", &book->name); |
869 | snprintf (buf, sizeof (buf), "talking %s", &book->name); |
871 | } |
870 | |
872 | tmp->name = buf; |
871 | tmp->name = buf; |
873 | |
872 | |
874 | if (book->name_pl != NULL) |
873 | if (book->name_pl != NULL) |
875 | { |
874 | { |
876 | snprintf (buf2, sizeof (buf2), "talking %s", &book->name_pl); |
875 | snprintf (buf2, sizeof (buf2), "talking %s", &book->name_pl); |