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 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 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 |
9 | * 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 |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your 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, |
… | |
… | |
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 GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * |
20 | * |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | /* |
24 | /* |
25 | * Routines that is executed from objects based on their speed have been |
25 | * Routines that is executed from objects based on their speed have been |
26 | * collected in this file. |
26 | * collected in this file. |
… | |
… | |
34 | * so those will be removed shortly (in a cascade like fashion.) |
34 | * so those will be removed shortly (in a cascade like fashion.) |
35 | */ |
35 | */ |
36 | void |
36 | void |
37 | remove_door (object *op) |
37 | remove_door (object *op) |
38 | { |
38 | { |
39 | int i; |
39 | for (int i = 1; i < SIZEOFFREE1 + 1; i += 2) |
|
|
40 | { |
40 | object *tmp; |
41 | object *tmp; |
41 | |
42 | mapxy pos (op); |
42 | for (i = 1; i < 9; i += 2) |
43 | pos.move (i); |
43 | if ((tmp = present (DOOR, op->map, op->x + freearr_x[i], op->y + freearr_y[i])) != NULL) |
44 | if (pos.normalise () |
|
|
45 | && (tmp = present (DOOR, pos.m, pos.x, pos.y))) |
44 | { |
46 | { |
45 | tmp->set_speed (0.1f); |
47 | tmp->set_speed (0.1f); |
46 | tmp->speed_left = -0.2f; |
48 | tmp->speed_left = -0.2f; |
47 | } |
49 | } |
|
|
50 | } |
48 | |
51 | |
49 | if (op->other_arch) |
52 | if (op->other_arch) |
50 | { |
53 | { |
51 | tmp = arch_to_object (op->other_arch); |
54 | object *tmp = arch_to_object (op->other_arch); |
52 | tmp->x = op->x; |
55 | tmp->x = op->x; |
53 | tmp->y = op->y; |
56 | tmp->y = op->y; |
54 | tmp->map = op->map; |
57 | tmp->map = op->map; |
55 | tmp->level = op->level; |
58 | tmp->level = op->level; |
56 | insert_ob_in_map (tmp, op->map, op, 0); |
59 | insert_ob_in_map (tmp, op->map, op, 0); |