ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/wall.C
(Generate patch)

Comparing deliantra/server/random_maps/wall.C (file contents):
Revision 1.16 by pippijn, Mon Jan 15 21:06:19 2007 UTC vs.
Revision 1.23 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) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,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 at <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 <random_map.h> 25#include <random_map.h>
27#include <rproto.h> 26#include <rproto.h>
92 * 8 = blocked below 91 * 8 = blocked below
93 */ 92 */
94 93
95 int surround_index = 0; 94 int surround_index = 0;
96 95
96 // don't forget to update the mapspace!
97 if (i > 0) map->at (i - 1, j ).update ();
98 if (i < RP->Xsize - 1) map->at (i + 1, j ).update ();
99 if (j > 0) map->at (i , j - 1).update ();
100 if (j < RP->Ysize - 1) map->at (i , j + 1).update ();
101
97 if ((i > 0) && (GET_MAP_MOVE_BLOCK (map, i - 1, j) & ~MOVE_BLOCK_DEFAULT)) 102 if ((i > 0) && (GET_MAP_MOVE_BLOCK (map, i - 1, j) & MOVE_WALK))
98 surround_index |= 1; 103 surround_index |= 1;
99 if ((i < RP->Xsize - 1) && (GET_MAP_MOVE_BLOCK (map, i + 1, j) & ~MOVE_BLOCK_DEFAULT)) 104 if ((i < RP->Xsize - 1) && (GET_MAP_MOVE_BLOCK (map, i + 1, j) & MOVE_WALK))
100 surround_index |= 2; 105 surround_index |= 2;
101 if ((j > 0) && (GET_MAP_MOVE_BLOCK (map, i, j - 1) & ~MOVE_BLOCK_DEFAULT)) 106 if ((j > 0) && (GET_MAP_MOVE_BLOCK (map, i, j - 1) & MOVE_WALK))
102 surround_index |= 4; 107 surround_index |= 4;
103 if ((j < RP->Ysize - 1) && (GET_MAP_MOVE_BLOCK (map, i, j + 1) & ~MOVE_BLOCK_DEFAULT)) 108 if ((j < RP->Ysize - 1) && (GET_MAP_MOVE_BLOCK (map, i, j + 1) & MOVE_WALK))
104 surround_index |= 8; 109 surround_index |= 8;
105 110
106 return surround_index; 111 return surround_index;
107} 112}
108 113
144 if (!strcmp (w_style, "none")) 149 if (!strcmp (w_style, "none"))
145 return; 150 return;
146 sprintf (styledirname, "%s", "/styles/wallstyles"); 151 sprintf (styledirname, "%s", "/styles/wallstyles");
147 sprintf (stylefilepath, "%s/%s", styledirname, w_style); 152 sprintf (stylefilepath, "%s/%s", styledirname, w_style);
148 style_map = find_style (styledirname, w_style, -1); 153 style_map = find_style (styledirname, w_style, -1);
149 if (style_map == 0) 154 if (!style_map)
150 return; 155 return;
151 156
152 /* fill up the map with the given floor style */ 157 /* fill up the map with the given floor style */
153 if ((the_wall = pick_random_object (style_map)) != NULL) 158 if ((the_wall = style_map->pick_random_object ()))
154 { 159 {
155 int i, j; 160 int i, j;
156 char *cp; 161 char *cp;
157 int joinedwalls = 0; 162 int joinedwalls = 0;
158 object *thiswall; 163 object *thiswall;
159 164
160 sprintf (RP->wall_name, "%s", &the_wall->arch->name); 165 sprintf (RP->wall_name, "%s", &the_wall->arch->archname);
161 if ((cp = strchr (RP->wall_name, '_')) != NULL) 166 if ((cp = strchr (RP->wall_name, '_')) != NULL)
162 { 167 {
163 *cp = 0; 168 *cp = 0;
164 joinedwalls = 1; 169 joinedwalls = 1;
165 } 170 }
196 int surround_index = 0; 201 int surround_index = 0;
197 int l; 202 int l;
198 char wall_name[1024]; 203 char wall_name[1024];
199 archetype *wall_arch = 0; 204 archetype *wall_arch = 0;
200 205
201 strcpy (wall_name, the_wall->arch->name); 206 assign (wall_name, the_wall->arch->archname);
202 207
203 /* conventionally, walls are named like this: 208 /* conventionally, walls are named like this:
204 wallname_wallcode, where wallcode indicates 209 wallname_wallcode, where wallcode indicates
205 a joinedness, and wallname is the wall. 210 a joinedness, and wallname is the wall.
206 this code depends on the convention for 211 this code depends on the convention for

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines