TbBool send_creature_to_job_near_position(struct Thing *creatng, MapSubtlCoord stl_x, MapSubtlCoord stl_y, CreatureJob new_job) { SYNCDBG(6,"Starting for %s (owner %d) and job %s",thing_model_name(creatng),(int)creatng->owner,creature_job_code_name(new_job)); struct CreatureJobConfig *jobcfg; jobcfg = get_config_for_job(new_job); if (jobcfg->func_cord_assign != NULL) { if (jobcfg->func_cord_assign(creatng, stl_x, stl_y, new_job)) { struct CreatureControl *cctrl; cctrl = creature_control_get_from_thing(creatng); // Set computer control accordingly to job flags if ((get_flags_for_job(new_job) & JoKF_NoSelfControl) != 0) { cctrl->flgfield_1 |= CCFlg_NoCompControl; } else { cctrl->flgfield_1 &= ~CCFlg_NoCompControl; } // If a new task isn't a work-in-group thing, remove the creature from group if ((get_flags_for_job(new_job) & JoKF_NoGroups) != 0) { if (creature_is_group_member(creatng)) { remove_creature_from_group(creatng); } } return true; } } else { ERRORLOG("Cannot start %s for %s (owner %d); job has no coord-based assign",creature_job_code_name(new_job),thing_model_name(creatng),(int)creatng->owner); } return false; }
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)); }