1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_object_c = |
|
|
4 | * "$Id: object.C,v 1.27 2006/09/11 12:08:45 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
10 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
11 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
29 | |
23 | |
30 | /* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects. |
24 | /* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects. |
31 | sub/add_weight will transcend the environment updating the carrying |
25 | sub/add_weight will transcend the environment updating the carrying |
32 | variable. */ |
26 | variable. */ |
33 | #include <global.h> |
27 | #include <global.h> |
34 | #ifndef WIN32 /* ---win32 exclude headers */ |
|
|
35 | # include <stdio.h> |
28 | #include <stdio.h> |
36 | # include <sys/types.h> |
29 | #include <sys/types.h> |
37 | # include <sys/uio.h> |
30 | #include <sys/uio.h> |
38 | #endif /* win32 */ |
|
|
39 | #include <object.h> |
31 | #include <object.h> |
40 | #include <funcpoint.h> |
32 | #include <funcpoint.h> |
41 | #include <skills.h> |
33 | #include <skills.h> |
42 | #include <loader.h> |
34 | #include <loader.h> |
|
|
35 | |
43 | int nrofallocobjects = 0; |
36 | int nrofallocobjects = 0; |
44 | |
37 | |
45 | object *objects; /* Pointer to the list of used objects */ |
38 | object *objects; /* Pointer to the list of used objects */ |
46 | object *active_objects; /* List of active objects that need to be processed */ |
39 | object *active_objects; /* List of active objects that need to be processed */ |
47 | |
40 | |
… | |
… | |
249 | /* |
242 | /* |
250 | * sum_weight() is a recursive function which calculates the weight |
243 | * sum_weight() is a recursive function which calculates the weight |
251 | * an object is carrying. It goes through in figures out how much |
244 | * an object is carrying. It goes through in figures out how much |
252 | * containers are carrying, and sums it up. |
245 | * containers are carrying, and sums it up. |
253 | */ |
246 | */ |
254 | signed long |
247 | long |
255 | sum_weight (object *op) |
248 | sum_weight (object *op) |
256 | { |
249 | { |
257 | signed long sum; |
250 | long sum; |
258 | object *inv; |
251 | object *inv; |
259 | |
252 | |
260 | for (sum = 0, inv = op->inv; inv != NULL; inv = inv->below) |
253 | for (sum = 0, inv = op->inv; inv != NULL; inv = inv->below) |
261 | { |
254 | { |
262 | if (inv->inv) |
255 | if (inv->inv) |