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.22 by pippijn, Mon Jan 15 21:06:19 2007 UTC vs.
Revision 1.28 by root, Sun Jul 1 05:00:19 2007 UTC

1/* 1/*
2 * CrossFire, A Multiplayer game for X-windows 2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT 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 * Crossfire TRT 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 <crossfire@schmorp.de>
23 */ 22 */
24 23
25#include <global.h> 24#include <global.h>
26#include <living.h> 25#include <living.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 (strcmp (ob->arch->archname, "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:
84 rune = GET_MAP_OB (map, x, y); 83 rune = GET_MAP_OB (map, x, y);
85 while (rune) 84 while (rune)
86 { 85 {
87 next = rune->above; 86 next = rune->above;
88 87
89 if ((rune->type == SIGN) && (!strcmp (rune->arch->name, "rune_mark"))) 88 if ((rune->type == SIGN) && (!strcmp (rune->arch->archname, "rune_mark")))
90 rune->destroy (); 89 rune->destroy ();
91 90
92 rune = next; 91 rune = next;
93 } 92 }
94} 93}
146 } 145 }
147 146
148 /* Now, find force in player's inventory */ 147 /* Now, find force in player's inventory */
149 force = pl->inv; 148 force = pl->inv;
150 while (force 149 while (force
151 && ((force->type != FORCE) || (!force->slaying) || (strcmp (force->slaying, pl->map->path)) || (!force->msg) 150 && ((force->type != FORCE) || !force->slaying || force->slaying != pl->map->path || !force->msg
152 || (strcmp (force->msg, rune->msg)))) 151 || force->msg != rune->msg))
153 force = force->below; 152 force = force->below;
154 153
155 if (!force) 154 if (!force)
156 /* No force, need to create & insert one */ 155 /* No force, need to create & insert one */
157 { 156 {
184get_connection_rune (object *pl, short x, short y) 183get_connection_rune (object *pl, short x, short y)
185{ 184{
186 object *rune; 185 object *rune;
187 186
188 rune = GET_MAP_OB (pl->map, x, y); 187 rune = GET_MAP_OB (pl->map, x, y);
189 while (rune && ((rune->type != SIGN) || (strcmp (rune->arch->name, "rune_mark")))) 188 while (rune && ((rune->type != SIGN) || (strcmp (rune->arch->archname, "rune_mark"))))
190 rune = rune->above; 189 rune = rune->above;
191 return rune; 190 return rune;
192} 191}
193 192
194/** 193/**
245 if (!wall) 244 if (!wall)
246 /* Nothing -> bail out */ 245 /* Nothing -> bail out */
247 return; 246 return;
248 247
249 /* Find base name */ 248 /* Find base name */
250 strcpy (archetype, wall->arch->name); 249 assign (archetype, wall->arch->archname);
251 underscore = strchr (archetype, '_'); 250 underscore = strchr (archetype, '_');
252 251
253 /* search for the first _ before a number */ 252 /* search for the first _ before a number */
254 while (underscore && !isdigit (*(underscore + 1))) 253 while (underscore && !isdigit (*(underscore + 1)))
255 underscore = strchr (underscore + 1, '_'); 254 underscore = strchr (underscore + 1, '_');
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 && strcmp (tmp->arch->archname, "magic_mouth"))
645 break; 644 break;
646 con_rune = get_connection_rune (pl, x, y); 645 con_rune = get_connection_rune (pl, x, y);
647 connected = find_or_create_connection_for_map (pl, x, y, con_rune); 646 connected = find_or_create_connection_for_map (pl, x, y, con_rune);
648 if (connected == -1) 647 if (connected == -1)
649 { 648 {
764 /* Nothing, meaning player is standing next to an undefined square... */ 763 /* 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); 764 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."); 765 new_draw_info (NDI_UNIQUE, 0, pl, "You'd better not build here, it looks weird.");
767 return; 766 return;
768 } 767 }
768
769 tmp2 = find_marked_object (pl); 769 tmp2 = find_marked_object (pl);
770 while (tmp) 770 while (tmp)
771 { 771 {
772 if (!QUERY_FLAG (tmp, FLAG_IS_BUILDABLE) && ((tmp->type != SIGN) || (strcmp (tmp->arch->name, "rune_mark")))) 772 if (!QUERY_FLAG (tmp, FLAG_IS_BUILDABLE) && ((tmp->type != SIGN) || (strcmp (tmp->arch->archname, "rune_mark"))))
773 { 773 {
774 /* The item building function already has it's own special 774 /* The item building function already has it's own special
775 * checks for this 775 * checks for this
776 */ 776 */
777 if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM)) 777 if ((!tmp2) || (tmp2->subtype != ST_MAT_ITEM))
782 } 782 }
783 tmp = tmp->above; 783 tmp = tmp->above;
784 } 784 }
785 785
786 /* Now we know the square is ok */ 786 /* Now we know the square is ok */
787 builder = pl->contr->ranges[range_builder]; 787 builder = pl->contr->ranged_ob;
788 788
789 if (builder->subtype == ST_BD_REMOVE) 789 if (builder->subtype == ST_BD_REMOVE)
790 /* Remover -> call specific function and bail out */ 790 /* Remover -> call specific function and bail out */
791 { 791 {
792 apply_builder_remove (pl, dir); 792 apply_builder_remove (pl, dir);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines