1 | /* |
1 | /* |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Crossfire TRT is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * (at your option) any later version. |
11 | * 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 Affero GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * and the GNU General Public License along with this program. If not, see |
|
|
20 | * <http://www.gnu.org/licenses/>. |
20 | * |
21 | * |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | #include <global.h> |
25 | #include <global.h> |
25 | #include <random_map.h> |
26 | #include <random_map.h> |
26 | #include <rproto.h> |
27 | #include <rproto.h> |
27 | |
28 | |
28 | /* Put in the walls and autojoin them. */ |
29 | /* Put in the walls and autojoin them. */ |
29 | |
30 | |
30 | |
|
|
31 | /* given a layout and a coordinate, tell me which squares up/down/right/left |
31 | /* given a maze and a coordinate, tell me which squares up/down/right/left |
32 | are occupied. */ |
32 | are occupied. */ |
33 | |
|
|
34 | int |
33 | int |
35 | surround_flag (char **layout, int i, int j, random_map_params *RP) |
34 | surround_flag (const layout &maze, int i, int j) |
36 | { |
35 | { |
37 | /* 1 = wall to left, |
36 | /* 1 = wall to left, |
38 | 2 = wall to right, |
37 | 2 = wall to right, |
39 | 4 = wall above |
38 | 4 = wall above |
40 | 8 = wall below */ |
39 | 8 = wall below */ |
41 | int surround_index = 0; |
40 | int surround_index = 0; |
42 | |
41 | |
43 | if ((i > 0) && layout[i - 1][j] != 0) |
42 | if (i > 0 && maze[i - 1][j] != 0) surround_index |= 1; |
44 | surround_index |= 1; |
43 | if (i < maze.w - 1 && maze[i + 1][j] != 0) surround_index |= 2; |
45 | if ((i < RP->Xsize - 1) && layout[i + 1][j] != 0) |
44 | if (j > 0 && maze[i][j - 1] != 0) surround_index |= 4; |
46 | surround_index |= 2; |
45 | if (j < maze.h - 1 && maze[i][j + 1] != 0) surround_index |= 8; |
47 | if ((j > 0) && layout[i][j - 1] != 0) |
46 | |
48 | surround_index |= 4; |
|
|
49 | if ((j < RP->Ysize - 1) && layout[i][j + 1] != 0) |
|
|
50 | surround_index |= 8; |
|
|
51 | return surround_index; |
47 | return surround_index; |
52 | } |
48 | } |
53 | |
49 | |
54 | |
|
|
55 | /* like surround_flag, but only walls count. |
50 | /* like surround_flag, but only walls count. */ |
56 | */ |
|
|
57 | |
|
|
58 | int |
51 | int |
59 | surround_flag2 (char **layout, int i, int j, random_map_params *RP) |
52 | surround_flag2 (const layout &maze, int i, int j) |
60 | { |
53 | { |
61 | /* 1 = wall to left, |
54 | /* 1 = wall to left, |
62 | 2 = wall to right, |
55 | 2 = wall to right, |
63 | 4 = wall above |
56 | 4 = wall above |
64 | 8 = wall below */ |
57 | 8 = wall below */ |
65 | int surround_index = 0; |
58 | int surround_index = 0; |
66 | |
59 | |
67 | if ((i > 0) && layout[i - 1][j] == '#') |
60 | if (i > 0 && maze[i - 1][j] == '#') surround_index |= 1; |
68 | surround_index |= 1; |
61 | if (i < maze.w - 1 && maze[i + 1][j] == '#') surround_index |= 2; |
69 | if ((i < RP->Xsize - 1) && layout[i + 1][j] == '#') |
62 | if (j > 0 && maze[i][j - 1] == '#') surround_index |= 4; |
70 | surround_index |= 2; |
63 | if (j < maze.h - 1 && maze[i][j + 1] == '#') surround_index |= 8; |
71 | if ((j > 0) && layout[i][j - 1] == '#') |
64 | |
72 | surround_index |= 4; |
|
|
73 | if ((j < RP->Ysize - 1) && layout[i][j + 1] == '#') |
|
|
74 | surround_index |= 8; |
|
|
75 | return surround_index; |
65 | return surround_index; |
76 | } |
66 | } |
77 | |
67 | |
78 | |
|
|
79 | /* like surround_flag, except it checks a map, not a layout. |
68 | /* like surround_flag, except it checks a map, not a maze. |
80 | * Since this is part of the random map code, presumption |
69 | * Since this is part of the random map code, presumption |
81 | * is that this is not a tiled map. |
70 | * is that this is not a tiled map. |
82 | * What is considered blocking and not is somewhat hard coded. |
71 | * What is considered blocking and not is somewhat hard coded. |
83 | */ |
72 | */ |
84 | int |
73 | int |
85 | surround_flag3 (maptile *map, sint16 i, sint16 j, random_map_params *RP) |
74 | surround_flag3 (maptile *map, int i, int j) |
86 | { |
75 | { |
87 | /* |
76 | /* |
88 | * 1 = blocked to left, |
77 | * 1 = blocked to left, |
89 | * 2 = blocked to right, |
78 | * 2 = blocked to right, |
90 | * 4 = blocked above |
79 | * 4 = blocked above |
91 | * 8 = blocked below |
80 | * 8 = blocked below |
92 | */ |
81 | */ |
93 | |
|
|
94 | int surround_index = 0; |
82 | int surround_index = 0; |
95 | |
83 | |
96 | // don't forget to update the mapspace! |
84 | // don't forget to update the mapspace! |
97 | if (i > 0) map->at (i - 1, j ).update (); |
85 | if (i > 0) map->at (i - 1, j ).update (); |
98 | if (i < RP->Xsize - 1) map->at (i + 1, j ).update (); |
86 | if (i < map->width - 1) map->at (i + 1, j ).update (); |
99 | if (j > 0) map->at (i , j - 1).update (); |
87 | if (j > 0) map->at (i , j - 1).update (); |
100 | if (j < RP->Ysize - 1) map->at (i , j + 1).update (); |
88 | if (j < map->height - 1) map->at (i , j + 1).update (); |
101 | |
89 | |
102 | if ((i > 0) && (GET_MAP_MOVE_BLOCK (map, i - 1, j) & MOVE_WALK)) |
90 | if (i > 0 && (GET_MAP_MOVE_BLOCK (map, i - 1, j) & MOVE_WALK)) surround_index |= 1; |
103 | surround_index |= 1; |
|
|
104 | if ((i < RP->Xsize - 1) && (GET_MAP_MOVE_BLOCK (map, i + 1, j) & MOVE_WALK)) |
91 | if (i < map->width - 1 && (GET_MAP_MOVE_BLOCK (map, i + 1, j) & MOVE_WALK)) surround_index |= 2; |
105 | surround_index |= 2; |
|
|
106 | if ((j > 0) && (GET_MAP_MOVE_BLOCK (map, i, j - 1) & MOVE_WALK)) |
92 | if (j > 0 && (GET_MAP_MOVE_BLOCK (map, i, j - 1) & MOVE_WALK)) surround_index |= 4; |
107 | surround_index |= 4; |
|
|
108 | if ((j < RP->Ysize - 1) && (GET_MAP_MOVE_BLOCK (map, i, j + 1) & MOVE_WALK)) |
93 | if (j < map->height - 1 && (GET_MAP_MOVE_BLOCK (map, i, j + 1) & MOVE_WALK)) surround_index |= 8; |
109 | surround_index |= 8; |
|
|
110 | |
94 | |
111 | return surround_index; |
95 | return surround_index; |
112 | } |
96 | } |
113 | |
97 | |
114 | /* like surround_flag2, except it checks a map, not a layout. */ |
98 | /* like surround_flag2, except it checks a map, not a maze. */ |
115 | |
99 | static int |
116 | int |
|
|
117 | surround_flag4 (maptile *map, int i, int j, random_map_params *RP) |
100 | surround_flag4 (maptile *map, int i, int j) |
118 | { |
101 | { |
119 | /* 1 = blocked to left, |
102 | /* 1 = blocked to left, |
120 | 2 = blocked to right, |
103 | 2 = blocked to right, |
121 | 4 = blocked above |
104 | 4 = blocked above |
122 | 8 = blocked below */ |
105 | 8 = blocked below */ |
123 | int surround_index = 0; |
106 | int surround_index = 0; |
124 | |
107 | |
125 | if ((i > 0) && wall_blocked (map, i - 1, j)) |
108 | if (i > 0 && wall_blocked (map, i - 1, j)) surround_index |= 1; |
126 | surround_index |= 1; |
109 | if (i < map->width - 1 && wall_blocked (map, i + 1, j)) surround_index |= 2; |
127 | if ((i < RP->Xsize - 1) && wall_blocked (map, i + 1, j)) |
110 | if (j > 0 && wall_blocked (map, i, j - 1)) surround_index |= 4; |
128 | surround_index |= 2; |
111 | if (j < map->height - 1 && wall_blocked (map, i, j + 1)) surround_index |= 8; |
129 | if ((j > 0) && wall_blocked (map, i, j - 1)) |
|
|
130 | surround_index |= 4; |
|
|
131 | if ((j < RP->Ysize - 1) && wall_blocked (map, i, j + 1)) |
|
|
132 | surround_index |= 8; |
|
|
133 | |
112 | |
134 | return surround_index; |
113 | return surround_index; |
135 | } |
114 | } |
136 | |
115 | |
|
|
116 | /* picks the right wall type for this square, to make it look nice, |
|
|
117 | and have everything nicely joined. It uses the maze. */ |
|
|
118 | static object * |
|
|
119 | pick_joined_wall (object *the_wall, const layout &maze, int i, int j, random_map_params *RP) |
|
|
120 | { |
|
|
121 | /* 1 = wall to left, |
|
|
122 | 2 = wall to right, |
|
|
123 | 4 = wall above |
|
|
124 | 8 = wall below */ |
|
|
125 | int surround_index = 0; |
|
|
126 | int l; |
|
|
127 | char wall_name[1024]; |
|
|
128 | archetype *wall_arch = 0; |
|
|
129 | |
|
|
130 | assign (wall_name, the_wall->arch->archname); |
|
|
131 | |
|
|
132 | /* conventionally, walls are named like this: |
|
|
133 | wallname_wallcode, where wallcode indicates |
|
|
134 | a joinedness, and wallname is the wall. |
|
|
135 | this code depends on the convention for |
|
|
136 | finding the right wall. */ |
|
|
137 | |
|
|
138 | /* extract the wall name, which is the text up to the leading _ */ |
|
|
139 | for (l = 0; l < 64; l++) |
|
|
140 | { |
|
|
141 | if (wall_name[l] == '_') |
|
|
142 | { |
|
|
143 | wall_name[l] = 0; |
|
|
144 | break; |
|
|
145 | } |
|
|
146 | } |
|
|
147 | |
|
|
148 | surround_index = surround_flag2 (maze, i, j); |
|
|
149 | |
|
|
150 | switch (surround_index) |
|
|
151 | { |
|
|
152 | case 0: |
|
|
153 | strcat (wall_name, "_0"); |
|
|
154 | break; |
|
|
155 | case 1: |
|
|
156 | strcat (wall_name, "_1_3"); |
|
|
157 | break; |
|
|
158 | case 2: |
|
|
159 | strcat (wall_name, "_1_4"); |
|
|
160 | break; |
|
|
161 | case 3: |
|
|
162 | strcat (wall_name, "_2_1_2"); |
|
|
163 | break; |
|
|
164 | case 4: |
|
|
165 | strcat (wall_name, "_1_2"); |
|
|
166 | break; |
|
|
167 | case 5: |
|
|
168 | strcat (wall_name, "_2_2_4"); |
|
|
169 | break; |
|
|
170 | case 6: |
|
|
171 | strcat (wall_name, "_2_2_1"); |
|
|
172 | break; |
|
|
173 | case 7: |
|
|
174 | strcat (wall_name, "_3_1"); |
|
|
175 | break; |
|
|
176 | case 8: |
|
|
177 | strcat (wall_name, "_1_1"); |
|
|
178 | break; |
|
|
179 | case 9: |
|
|
180 | strcat (wall_name, "_2_2_3"); |
|
|
181 | break; |
|
|
182 | case 10: |
|
|
183 | strcat (wall_name, "_2_2_2"); |
|
|
184 | break; |
|
|
185 | case 11: |
|
|
186 | strcat (wall_name, "_3_3"); |
|
|
187 | break; |
|
|
188 | case 12: |
|
|
189 | strcat (wall_name, "_2_1_1"); |
|
|
190 | break; |
|
|
191 | case 13: |
|
|
192 | strcat (wall_name, "_3_4"); |
|
|
193 | break; |
|
|
194 | case 14: |
|
|
195 | strcat (wall_name, "_3_2"); |
|
|
196 | break; |
|
|
197 | case 15: |
|
|
198 | strcat (wall_name, "_4"); |
|
|
199 | break; |
|
|
200 | } |
|
|
201 | wall_arch = archetype::find (wall_name); |
|
|
202 | |
|
|
203 | return wall_arch ? wall_arch->instance () : the_wall->arch->instance (); |
|
|
204 | } |
|
|
205 | |
137 | /* takes a map and a layout, and puts walls in the map (picked from |
206 | /* takes a map and a maze, and puts walls in the map (picked from |
138 | w_style) at '#' marks. */ |
207 | w_style) at '#' marks. */ |
139 | |
|
|
140 | void |
208 | void |
141 | make_map_walls (maptile *map, char **layout, char *w_style, random_map_params *RP) |
209 | make_map_walls (maptile *map, layout &maze, const char *w_style, const char *m_style, random_map_params *RP) |
142 | { |
210 | { |
143 | char styledirname[1024]; |
|
|
144 | char stylefilepath[1024]; |
|
|
145 | maptile *style_map = 0; |
|
|
146 | object *the_wall; |
211 | object *the_wall; |
147 | |
212 | |
148 | /* get the style map */ |
213 | /* get the style map */ |
149 | if (!strcmp (w_style, "none")) |
214 | if (!strcmp (w_style, "none")) |
150 | return; |
215 | return; |
151 | sprintf (styledirname, "%s", "/styles/wallstyles"); |
216 | |
152 | sprintf (stylefilepath, "%s/%s", styledirname, w_style); |
217 | maptile *style_map = find_style ("/styles/wallstyles", w_style, RP->difficulty); |
153 | style_map = find_style (styledirname, w_style, -1); |
|
|
154 | if (!style_map) |
218 | if (!style_map) |
155 | return; |
219 | return; |
156 | |
220 | |
157 | /* fill up the map with the given floor style */ |
221 | maptile *mining_map = m_style && *m_style |
|
|
222 | ? find_style ("/styles/miningstyles", m_style, RP->difficulty) |
|
|
223 | : 0; |
|
|
224 | |
158 | if ((the_wall = style_map->pick_random_object ())) |
225 | if ((the_wall = style_map->pick_random_object (rmg_rndm))) |
159 | { |
226 | { |
160 | int i, j; |
227 | int i, j; |
161 | char *cp; |
228 | char *cp; |
162 | int joinedwalls = 0; |
229 | int joinedwalls = 0; |
163 | object *thiswall; |
230 | object *thiswall; |
… | |
… | |
170 | } |
237 | } |
171 | |
238 | |
172 | for (i = 0; i < RP->Xsize; i++) |
239 | for (i = 0; i < RP->Xsize; i++) |
173 | for (j = 0; j < RP->Ysize; j++) |
240 | for (j = 0; j < RP->Ysize; j++) |
174 | { |
241 | { |
175 | if (layout[i][j] == '#') |
242 | if (maze[i][j] == '#') |
176 | { |
243 | { |
177 | if (joinedwalls) |
244 | if (joinedwalls) |
178 | thiswall = pick_joined_wall (the_wall, layout, i, j, RP); |
245 | thiswall = pick_joined_wall (the_wall, maze, i, j, RP); |
179 | else |
246 | else |
180 | thiswall = arch_to_object (the_wall->arch); |
247 | thiswall = the_wall->arch->instance (); |
181 | thiswall->x = i; |
248 | |
182 | thiswall->y = j; |
|
|
183 | thiswall->move_block = MOVE_ALL; |
249 | thiswall->move_block = MOVE_ALL; |
184 | insert_ob_in_map (thiswall, map, thiswall, INS_NO_MERGE | INS_NO_WALK_ON); |
250 | map->insert (thiswall, i, j, thiswall, INS_NO_MERGE | INS_NO_WALK_ON); |
|
|
251 | |
|
|
252 | if (mining_map) |
|
|
253 | if (object *vein = mining_map->at (rmg_rndm (mining_map->width), rmg_rndm (mining_map->height)).bot) |
|
|
254 | map->insert (vein->clone (), i, j, thiswall, INS_NO_MERGE | INS_NO_WALK_ON); |
185 | } |
255 | } |
186 | } |
256 | } |
187 | } |
257 | } |
188 | } |
258 | } |
189 | |
|
|
190 | |
|
|
191 | /* picks the right wall type for this square, to make it look nice, |
|
|
192 | and have everything nicely joined. It uses the layout. */ |
|
|
193 | |
|
|
194 | object * |
|
|
195 | pick_joined_wall (object *the_wall, char **layout, int i, int j, random_map_params *RP) |
|
|
196 | { |
|
|
197 | /* 1 = wall to left, |
|
|
198 | 2 = wall to right, |
|
|
199 | 4 = wall above |
|
|
200 | 8 = wall below */ |
|
|
201 | int surround_index = 0; |
|
|
202 | int l; |
|
|
203 | char wall_name[1024]; |
|
|
204 | archetype *wall_arch = 0; |
|
|
205 | |
|
|
206 | assign (wall_name, the_wall->arch->archname); |
|
|
207 | |
|
|
208 | /* conventionally, walls are named like this: |
|
|
209 | wallname_wallcode, where wallcode indicates |
|
|
210 | a joinedness, and wallname is the wall. |
|
|
211 | this code depends on the convention for |
|
|
212 | finding the right wall. */ |
|
|
213 | |
|
|
214 | /* extract the wall name, which is the text up to the leading _ */ |
|
|
215 | for (l = 0; l < 64; l++) |
|
|
216 | { |
|
|
217 | if (wall_name[l] == '_') |
|
|
218 | { |
|
|
219 | wall_name[l] = 0; |
|
|
220 | break; |
|
|
221 | } |
|
|
222 | } |
|
|
223 | |
|
|
224 | surround_index = surround_flag2 (layout, i, j, RP); |
|
|
225 | |
|
|
226 | switch (surround_index) |
|
|
227 | { |
|
|
228 | case 0: |
|
|
229 | strcat (wall_name, "_0"); |
|
|
230 | break; |
|
|
231 | case 1: |
|
|
232 | strcat (wall_name, "_1_3"); |
|
|
233 | break; |
|
|
234 | case 2: |
|
|
235 | strcat (wall_name, "_1_4"); |
|
|
236 | break; |
|
|
237 | case 3: |
|
|
238 | strcat (wall_name, "_2_1_2"); |
|
|
239 | break; |
|
|
240 | case 4: |
|
|
241 | strcat (wall_name, "_1_2"); |
|
|
242 | break; |
|
|
243 | case 5: |
|
|
244 | strcat (wall_name, "_2_2_4"); |
|
|
245 | break; |
|
|
246 | case 6: |
|
|
247 | strcat (wall_name, "_2_2_1"); |
|
|
248 | break; |
|
|
249 | case 7: |
|
|
250 | strcat (wall_name, "_3_1"); |
|
|
251 | break; |
|
|
252 | case 8: |
|
|
253 | strcat (wall_name, "_1_1"); |
|
|
254 | break; |
|
|
255 | case 9: |
|
|
256 | strcat (wall_name, "_2_2_3"); |
|
|
257 | break; |
|
|
258 | case 10: |
|
|
259 | strcat (wall_name, "_2_2_2"); |
|
|
260 | break; |
|
|
261 | case 11: |
|
|
262 | strcat (wall_name, "_3_3"); |
|
|
263 | break; |
|
|
264 | case 12: |
|
|
265 | strcat (wall_name, "_2_1_1"); |
|
|
266 | break; |
|
|
267 | case 13: |
|
|
268 | strcat (wall_name, "_3_4"); |
|
|
269 | break; |
|
|
270 | case 14: |
|
|
271 | strcat (wall_name, "_3_2"); |
|
|
272 | break; |
|
|
273 | case 15: |
|
|
274 | strcat (wall_name, "_4"); |
|
|
275 | break; |
|
|
276 | } |
|
|
277 | wall_arch = archetype::find (wall_name); |
|
|
278 | |
|
|
279 | return wall_arch ? arch_to_object (wall_arch) : arch_to_object (the_wall->arch); |
|
|
280 | } |
|
|
281 | |
|
|
282 | |
259 | |
283 | /* this takes a map, and changes an existing wall to match what's blocked |
260 | /* this takes a map, and changes an existing wall to match what's blocked |
284 | * around it, counting only doors and walls as blocked. If insert_flag is |
261 | * around it, counting only doors and walls as blocked. If insert_flag is |
285 | * 1, it will go ahead and insert the wall into the map. If not, it |
262 | * 1, it will go ahead and insert the wall into the map. If not, it |
286 | * will only return the wall which would belong there, and doesn't |
263 | * will only return the wall which would belong there, and doesn't |
287 | * remove anything. It depends on the |
264 | * remove anything. It depends on the |
288 | * global, previously-set variable, "wall_name" |
265 | * global, previously-set variable, "wall_name" |
289 | */ |
266 | */ |
290 | |
|
|
291 | object * |
267 | object * |
292 | retrofit_joined_wall (maptile *the_map, int i, int j, int insert_flag, random_map_params *RP) |
268 | retrofit_joined_wall (maptile *the_map, int i, int j, int insert_flag, random_map_params *RP) |
293 | { |
269 | { |
294 | /* 1 = wall to left, |
270 | /* 1 = wall to left, |
295 | * 2 = wall to right, |
271 | * 2 = wall to right, |
… | |
… | |
331 | RP->wall_name[l] = 0; |
307 | RP->wall_name[l] = 0; |
332 | break; |
308 | break; |
333 | } |
309 | } |
334 | } |
310 | } |
335 | |
311 | |
336 | surround_index = surround_flag4 (the_map, i, j, RP); |
312 | surround_index = surround_flag4 (the_map, i, j); |
337 | /* This would be a lot cleaner to just us a lookup table, |
313 | /* This would be a lot cleaner to just us a lookup table, |
338 | * eg, wall_suffix[surround_index] |
314 | * eg, wall_suffix[surround_index] |
339 | */ |
315 | */ |
340 | switch (surround_index) |
316 | switch (surround_index) |
341 | { |
317 | { |
… | |
… | |
391 | |
367 | |
392 | wall_arch = archetype::find (RP->wall_name); |
368 | wall_arch = archetype::find (RP->wall_name); |
393 | |
369 | |
394 | if (!wall_arch) |
370 | if (!wall_arch) |
395 | { |
371 | { |
396 | new_wall = arch_to_object (wall_arch); |
372 | new_wall = wall_arch->instance (); |
397 | new_wall->x = i; |
373 | new_wall->x = i; |
398 | new_wall->y = j; |
374 | new_wall->y = j; |
399 | |
375 | |
400 | if (the_wall && the_wall->map) |
376 | if (the_wall && the_wall->map) |
401 | { |
|
|
402 | the_wall->remove (); |
|
|
403 | the_wall->destroy (); |
377 | the_wall->destroy (); |
404 | } |
|
|
405 | |
378 | |
406 | the_wall->move_block = MOVE_ALL; |
379 | the_wall->move_block = MOVE_ALL; |
407 | insert_ob_in_map (new_wall, the_map, new_wall, INS_NO_MERGE | INS_NO_WALK_ON); |
380 | insert_ob_in_map (new_wall, the_map, new_wall, INS_NO_MERGE | INS_NO_WALK_ON); |
408 | } |
381 | } |
409 | |
382 | |