1 | /* |
1 | /* |
2 | * static char *rcsid_object_c = |
2 | * static char *rcsid_object_c = |
3 | * "$Id: object.c,v 1.1 2006/02/03 07:11:38 root Exp $"; |
3 | * "$Id: object.c,v 1.2 2006/02/07 23:29:55 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
52 | |
52 | |
53 | object *objects; /* Pointer to the list of used objects */ |
53 | object *objects; /* Pointer to the list of used objects */ |
54 | object *free_objects; /* Pointer to the list of unused objects */ |
54 | object *free_objects; /* Pointer to the list of unused objects */ |
55 | object *active_objects; /* List of active objects that need to be processed */ |
55 | object *active_objects; /* List of active objects that need to be processed */ |
56 | |
56 | |
|
|
57 | void (*object_free_callback)(object *ob); |
57 | |
58 | |
58 | short freearr_x[SIZEOFFREE]= |
59 | short freearr_x[SIZEOFFREE]= |
59 | {0,0,1,1,1,0,-1,-1,-1,0,1,2,2,2,2,2,1,0,-1,-2,-2,-2,-2,-2,-1, |
60 | {0,0,1,1,1,0,-1,-1,-1,0,1,2,2,2,2,2,1,0,-1,-2,-2,-2,-2,-2,-1, |
60 | 0,1,2,3,3,3,3,3,3,3,2,1,0,-1,-2,-3,-3,-3,-3,-3,-3,-3,-2,-1}; |
61 | 0,1,2,3,3,3,3,3,3,3,2,1,0,-1,-2,-3,-3,-3,-3,-3,-3,-3,-2,-1}; |
61 | short freearr_y[SIZEOFFREE]= |
62 | short freearr_y[SIZEOFFREE]= |
… | |
… | |
1060 | void free_object(object *ob) { |
1061 | void free_object(object *ob) { |
1061 | free_object2(ob, 0); |
1062 | free_object2(ob, 0); |
1062 | } |
1063 | } |
1063 | void free_object2(object *ob, int free_inventory) { |
1064 | void free_object2(object *ob, int free_inventory) { |
1064 | object *tmp,*op; |
1065 | object *tmp,*op; |
|
|
1066 | |
|
|
1067 | if (object_free_callback) |
|
|
1068 | object_free_callback (ob); |
1065 | |
1069 | |
1066 | if (!QUERY_FLAG(ob,FLAG_REMOVED)) { |
1070 | if (!QUERY_FLAG(ob,FLAG_REMOVED)) { |
1067 | LOG(llevDebug,"Free object called with non removed object\n"); |
1071 | LOG(llevDebug,"Free object called with non removed object\n"); |
1068 | dump_object(ob); |
1072 | dump_object(ob); |
1069 | #ifdef MANY_CORES |
1073 | #ifdef MANY_CORES |