static void episodic_store_full( noble_being * local, n_byte event, n_int affect, noble_simulation * local_sim, n_byte2 name1, n_byte2 family1, n_byte2 name2, n_byte2 family2, n_byte2 arg, n_byte food) { episodic_memory * local_episodic = GET_EPI(local_sim, local); n_int replace; n_byte old_event; n_byte2 old_time; n_byte2 new_time; if (local_episodic == 0L) { return; } if (being_awake_local(local_sim, local)==FULLY_ASLEEP) return; replace = episodic_memory_replace_index(event,affect,name1,family1,name2,family2,local,local_sim); if (replace == -1) return; old_event = local_episodic[replace].event; old_time = local_episodic[replace].time; /** insert the current event into the episodic memory */ local_episodic[replace].event = event; local_episodic[replace].affect = (n_byte2)(affect+EPISODIC_AFFECT_ZERO); local_episodic[replace].location[0] = GET_X(local); local_episodic[replace].location[1] = GET_Y(local); local_episodic[replace].time = new_time =local_sim->land->time; local_episodic[replace].date[0] = local_sim->land->date[0]; local_episodic[replace].date[1] = local_sim->land->date[1]; local_episodic[replace].first_name[BEING_MEETER]=name1; local_episodic[replace].family_name[BEING_MEETER]=family1; local_episodic[replace].first_name[BEING_MET]=name2; local_episodic[replace].family_name[BEING_MET]=family2; local_episodic[replace].food=food; local_episodic[replace].arg=arg; if ((event == 0) || (event>=EVENTS)) { (void)SHOW_ERROR("Event outside scope"); } if (local_logging) { if ((old_event != event) || ((old_time+10) < (new_time))) /* this may need to be changed */ { n_string_block description; n_string_block str; n_string_block time; n_string_block combination = {0}; n_int social_event; being_name((FIND_SEX(GET_I(local)) == SEX_FEMALE), GET_NAME(local_sim, local), GET_FAMILY_FIRST_NAME(local_sim, local), GET_FAMILY_SECOND_NAME(local_sim, local), str); social_event = episode_description(local_sim, local, replace, description); if ((local_social == 1) && (social_event == 0)) { return; } io_time_to_string(time, local_sim->land->time, local_sim->land->date[0], local_sim->land->date[1]); io_three_string_combination(combination, time, str, description, 35); (*local_logging)(combination); } } }
/** * @brief Stores an episodic memory * @param local Pointer to the being * @param event The type of event * @param affect Affect value associated with the event * @param local_sim Pointer to the simulation * @param name1 First name of a being participating in the event * @param family1 Family names of a being participating in the event * @param name2 First name of a second being participating in the event * @param family2 Family names of a second being participating in the event * @param arg Any additional argument * @param food Type of food */ static void episodic_store_full( noble_being * local, being_episodic_event_type event, n_int affect, n_byte2 name1, n_byte2 family1, n_byte2 name2, n_byte2 family2, n_byte2 arg, n_byte food) { noble_episodic * local_episodic = being_episodic(local); n_int replace; n_byte old_event; n_byte4 old_time; n_byte4 new_time; if (local_episodic == 0L) { return; } if (local->delta.awake == FULLY_ASLEEP) return; replace = noble_episodic_replace_index(event,affect,name1,family1,name2,family2,local); if (replace == -1) return; old_event = local_episodic[replace].event; old_time = local_episodic[replace].space_time.time; /** insert the current event into the episodic memory */ local_episodic[replace].event = event; local_episodic[replace].affect = (n_byte2)(affect+EPISODIC_AFFECT_ZERO); spacetime_set(&local_episodic[replace].space_time, being_location(local)); new_time = local_episodic[replace].space_time.time; local_episodic[replace].first_name[BEING_MEETER]=name1; local_episodic[replace].family_name[BEING_MEETER]=family1; local_episodic[replace].first_name[BEING_MET]=name2; local_episodic[replace].family_name[BEING_MET]=family2; local_episodic[replace].food=food; local_episodic[replace].arg=arg; if ((event == 0) || (event>=EVENTS)) { (void)SHOW_ERROR("Event outside scope"); } if (local_logging) { if ((old_event != event) /*|| ((old_time+10) < (new_time))*/) /**< TODO this may need to be changed */ { n_string_block description = {0}; n_string_block str = {0}; n_string_block time = {0}; n_string_block combination = {0}; n_int social_event; social_event = episode_description(local, replace, description); if ((local_social == 1) && (social_event == 0)) { return; } being_name_simple(local, str); io_time_to_string(time); io_three_string_combination(combination, time, str, description, 35); (*local_logging)(combination); } } }