ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/build_map.C
Revision: 1.49
Committed: Sun Mar 14 18:19:59 2010 UTC (14 years, 3 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.48: +4 -3 lines
Log Message:
indent

File Contents

# Content
1 /*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
21 *
22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */
24
25 #include <global.h>
26 #include <living.h>
27 #include <spells.h>
28 #include <skills.h>
29 #include <tod.h>
30 #include <sproto.h>
31
32 /**
33 * Check if objects on a square interfere with building
34 */
35 static int
36 can_build_over (maptile *map, object *tmp, int x, int y)
37 {
38 object *ob;
39
40 ob = GET_MAP_OB (map, x, y);
41 while (ob)
42 {
43 /* if ob is not a marking rune or floor, then check special cases */
44 if (ob->arch->archname != shstr_rune_mark && ob->type != FLOOR)
45 {
46 switch (tmp->type)
47 {
48 case SIGN:
49 case MAGIC_EAR:
50 /* Allow signs and magic ears to be built on books */
51 if (ob->type != BOOK)
52 return 0;
53 break;
54 case BUTTON:
55 case DETECTOR:
56 case PEDESTAL:
57 case T_HANDLE:
58 /* Allow buttons and levers to be built under gates */
59 if (ob->type != GATE && ob->type != DOOR)
60 return 0;
61 break;
62 default:
63 return 0;
64 }
65 }
66
67 ob = ob->above;
68 }
69
70 return 1;
71 }
72
73 /**
74 * Erases marking runes at specified location
75 */
76 static void
77 remove_marking_runes (maptile *map, int x, int y)
78 {
79 object *rune;
80 object *next;
81
82 rune = GET_MAP_OB (map, x, y);
83 while (rune)
84 {
85 next = rune->above;
86
87 if (rune->type == SIGN && rune->arch->archname == shstr_rune_mark)
88 rune->destroy ();
89
90 rune = next;
91 }
92 }
93
94 /**
95 * Returns an unused value for 'connected'.
96 * \param map: map for which to find a value
97 * \return 'connected' value with no item, or -1 if failure.
98 *
99 * Tries 1000 random values, then returns -1.
100 */
101 static shstr_tmp
102 find_unused_connected_value (maptile *map)
103 {
104 for (int i = 1000; --i; )
105 {
106 char buf[64];
107
108 snprintf (buf, sizeof (buf), "built-%x", rndm (0xf0000000U) + 0x10000000U);
109
110 shstr id (buf);
111
112 if (!map->find_link (id))
113 return id;
114 }
115
116 return shstr_tmp ();
117 }
118
119 /**
120 * Returns the marking rune on the square, for purposes of building connections
121 */
122 static object *
123 get_connection_rune (object *pl, int x, int y)
124 {
125 object *rune = GET_MAP_OB (pl->map, x, y);
126
127 while (rune && (rune->type != SIGN || rune->arch->archname != shstr_rune_mark))
128 rune = rune->above;
129
130 return rune;
131 }
132
133 /**
134 * Helper function for door/button/connected item building.
135 *
136 * Will search the specified spot for a marking rune.
137 * If not found, returns -1
138 * Else, searches a force in op's inventory matching the map's name
139 * and the rune's text.
140 * If found, returns the connection value associated
141 * else searches a new connection value, and adds the force to the player.
142 */
143 static shstr_tmp
144 find_or_create_connection_for_map (object *pl, int x, int y, object *rune)
145 {
146 object *force;
147
148 if (!rune)
149 rune = get_connection_rune (pl, x, y);
150
151 if (!rune)
152 {
153 new_draw_info (NDI_UNIQUE, 0, pl, "You need to put a marking rune with the group name.");
154 return shstr_tmp ();
155 }
156
157 /* Now, find force in player's inventory */
158 force = pl->inv;
159 while (force
160 && ((force->type != FORCE) || !force->slaying || force->slaying != pl->map->path || !force->msg
161 || force->msg != rune->msg))
162 force = force->below;
163
164 if (!force)
165 /* No force, need to create & insert one */
166 {
167 /* Find unused value */
168 shstr_tmp id = find_unused_connected_value (pl->map);
169
170 if (!id)
171 {
172 new_draw_info (NDI_UNIQUE, 0, pl, "Could not create more groups.");
173 return shstr_tmp ();
174 }
175
176 force = get_archetype (FORCE_NAME);
177 force->slaying = pl->map->path;
178 force->msg = rune->msg;
179 force->race = id;
180 force->set_speed (0);
181
182 insert_ob_in_ob (force, pl);
183
184 return id;
185 }
186
187 /* Found the force, everything's easy. */
188 return force->race;
189 }
190
191 /**
192 * Returns the book/scroll on the current square, for purposes of building
193 */
194 static object *
195 get_msg_book (object *pl, int x, int y)
196 {
197 object *book = GET_MAP_OB (pl->map, x, y);
198
199 while (book && (book->type != BOOK))
200 book = book->above;
201
202 return book;
203 }
204
205 /**
206 * Make the built object inherit the msg of books that are used with it.
207 * For objects already invisible (i.e. magic mouths & ears), also make it
208 * it inherit the face and the name with "talking " prepended.
209 */
210 static int
211 adjust_sign_msg (object *pl, int x, int y, object *tmp)
212 {
213 object *book;
214 char buf[MAX_BUF];
215 char buf2[MAX_BUF];
216
217 book = get_msg_book (pl, x, y);
218 if (!book)
219 {
220 new_draw_info (NDI_UNIQUE, 0, pl, "You need to put a book or scroll with the message.");
221 return -1;
222 }
223
224 tmp->msg = book->msg;
225
226 if (tmp->invisible)
227 {
228 if (book->custom_name)
229 snprintf (buf, sizeof (buf), "talking %s", &book->custom_name);
230 else
231 snprintf (buf, sizeof (buf), "talking %s", &book->name);
232
233 tmp->name = buf;
234
235 if (book->name_pl)
236 {
237 snprintf (buf2, sizeof (buf2), "talking %s", &book->name_pl);
238 tmp->name_pl = buf2;
239 }
240
241 tmp->face = book->face;
242 tmp->invisible = 0;
243 }
244
245 book->destroy ();
246 return 0;
247 }
248
249 /**
250 * Returns first item of type BUILDABLE_WALL.
251 */
252 static object *
253 get_wall (maptile *map, int x, int y)
254 {
255 object *wall = GET_MAP_OB (map, x, y);
256
257 while (wall && (BUILDABLE_WALL != wall->type))
258 wall = wall->above;
259
260 return wall;
261 }
262
263 /**
264 * Fixes walls around specified spot
265 *
266 * \param map is the map
267 * \param x
268 * \param y are the position to fix
269 *
270 * Basically it ensures the correct wall is put where needed.
271 *
272 * Note: x & y must be valid map coordinates.
273 */
274 static void
275 fix_walls (maptile *map, int x, int y)
276 {
277 char archetype[MAX_BUF];
278 char *underscore;
279 struct archetype *new_arch;
280
281 /* First, find the wall on that spot */
282 object *wall = get_wall (map, x, y);
283 if (!wall)
284 /* Nothing -> bail out */
285 return;
286
287 /* Find base name */
288 assign (archetype, wall->arch->archname);
289 underscore = strchr (archetype, '_');
290
291 /* search for the first _ before a number */
292 while (underscore && !isdigit (*(underscore + 1)))
293 underscore = strchr (underscore + 1, '_');
294
295 if (!underscore || !isdigit (*(underscore + 1)))
296 /* Not in a format we can change, bail out */
297 return;
298
299 underscore++;
300 *underscore = '\0';
301
302 int connect = 0;
303
304 if (x > 0 && get_wall (map, x - 1, y)) connect |= 1;
305 if (x < map->width - 1 && get_wall (map, x + 1, y)) connect |= 2;
306 if (y > 0 && get_wall (map, x, y - 1)) connect |= 4;
307 if (y < map->height - 1 && get_wall (map, x, y + 1)) connect |= 8;
308
309 // one bit per dir, 1 left, 2 right, 4 up, 8 down
310 static const char *walltype[16] = {
311 "0",
312 "1_3",
313 "1_4",
314 "2_1_2",
315 "1_2",
316 "2_2_4",
317 "2_2_1",
318 "3_1",
319 "1_1",
320 "2_2_3",
321 "2_2_2",
322 "3_3",
323 "2_1_1",
324 "3_4",
325 "3_2",
326 "4"
327 };
328
329 strcat (archetype, walltype [connect]);
330
331 /*
332 * Before anything, make sure the archetype does exist...
333 * If not, prolly an error...
334 */
335 new_arch = archetype::find (archetype);
336
337 if (!new_arch)
338 return;
339
340 /* Now delete current wall, and insert new one
341 * We save flags to avoid any trouble with buildable/non buildable, and so on
342 */
343 object::flags_t old_flags = wall->flag; // elmex: this is where C++ pays off
344
345 wall->destroy ();
346
347 wall = new_arch->instance ();
348 wall->type = BUILDABLE_WALL;
349 insert_ob_in_map_at (wall, map, NULL, INS_ABOVE_FLOOR_ONLY, x, y);
350 wall->flag = old_flags;
351 }
352
353 /**
354 * \brief Floor building function
355 *
356 * Floors can be build:
357 * - on existing floors, with or without a detector/button
358 * - on an existing wall, with or without a floor under it
359 *
360 * Note: this function will inconditionally change squares around (x, y)
361 * so don't call it with x == 0 for instance!
362 */
363 static void
364 apply_builder_floor (object *pl, object *material, int x, int y)
365 {
366 object *tmp, *above;
367 object *above_floor; /* Item above floor, if any */
368 struct archetype *new_floor;
369 struct archetype *new_wall;
370 int i, xt, yt, floor_removed;
371 char message[MAX_BUF];
372
373 sprintf (message, "You change the floor to better suit your tastes.");
374
375 /*
376 * Now the building part...
377 * First, remove wall(s) and floor(s) at position x, y
378 */
379 above_floor = NULL;
380 new_wall = NULL;
381 floor_removed = 0;
382 tmp = GET_MAP_OB (pl->map, x, y);
383 if (tmp)
384 {
385 while (tmp)
386 {
387 above = tmp->above;
388 if (BUILDABLE_WALL == tmp->type)
389 {
390 /* There was a wall, remove it & keep its archetype to make new walls */
391 new_wall = tmp->arch;
392 tmp->destroy ();
393 sprintf (message, "You destroy the wall and redo the floor.");
394 }
395 else if ((FLOOR == tmp->type) || (QUERY_FLAG (tmp, FLAG_IS_FLOOR)))
396 {
397 tmp->destroy ();
398 floor_removed = 1;
399 }
400 else
401 {
402 if (floor_removed)
403 {
404 /* This is the first item that was above the floor */
405 above_floor = tmp;
406 floor_removed = 0;
407 }
408 }
409
410 tmp = above;
411 }
412 }
413
414 /* Now insert our floor */
415 new_floor = archetype::find (material->slaying);
416 if (!new_floor)
417 {
418 /* Not found, log & bail out */
419 LOG (llevError, "apply_builder_floor: unable to find archetype %s.\n", &material->slaying);
420 return;
421 }
422
423 tmp = new_floor->instance ();
424 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
425 SET_FLAG (tmp, FLAG_UNIQUE);
426 SET_FLAG (tmp, FLAG_IS_FLOOR);
427 tmp->type = FLOOR;
428 insert_ob_in_map_at (tmp, pl->map, above_floor, above_floor ? INS_BELOW_ORIGINATOR : INS_ON_TOP, x, y);
429
430 /*
431 * Next step: make sure there are either walls or floors around the new square
432 * Since building, you can have: blocking view / floor / wall / nothing
433 */
434 for (i = 1; i <= 8; i++)
435 {
436 xt = x + freearr_x[i];
437 yt = y + freearr_y[i];
438 tmp = GET_MAP_OB (pl->map, xt, yt);
439 if (!tmp)
440 {
441 /* Must insert floor & wall */
442 tmp = new_floor->instance ();
443 /* Better make the floor unique */
444 SET_FLAG (tmp, FLAG_UNIQUE);
445 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
446 tmp->type = FLOOR;
447 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt);
448 /* Insert wall if exists. Note: if it doesn't, the map is weird... */
449 if (new_wall)
450 {
451 tmp = new_wall->instance ();
452 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
453 tmp->type = BUILDABLE_WALL;
454 insert_ob_in_map_at (tmp, pl->map, 0, 0, xt, yt);
455 }
456 }
457 }
458
459 /* Finally fixing walls to ensure nice continuous walls
460 * Note: 2 squares around are checked, because potentially we added walls around the building
461 * spot, so need to check that those new walls connect correctly
462 */
463 for (xt = x - 2; xt <= x + 2; xt++)
464 for (yt = y - 2; yt <= y + 2; yt++)
465 if (!OUT_OF_REAL_MAP (pl->map, xt, yt))
466 fix_walls (pl->map, xt, yt);
467
468 /* Now remove raw item from inventory */
469 material->decrease ();
470
471 /* And tell player about the fix */
472 new_draw_info (NDI_UNIQUE, 0, pl, message);
473 }
474
475 /**
476 * Wall building function
477 *
478 * Walls can be build:
479 * - on a floor without anything else
480 * - on an existing wall, with or without a floor
481 */
482 static void
483 apply_builder_wall (object *pl, object *material, int x, int y)
484 {
485 object *current_wall;
486 object *tmp;
487 int xt, yt;
488 struct archetype *new_wall;
489 char message[MAX_BUF];
490
491 remove_marking_runes (pl->map, x, y);
492
493 /* Grab existing wall, if any */
494 current_wall = NULL;
495 tmp = GET_MAP_OB (pl->map, x, y);
496 while (tmp && !current_wall)
497 {
498 if (BUILDABLE_WALL == tmp->type)
499 current_wall = tmp;
500
501 tmp = tmp->above;
502 }
503
504 /* Find the raw wall in inventory */
505 sprintf (message, "You build a wall.");
506
507 /* Now we can actually insert the wall */
508 new_wall = archetype::find (material->slaying);
509 if (!new_wall)
510 {
511 LOG (llevError, "apply_builder_wall: unable to find archetype %s\n", &material->slaying);
512 return;
513 }
514
515 tmp = new_wall->instance ();
516 tmp->type = BUILDABLE_WALL;
517 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
518 insert_ob_in_map_at (tmp, pl->map, 0, INS_ABOVE_FLOOR_ONLY, x, y);
519
520 /* If existing wall, remove it, no need to fix other walls */
521 if (current_wall)
522 {
523 current_wall->destroy ();
524 fix_walls (pl->map, x, y);
525 sprintf (message, "You redecorate the wall to better suit your tastes.");
526 }
527 else
528 {
529 /* Else fix all walls around */
530 for (xt = x - 1; xt <= x + 1; xt++)
531 for (yt = y - 1; yt <= y + 1; yt++)
532 {
533 if (OUT_OF_REAL_MAP (pl->map, xt, yt))
534 continue;
535
536 fix_walls (pl->map, xt, yt);
537 }
538 }
539
540 /* Now remove item from inventory */
541 material->decrease ();
542
543 /* And tell player what happened */
544 new_draw_info (NDI_UNIQUE, 0, pl, message);
545 }
546
547 /**
548 * Generic item builder.
549 *
550 * Item must be put on a square with a floor, you can have something under.
551 * Archetype of created object is item->slaying (raw material).
552 * Type of inserted item is tested for specific cases (doors & such).
553 * Item is inserted above the floor, unless Str == 1 (only for detectors i guess)
554 */
555 static void
556 apply_builder_item (object *pl, object *item, int x, int y)
557 {
558 object *tmp;
559 struct archetype *arch;
560 int insert_flag;
561 object *floor;
562 object *con_rune;
563
564 /* Find floor */
565 floor = GET_MAP_OB (pl->map, x, y);
566 if (!floor)
567 {
568 new_draw_info (NDI_UNIQUE, 0, pl, "Invalid square.");
569 return;
570 }
571
572 while (floor && (floor->type != FLOOR) && (!QUERY_FLAG (floor, FLAG_IS_FLOOR)))
573 floor = floor->above;
574
575 if (!floor)
576 {
577 new_draw_info (NDI_UNIQUE, 0, pl, "This square has no floor, you can't build here.");
578 return;
579 }
580 /* Create item, set flag, insert in map */
581 arch = archetype::find (item->slaying);
582 if (!arch)
583 return;
584
585 tmp = arch->instance ();
586
587 if (!floor->flag[FLAG_IS_BUILDABLE] || floor->above && !can_build_over (pl->map, tmp, x, y))
588 /* Floor has something on top that interferes with building */
589 {
590 new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here.");
591 return;
592 }
593
594 SET_FLAG (tmp, FLAG_IS_BUILDABLE);
595 SET_FLAG (tmp, FLAG_NO_PICK);
596
597 /*
598 * Str 1 is a flag that the item [pedestal] should go below the floor.
599 * Items under the floor on non-unique maps will not be saved,
600 * so make the item itself unique in this situation.
601 */
602 insert_flag = item->stats.Str == 1 ? INS_BELOW_ORIGINATOR : INS_ABOVE_FLOOR_ONLY;
603 if (insert_flag == INS_BELOW_ORIGINATOR && !pl->map->no_reset)
604 SET_FLAG (tmp, FLAG_UNIQUE);
605
606 shstr_tmp connected;
607
608 switch (tmp->type)
609 {
610 case DOOR:
611 case GATE:
612 case BUTTON:
613 case DETECTOR:
614 case TIMED_GATE:
615 case PEDESTAL:
616 case T_HANDLE:
617 case MAGIC_EAR:
618 case SIGN:
619 /* Signs don't need a connection, but but magic mouths do. */
620 if (tmp->type == SIGN && tmp->arch->archname != shstr_magic_mouth)
621 break;
622
623 con_rune = get_connection_rune (pl, x, y);
624 connected = find_or_create_connection_for_map (pl, x, y, con_rune);
625 if (!connected)
626 {
627 /* Player already informed of failure by the previous function */
628 tmp->destroy ();
629 return;
630 }
631
632 /* Remove marking rune */
633 con_rune->destroy ();
634 }
635
636 /* For magic mouths/ears, and signs, take the msg from a book of scroll */
637 if ((tmp->type == SIGN) || (tmp->type == MAGIC_EAR))
638 if (adjust_sign_msg (pl, x, y, tmp) == -1)
639 {
640 tmp->destroy ();
641 return;
642 }
643
644 insert_ob_in_map_at (tmp, pl->map, floor, insert_flag, x, y);
645 if (connected)
646 tmp->add_link (pl->map, connected);
647
648 new_draw_info_format (NDI_UNIQUE, 0, pl, "You build the %s", query_name (tmp));
649 item->decrease ();
650 }
651
652 /**
653 * Item remover.
654 *
655 * Removes first buildable item, either under or above the floor
656 */
657 static void
658 apply_builder_remove (object *pl, int dir)
659 {
660 object *item;
661 int x, y;
662
663 x = pl->x + freearr_x[dir];
664 y = pl->y + freearr_y[dir];
665
666 /* Check square */
667 item = GET_MAP_OB (pl->map, x, y);
668 if (!item)
669 {
670 /* Should not happen with previous tests, but we never know */
671 new_draw_info (NDI_UNIQUE, 0, pl, "Invalid square.");
672 LOG (llevError, "apply_builder_remove: (null) square at (%d, %d, %s)\n", x, y, &pl->map->path);
673 return;
674 }
675
676 if (item->type == FLOOR || QUERY_FLAG (item, FLAG_IS_FLOOR))
677 item = item->above;
678
679 if (!item)
680 new_draw_info (NDI_UNIQUE, 0, pl, "Nothing to remove.");
681 else if (item->type == BUILDABLE_WALL)
682 new_draw_info (NDI_UNIQUE, 0, pl, "Can't remove a wall with that, build a floor.");
683 else if (!item->flag [FLAG_IS_BUILDABLE])
684 new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't remove the %s, it's not buildable!", query_name (item));
685 else
686 {
687 new_draw_info_format (NDI_UNIQUE, 0, pl, "You remove the %s", query_name (item));
688 item->destroy ();
689 }
690 }
691
692 /**
693 * Global building function
694 *
695 * This is the general map building function. Called when the player 'fires' a builder
696 * or remover object.
697 */
698 void
699 apply_map_builder (object *pl, int dir)
700 {
701 object *builder;
702 object *tmp;
703 object *tmp2;
704 int x, y;
705
706 if (!pl->type == PLAYER)
707 return;
708
709 /*if ( !player->map->unique )
710 {
711 new_draw_info( NDI_UNIQUE, 0, player, "You can't build outside a unique map." );
712 return;
713 } */
714
715 if (dir == 0)
716 {
717 new_draw_info (NDI_UNIQUE, 0, pl, "You can't build or destroy under yourself.");
718 return;
719 }
720
721 x = pl->x + freearr_x[dir];
722 y = pl->y + freearr_y[dir];
723
724 if ((1 > x) || (1 > y) || ((pl->map->width - 2) < x) || ((pl->map->height - 2) < y))
725 {
726 new_draw_info (NDI_UNIQUE, 0, pl, "Can't build on map edge...");
727 return;
728 }
729
730 /*
731 * Check specified square
732 * The square must have only buildable items
733 * Exception: marking runes are all right,
734 * since they are used for special things like connecting doors / buttons
735 */
736
737 tmp = GET_MAP_OB (pl->map, x, y);
738 if (!tmp)
739 {
740 /* Nothing, meaning player is standing next to an undefined square... */
741 LOG (llevError, "apply_map_builder: undefined square at (%d, %d, %s)\n", x, y, &pl->map->path);
742 new_draw_info (NDI_UNIQUE, 0, pl, "You'd better not build here, it looks weird.");
743 return;
744 }
745
746 tmp2 = find_marked_object (pl);
747 while (tmp)
748 {
749 if (!QUERY_FLAG (tmp, FLAG_IS_BUILDABLE) && (tmp->type != SIGN || tmp->arch->archname != shstr_rune_mark))
750 {
751 /* The item building function already has it's own special
752 * checks for this
753 */
754 if (!tmp2 || tmp2->subtype != ST_MAT_ITEM)
755 {
756 new_draw_info (NDI_UNIQUE, 0, pl, "You can't build here.");
757 return;
758 }
759 }
760
761 tmp = tmp->above;
762 }
763
764 /* Now we know the square is ok */
765 builder = pl->contr->ranged_ob;
766
767 if (builder->subtype == ST_BD_REMOVE)
768 /* Remover -> call specific function and bail out */
769 {
770 apply_builder_remove (pl, dir);
771 return;
772 }
773
774 if (builder->subtype == ST_BD_BUILD)
775 /*
776 * Builder.
777 * Find marked item to build, call specific function
778 */
779 {
780 tmp = tmp2;
781 if (!tmp)
782 {
783 new_draw_info (NDI_UNIQUE, 0, pl, "You need to mark raw materials to use.");
784 return;
785 }
786
787 if (tmp->type != MATERIAL)
788 {
789 new_draw_info (NDI_UNIQUE, 0, pl, "You can't use the marked item to build.");
790 return;
791 }
792
793 switch (tmp->subtype)
794 {
795 case ST_MAT_FLOOR:
796 apply_builder_floor (pl, tmp, x, y);
797 return;
798
799 case ST_MAT_WALL:
800 apply_builder_wall (pl, tmp, x, y);
801 return;
802
803 case ST_MAT_ITEM:
804 apply_builder_item (pl, tmp, x, y);
805 return;
806
807 default:
808 new_draw_info (NDI_UNIQUE, 0, pl, "Don't know how to apply this material, sorry.");
809 LOG (llevError, "apply_map_builder: invalid material subtype %d\n", tmp->subtype);
810 return;
811 }
812 }
813
814 /* Here, it means the builder has an invalid type */
815 new_draw_info (NDI_UNIQUE, 0, pl, "Don't know how to apply this tool, sorry.");
816 LOG (llevError, "apply_map_builder: invalid builder subtype %d\n", builder->subtype);
817 }
818