1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game for X-windows |
3 | |
3 | * |
4 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
6 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | |
7 | * |
8 | This program is free software; you can redistribute it and/or modify |
8 | * This program 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 2 of the License, or |
10 | * the Free Software Foundation; either version 2 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, |
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 GNU General Public License |
19 | along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | |
21 | * |
22 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail at <crossfire@schmorp.de> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | /* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects. |
25 | /* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects. |
26 | sub/add_weight will transcend the environment updating the carrying |
26 | sub/add_weight will transcend the environment updating the carrying |
27 | variable. */ |
27 | variable. */ |
28 | #include <global.h> |
28 | #include <global.h> |
… | |
… | |
660 | |
660 | |
661 | if (op->more) |
661 | if (op->more) |
662 | update_object (op->more, action); |
662 | update_object (op->more, action); |
663 | } |
663 | } |
664 | |
664 | |
665 | object *object::first; |
|
|
666 | |
|
|
667 | object::object () |
665 | object::object () |
668 | { |
666 | { |
669 | SET_FLAG (this, FLAG_REMOVED); |
667 | SET_FLAG (this, FLAG_REMOVED); |
670 | |
668 | |
671 | expmul = 1.0; |
669 | expmul = 1.0; |
… | |
… | |
2165 | |
2163 | |
2166 | return 3; |
2164 | return 3; |
2167 | } |
2165 | } |
2168 | |
2166 | |
2169 | /* |
2167 | /* |
2170 | * absdir(int): Returns a number between 1 and 8, which represent |
|
|
2171 | * the "absolute" direction of a number (it actually takes care of |
|
|
2172 | * "overflow" in previous calculations of a direction). |
|
|
2173 | */ |
|
|
2174 | |
|
|
2175 | int |
|
|
2176 | absdir (int d) |
|
|
2177 | { |
|
|
2178 | while (d < 1) |
|
|
2179 | d += 8; |
|
|
2180 | |
|
|
2181 | while (d > 8) |
|
|
2182 | d -= 8; |
|
|
2183 | |
|
|
2184 | return d; |
|
|
2185 | } |
|
|
2186 | |
|
|
2187 | /* |
|
|
2188 | * dirdiff(dir1, dir2) returns how many 45-degrees differences there is |
2168 | * dirdiff(dir1, dir2) returns how many 45-degrees differences there is |
2189 | * between two directions (which are expected to be absolute (see absdir()) |
2169 | * between two directions (which are expected to be absolute (see absdir()) |
2190 | */ |
2170 | */ |
2191 | |
|
|
2192 | int |
2171 | int |
2193 | dirdiff (int dir1, int dir2) |
2172 | dirdiff (int dir1, int dir2) |
2194 | { |
2173 | { |
2195 | int d; |
2174 | int d; |
2196 | |
2175 | |
… | |
… | |
2635 | { |
2614 | { |
2636 | static char info[256 * 4]; |
2615 | static char info[256 * 4]; |
2637 | return debug_desc (info); |
2616 | return debug_desc (info); |
2638 | } |
2617 | } |
2639 | |
2618 | |
|
|
2619 | const char * |
|
|
2620 | object::debug_desc2 () const |
|
|
2621 | { |
|
|
2622 | static char info[256 * 4]; |
|
|
2623 | return debug_desc (info); |
|
|
2624 | } |
|
|
2625 | |