… | |
… | |
217 | } |
217 | } |
218 | |
218 | |
219 | return 0; |
219 | return 0; |
220 | } |
220 | } |
221 | |
221 | |
222 | /* When the map is loaded, load_object does not actually insert objects |
|
|
223 | * into inventory, but just links them. What this does is go through |
|
|
224 | * and insert them properly. |
|
|
225 | * The object 'container' is the object that contains the inventory. |
|
|
226 | * This is needed so that we can update the containers weight. |
|
|
227 | */ |
|
|
228 | static void |
|
|
229 | fix_container (object *container) |
|
|
230 | { |
|
|
231 | object *tmp = container->inv, *next; |
|
|
232 | |
|
|
233 | container->inv = 0; |
|
|
234 | while (tmp) |
|
|
235 | { |
|
|
236 | next = tmp->below; |
|
|
237 | if (tmp->inv) |
|
|
238 | fix_container (tmp); |
|
|
239 | |
|
|
240 | insert_ob_in_ob (tmp, container); |
|
|
241 | tmp = next; |
|
|
242 | } |
|
|
243 | |
|
|
244 | // go through and calculate what all the containers are carrying. |
|
|
245 | //TODO: remove |
|
|
246 | container->update_weight (); |
|
|
247 | } |
|
|
248 | |
|
|
249 | //-GPL |
222 | //-GPL |
250 | |
223 | |
251 | void |
224 | void |
252 | maptile::set_object_flag (int flag, int value) |
225 | maptile::set_object_flag (int flag, int value) |
253 | { |
226 | { |
… | |
… | |
268 | set_object_flag (FLAG_OBJ_ORIGINAL); |
241 | set_object_flag (FLAG_OBJ_ORIGINAL); |
269 | |
242 | |
270 | for (mapspace *ms = spaces + size (); ms-- > spaces; ) |
243 | for (mapspace *ms = spaces + size (); ms-- > spaces; ) |
271 | for (object *tmp = ms->bot; tmp; tmp = tmp->above) |
244 | for (object *tmp = ms->bot; tmp; tmp = tmp->above) |
272 | INVOKE_OBJECT (RESET, tmp); |
245 | INVOKE_OBJECT (RESET, tmp); |
|
|
246 | } |
|
|
247 | |
|
|
248 | void |
|
|
249 | maptile::post_load () |
|
|
250 | { |
|
|
251 | #if 0 |
|
|
252 | if (!spaces) |
|
|
253 | return; |
|
|
254 | |
|
|
255 | for (mapspace *ms = spaces + size (); ms-- > spaces; ) |
|
|
256 | for (object *tmp = ms->bot; tmp; tmp = tmp->above) |
|
|
257 | ; // nop |
|
|
258 | #endif |
273 | } |
259 | } |
274 | |
260 | |
275 | //+GPL |
261 | //+GPL |
276 | |
262 | |
277 | /* link_multipart_objects go through all the objects on the map looking |
263 | /* link_multipart_objects go through all the objects on the map looking |