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.15 by pippijn, Sat Jan 6 14:42:30 2007 UTC vs.
Revision 1.23 by root, Sun Jul 1 05:00:19 2007 UTC

1
2/* 1/*
3 CrossFire, A Multiplayer game for X-windows 2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
4 3 *
5 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
6 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
7 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
8 7 *
9 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
10 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
11 the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 11 * (at your option) any later version.
13 12 *
14 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,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details. 16 * GNU General Public License for more details.
18 17 *
19 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
20 along with this program; if not, write to the Free Software 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 *
22
23 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>
24*/ 22 */
25 23
26#include <global.h> 24#include <global.h>
27#include <random_map.h> 25#include <random_map.h>
28#include <rproto.h> 26#include <rproto.h>
29 27
93 * 8 = blocked below 91 * 8 = blocked below
94 */ 92 */
95 93
96 int surround_index = 0; 94 int surround_index = 0;
97 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
98 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))
99 surround_index |= 1; 103 surround_index |= 1;
100 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))
101 surround_index |= 2; 105 surround_index |= 2;
102 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))
103 surround_index |= 4; 107 surround_index |= 4;
104 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))
105 surround_index |= 8; 109 surround_index |= 8;
106 110
107 return surround_index; 111 return surround_index;
108} 112}
109 113
145 if (!strcmp (w_style, "none")) 149 if (!strcmp (w_style, "none"))
146 return; 150 return;
147 sprintf (styledirname, "%s", "/styles/wallstyles"); 151 sprintf (styledirname, "%s", "/styles/wallstyles");
148 sprintf (stylefilepath, "%s/%s", styledirname, w_style); 152 sprintf (stylefilepath, "%s/%s", styledirname, w_style);
149 style_map = find_style (styledirname, w_style, -1); 153 style_map = find_style (styledirname, w_style, -1);
150 if (style_map == 0) 154 if (!style_map)
151 return; 155 return;
152 156
153 /* fill up the map with the given floor style */ 157 /* fill up the map with the given floor style */
154 if ((the_wall = pick_random_object (style_map)) != NULL) 158 if ((the_wall = style_map->pick_random_object ()))
155 { 159 {
156 int i, j; 160 int i, j;
157 char *cp; 161 char *cp;
158 int joinedwalls = 0; 162 int joinedwalls = 0;
159 object *thiswall; 163 object *thiswall;
160 164
161 sprintf (RP->wall_name, "%s", &the_wall->arch->name); 165 sprintf (RP->wall_name, "%s", &the_wall->arch->archname);
162 if ((cp = strchr (RP->wall_name, '_')) != NULL) 166 if ((cp = strchr (RP->wall_name, '_')) != NULL)
163 { 167 {
164 *cp = 0; 168 *cp = 0;
165 joinedwalls = 1; 169 joinedwalls = 1;
166 } 170 }
197 int surround_index = 0; 201 int surround_index = 0;
198 int l; 202 int l;
199 char wall_name[1024]; 203 char wall_name[1024];
200 archetype *wall_arch = 0; 204 archetype *wall_arch = 0;
201 205
202 strcpy (wall_name, the_wall->arch->name); 206 assign (wall_name, the_wall->arch->archname);
203 207
204 /* conventionally, walls are named like this: 208 /* conventionally, walls are named like this:
205 wallname_wallcode, where wallcode indicates 209 wallname_wallcode, where wallcode indicates
206 a joinedness, and wallname is the wall. 210 a joinedness, and wallname is the wall.
207 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