void delete_all_control_structures(void) { long i; struct CreatureControl *cctrl; for (i=1; i < CREATURES_COUNT; i++) { cctrl = creature_control_get(i); if (!creature_control_invalid(cctrl)) { if ((cctrl->flgfield_1 & CCFlg_Exists) != 0) delete_control_structure(cctrl); } } }
void delete_thing_structure_f(struct Thing *thing, long a2, const char *func_name) { TRACE_THING(thing); if ((thing->alloc_flags & TAlF_InDungeonList) != 0) { remove_first_creature(thing); } if (!a2) { if (thing->light_id != 0) { light_delete_light(thing->light_id); thing->light_id = 0; } } struct CreatureControl *cctrl; cctrl = creature_control_get_from_thing(thing); if (!creature_control_invalid(cctrl)) { if ( !a2 ) { remove_creature_lair(thing); if (creature_is_group_member(thing)) { remove_creature_from_group(thing); } } delete_control_structure(cctrl); } if (thing->snd_emitter_id != 0) { S3DDestroySoundEmitterAndSamples(thing->snd_emitter_id); thing->snd_emitter_id = 0; } remove_thing_from_its_class_list(thing); remove_thing_from_mapwho(thing); if (thing->index > 0) { game.free_things_start_index--; game.free_things[game.free_things_start_index] = thing->index; } else { #if (BFDEBUG_LEVEL > 0) ERRORMSG("%s: Performed deleting of thing with bad index %d!",func_name,(int)thing->index); #endif } LbMemorySet(thing, 0, sizeof(struct Thing)); }