… | |
… | |
217 | EXIT_PATH (tmp) = op->contr->savebed_map; |
217 | EXIT_PATH (tmp) = op->contr->savebed_map; |
218 | EXIT_X (tmp) = op->contr->bed_x; |
218 | EXIT_X (tmp) = op->contr->bed_x; |
219 | EXIT_Y (tmp) = op->contr->bed_y; |
219 | EXIT_Y (tmp) = op->contr->bed_y; |
220 | enter_exit (op, tmp); |
220 | enter_exit (op, tmp); |
221 | } |
221 | } |
222 | free_object (tmp); |
222 | tmp->destroy (0); |
223 | } |
223 | } |
224 | |
224 | |
225 | /* All this really is is a glorified remove_object that also updates |
225 | /* All this really is is a glorified remove_object that also updates |
226 | * the counts on the map if needed. |
226 | * the counts on the map if needed. |
227 | */ |
227 | */ |
228 | void |
228 | void |
229 | leave_map (object *op) |
229 | leave_map (object *op) |
230 | { |
230 | { |
231 | maptile *oldmap = op->map; |
231 | maptile *oldmap = op->map; |
232 | |
232 | |
233 | remove_ob (op); |
233 | op->remove (); |
234 | |
234 | |
235 | if (oldmap) |
235 | if (oldmap) |
236 | { |
236 | { |
237 | if (!op->contr->hidden) |
237 | if (!op->contr->hidden) |
238 | oldmap->players--; |
238 | oldmap->players--; |
… | |
… | |
311 | return; |
311 | return; |
312 | |
312 | |
313 | /* If it is a player login, he has yet to be inserted anyplace. |
313 | /* If it is a player login, he has yet to be inserted anyplace. |
314 | * otherwise, we need to deal with removing the player here. |
314 | * otherwise, we need to deal with removing the player here. |
315 | */ |
315 | */ |
316 | remove_ob (op); |
316 | op->remove (); |
317 | |
317 | |
318 | /* remove_ob clears these so they must be reset after the remove_ob call */ |
318 | /* remove_ob clears these so they must be reset after the remove_ob call */ |
319 | op->x = x; |
319 | op->x = x; |
320 | op->y = y; |
320 | op->y = y; |
321 | op->map = newmap; |
321 | op->map = newmap; |
… | |
… | |
338 | if (op->type == PLAYER && op->contr->ranges[range_golem] != NULL) |
338 | if (op->type == PLAYER && op->contr->ranges[range_golem] != NULL) |
339 | { |
339 | { |
340 | int i = find_free_spot (op->contr->ranges[range_golem], newmap, |
340 | int i = find_free_spot (op->contr->ranges[range_golem], newmap, |
341 | x, y, 1, SIZEOFFREE); |
341 | x, y, 1, SIZEOFFREE); |
342 | |
342 | |
343 | remove_ob (op->contr->ranges[range_golem]); |
343 | op->contr->ranges[range_golem]->remove (); |
344 | |
344 | |
345 | if (i == -1) |
345 | if (i == -1) |
346 | { |
346 | { |
347 | remove_friendly_object (op->contr->ranges[range_golem]); |
347 | remove_friendly_object (op->contr->ranges[range_golem]); |
348 | free_object (op->contr->ranges[range_golem]); |
348 | op->contr->ranges[range_golem]->destroy (0); |
349 | op->contr->ranges[range_golem] = 0; |
349 | op->contr->ranges[range_golem] = 0; |
350 | } |
350 | } |
351 | else |
351 | else |
352 | { |
352 | { |
353 | for (object *tmp = op->contr->ranges[range_golem]; tmp != NULL; tmp = tmp->more) |
353 | for (object *tmp = op->contr->ranges[range_golem]; tmp != NULL; tmp = tmp->more) |
… | |
… | |
892 | if (tmp->type == FORCE && tmp->slaying && !strcmp (tmp->slaying, PORTAL_DESTINATION_NAME)) |
892 | if (tmp->type == FORCE && tmp->slaying && !strcmp (tmp->slaying, PORTAL_DESTINATION_NAME)) |
893 | break; |
893 | break; |
894 | } |
894 | } |
895 | if (tmp) |
895 | if (tmp) |
896 | { |
896 | { |
897 | remove_ob (tmp); |
897 | tmp->remove (); |
898 | free_object (tmp); |
898 | tmp->destroy (0); |
899 | } |
899 | } |
900 | |
900 | |
901 | strcpy (op->contr->savebed_map, path_combine_and_normalize (exit_ob->map->path, EXIT_PATH (exit_ob))); |
901 | strcpy (op->contr->savebed_map, path_combine_and_normalize (exit_ob->map->path, EXIT_PATH (exit_ob))); |
902 | op->contr->bed_x = EXIT_X (exit_ob), op->contr->bed_y = EXIT_Y (exit_ob); |
902 | op->contr->bed_x = EXIT_X (exit_ob), op->contr->bed_y = EXIT_Y (exit_ob); |
903 | save_player (op, 1); |
903 | save_player (op, 1); |
… | |
… | |
1155 | { |
1155 | { |
1156 | LOG (llevError, "BUG: process_events(): Removed object on list\n"); |
1156 | LOG (llevError, "BUG: process_events(): Removed object on list\n"); |
1157 | char *dump = dump_object (op); |
1157 | char *dump = dump_object (op); |
1158 | LOG (llevError, dump); |
1158 | LOG (llevError, dump); |
1159 | free (dump); |
1159 | free (dump); |
1160 | free_object (op); |
1160 | op->destroy (0); |
1161 | continue; |
1161 | continue; |
1162 | } |
1162 | } |
1163 | |
1163 | |
1164 | if (!op->speed) |
1164 | if (!op->speed) |
1165 | { |
1165 | { |