… | |
… | |
121 | * ok - the caller will deal with actual object removal/insertion |
121 | * ok - the caller will deal with actual object removal/insertion |
122 | */ |
122 | */ |
123 | if (op->head) |
123 | if (op->head) |
124 | return 1; |
124 | return 1; |
125 | |
125 | |
126 | remove_ob (op); |
126 | op->remove (); |
127 | |
127 | |
128 | /* we already have newx, newy, and m, so lets use them. |
128 | /* we already have newx, newy, and m, so lets use them. |
129 | * In addition, this fixes potential crashes, because multipart object was |
129 | * In addition, this fixes potential crashes, because multipart object was |
130 | * on edge of map, +=x, +=y doesn't make correct coordinates. |
130 | * on edge of map, +=x, +=y doesn't make correct coordinates. |
131 | */ |
131 | */ |
… | |
… | |
169 | if (i == -1) |
169 | if (i == -1) |
170 | return 0; /* No free spot */ |
170 | return 0; /* No free spot */ |
171 | |
171 | |
172 | if (op->head != NULL) |
172 | if (op->head != NULL) |
173 | op = op->head; |
173 | op = op->head; |
174 | remove_ob (op); |
174 | op->remove (); |
175 | for (tmp = op; tmp != NULL; tmp = tmp->more) |
175 | for (tmp = op; tmp != NULL; tmp = tmp->more) |
176 | tmp->x = x + freearr_x[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x), |
176 | tmp->x = x + freearr_x[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x), |
177 | tmp->y = y + freearr_y[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.y); |
177 | tmp->y = y + freearr_y[i] + (tmp->arch == NULL ? 0 : tmp->arch->clone.y); |
178 | |
178 | |
179 | tmp = insert_ob_in_map (op, op->map, originator, 0); |
179 | tmp = insert_ob_in_map (op, op->map, originator, 0); |
… | |
… | |
272 | } |
272 | } |
273 | else |
273 | else |
274 | return 0; |
274 | return 0; |
275 | } |
275 | } |
276 | |
276 | |
277 | remove_ob (user); |
277 | user->remove (); |
278 | |
278 | |
279 | /* Update location for the object */ |
279 | /* Update location for the object */ |
280 | for (tmp = user; tmp != NULL; tmp = tmp->more) |
280 | for (tmp = user; tmp != NULL; tmp = tmp->more) |
281 | { |
281 | { |
282 | tmp->x = other_teleporter->x + freearr_x[k] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x); |
282 | tmp->x = other_teleporter->x + freearr_x[k] + (tmp->arch == NULL ? 0 : tmp->arch->clone.x); |
… | |
… | |
389 | } |
389 | } |
390 | } |
390 | } |
391 | if (try_fit (op, m, x, y)) |
391 | if (try_fit (op, m, x, y)) |
392 | return 0; |
392 | return 0; |
393 | |
393 | |
394 | remove_ob (op); |
394 | op->remove (); |
395 | for (tmp = op; tmp != NULL; tmp = tmp->more) |
395 | for (tmp = op; tmp != NULL; tmp = tmp->more) |
396 | tmp->x += freearr_x[dir], tmp->y += freearr_y[dir]; |
396 | tmp->x += freearr_x[dir], tmp->y += freearr_y[dir]; |
397 | insert_ob_in_map (op, op->map, pusher, 0); |
397 | insert_ob_in_map (op, op->map, pusher, 0); |
398 | return 1; |
398 | return 1; |
399 | } |
399 | } |
… | |
… | |
423 | ) |
423 | ) |
424 | { |
424 | { |
425 | int temp; |
425 | int temp; |
426 | maptile *m; |
426 | maptile *m; |
427 | |
427 | |
428 | remove_ob (who); |
428 | who->remove (); |
429 | remove_ob (pusher); |
429 | pusher->remove (); |
430 | temp = pusher->x; |
430 | temp = pusher->x; |
431 | pusher->x = who->x; |
431 | pusher->x = who->x; |
432 | who->x = temp; |
432 | who->x = temp; |
433 | |
433 | |
434 | temp = pusher->y; |
434 | temp = pusher->y; |