version 1.131 | | version 1.132 |
---|
| | |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: object.c,v 1.131 2006/06/07 21:44:05 tchize Exp $"; | | * "$Id: object.c,v 1.132 2006/06/18 11:27:10 tchize Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
| | |
void update_ob_speed(object *op) { | | void update_ob_speed(object *op) { |
| | /* FIXME what the hell is this crappy hack?*/ |
extern int arch_init; | | extern int arch_init; |
| | |
/* No reason putting the archetypes objects on the speed list, | | /* No reason putting the archetypes objects on the speed list, |
| | |
} | | } |
if (FABS(op->speed)>MIN_ACTIVE_SPEED) { | | if (FABS(op->speed)>MIN_ACTIVE_SPEED) { |
/* If already on active list, don't do anything */ | | /* If already on active list, don't do anything */ |
| | /* TODO this check can probably be simplified a lot */ |
if (op->active_next || op->active_prev || op==active_objects) | | if (op->active_next || op->active_prev || op==active_objects) |
return; | | return; |
| | |
| | |
if (op->active_next!=NULL) | | if (op->active_next!=NULL) |
op->active_next->active_prev = op; | | op->active_next->active_prev = op; |
active_objects = op; | | active_objects = op; |
} | | } else { |
else { | | |
/* If not on the active list, nothing needs to be done */ | | /* If not on the active list, nothing needs to be done */ |
if (!op->active_next && !op->active_prev && op!=active_objects) | | if (!op->active_next && !op->active_prev && op!=active_objects) |
return; | | return; |
| | |
active_objects = op->active_next; | | active_objects = op->active_next; |
if (op->active_next!=NULL) | | if (op->active_next!=NULL) |
op->active_next->active_prev = NULL; | | op->active_next->active_prev = NULL; |
} | | } else { |
else { | | |
op->active_prev->active_next = op->active_next; | | op->active_prev->active_next = op->active_next; |
if (op->active_next) | | if (op->active_next) |
op->active_next->active_prev = op->active_prev; | | op->active_next->active_prev = op->active_prev; |
| | |
active_objects = op->active_next; | | active_objects = op->active_next; |
if (op->active_next!=NULL) | | if (op->active_next!=NULL) |
op->active_next->active_prev = NULL; | | op->active_next->active_prev = NULL; |
} | | } else { |
else { | | |
op->active_prev->active_next = op->active_next; | | op->active_prev->active_next = op->active_next; |
if (op->active_next) | | if (op->active_next) |
op->active_next->active_prev = op->active_prev; | | op->active_next->active_prev = op->active_prev; |
| | |
* as that is easier than trying to look at what may have changed. | | * as that is easier than trying to look at what may have changed. |
* UP_OBJ_FACE: only the objects face has changed. | | * UP_OBJ_FACE: only the objects face has changed. |
*/ | | */ |
| | /* FIXME this function should be renames something like update_object_map, update_object is a too general term |
| | * Also it might be worth moving it to map.c |
| | */ |
void update_object(object *op, int action) { | | void update_object(object *op, int action) { |
int update_now=0, flags; | | int update_now=0, flags; |
MoveType move_on, move_off, move_block, move_slow; | | MoveType move_on, move_off, move_block, move_slow; |
| | |
free_object2(op, free_inventory); | | free_object2(op, free_inventory); |
op=tmp; | | op=tmp; |
} | | } |
} | | } else { /* Put objects in inventory onto this space */ |
else { /* Put objects in inventory onto this space */ | | |
op=ob->inv; | | op=ob->inv; |
while(op!=NULL) { | | while(op!=NULL) { |
tmp=op->below; | | tmp=op->below; |
| | |
objects=ob->next; | | objects=ob->next; |
if(objects!=NULL) | | if(objects!=NULL) |
objects->prev=NULL; | | objects->prev=NULL; |
} | | } else { |
else { | | |
ob->prev->next=ob->next; | | ob->prev->next=ob->next; |
if(ob->next!=NULL) | | if(ob->next!=NULL) |
ob->next->prev=ob->prev; | | ob->next->prev=ob->prev; |