ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/build_map.C
Revision: 1.47
Committed: Sun Nov 29 17:41:08 2009 UTC (14 years, 5 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_92, rel-2_93
Changes since 1.46: +6 -6 lines
Log Message:
-instance, some los fiddling

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