version 1.77 | | version 1.78 |
---|
| | |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: object.c,v 1.77 2003/12/18 20:39:44 ryo_saeba Exp $"; | | * "$Id: object.c,v 1.78 2003/12/21 02:13:46 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
op->materialname = NULL; | | op->materialname = NULL; |
op->lore = NULL; | | op->lore = NULL; |
op->current_weapon_script = NULL; | | op->current_weapon_script = NULL; |
| | op->events=NULL; |
clear_object(op); | | clear_object(op); |
} | | } |
/* | | /* |
| | |
if (op->lore!=NULL) FREE_AND_CLEAR_STR(op->lore); | | if (op->lore!=NULL) FREE_AND_CLEAR_STR(op->lore); |
if (op->materialname!= NULL) FREE_AND_CLEAR_STR(op->materialname); | | if (op->materialname!= NULL) FREE_AND_CLEAR_STR(op->materialname); |
| | |
| | /* Clean the events list */ |
| | while (op->events != NULL) |
| | { |
| | evt2 = NULL; |
| | evt = op->events; |
| | while (evt->next != NULL) |
| | { |
| | evt2 = evt; |
| | evt = evt->next; |
| | |
| | } |
| | |
| | if (evt->hook != NULL) FREE_AND_CLEAR(evt->hook); |
| | if (evt->plugin != NULL) FREE_AND_CLEAR(evt->plugin); |
| | if (evt->options != NULL) FREE_AND_CLEAR(evt->options); |
| | |
| | FREE_AND_CLEAR(evt); |
| | |
| | if (evt2 != NULL) |
| | evt2->next = NULL; |
| | else |
| | op->events = NULL; |
| | } |
| | |
| | |
/* Using this memset is a lot easier (and probably faster) | | |
* than explicitly clearing the fields. | | |
*/ | | |
memset((void*)((char*)op + offsetof(object, name)), | | memset((void*)((char*)op + offsetof(object, name)), |
0, sizeof(object)-offsetof(object, name)); | | 0, sizeof(object)-offsetof(object, name)); |
/* Below here, we clear things that are not done by the memset, | | /* Below here, we clear things that are not done by the memset, |
* or set default values that are not zero. | | * or set default values that are not zero. |
*/ | | */ |
| | |
/* This is more or less true */ | | /* This is more or less true */ |
SET_FLAG(op, FLAG_REMOVED); | | SET_FLAG(op, FLAG_REMOVED); |
| | |
| | |
op->contr = NULL; | | op->contr = NULL; |
op->below=NULL; | | op->below=NULL; |
op->above=NULL; | | op->above=NULL; |
| | |
if (settings.casting_time) | | if (settings.casting_time) |
op->casting_time = -1; | | op->casting_time = -1; |
| | |
/* Clean the events list */ | | |
while (op->events != NULL) | | |
{ | | |
evt2 = NULL; | | |
evt = op->events; | | |
while (evt->next != NULL) | | |
{ | | |
evt2 = evt; | | |
evt = evt->next; | | |
| | |
} | | |
| | |
if (evt->hook != NULL) FREE_AND_CLEAR(evt->hook); | | |
if (evt->plugin != NULL) FREE_AND_CLEAR(evt->plugin); | | |
if (evt->options != NULL) FREE_AND_CLEAR(evt->options); | | |
| | |
FREE_AND_CLEAR(evt); | | |
| | |
if (evt2 != NULL) | | |
evt2->next = NULL; | | |
else | | |
op->events = NULL; | | |
} | | |
} | | } |
| | |
/* | | /* |