void set_pilot_entity (entity *en) { comms_data_flow_types store_data_flow; if (en) { debug_log ("PILOT: Setting pilot_entity to %s", get_local_entity_string (en, STRING_TYPE_PILOTS_NAME)); ASSERT (pilot_entity == NULL); ASSERT (get_local_entity_type (en) == ENTITY_TYPE_PILOT); pilot_entity = en; // turn on NEXT button now Pilot entity has arrived if (get_comms_model () == COMMS_MODEL_CLIENT) { set_display_gunship_buttons (FALSE, "ENGAGE"); // turn on only the gunship_next button set_ui_object_drawable (gunship_screen_next_button, TRUE); } //-- Werewolf else { // If we're the server, remember our player name. This will be sent out in the heartbeat packets. net_set_hostname( get_local_entity_string (en, STRING_TYPE_PILOTS_NAME) ); } //-- Werewolf } else if (pilot_entity) { debug_log ("PILOT: Setting pilot_entity to NULL"); ASSERT (pilot_entity); // // Program MUST be in TX mode otherwise clients pilot will not be destroyed on the server // store_data_flow = get_comms_data_flow (); set_comms_data_flow (COMMS_DATA_FLOW_TX); destroy_client_server_entity (pilot_entity); set_comms_data_flow (store_data_flow); pilot_entity = NULL; } }
void reinitialise_client_ai_system (void) { comms_model_types temp_comms_model; comms_data_flow_types temp_comms_data_flow; temp_comms_model = get_comms_model (); temp_comms_data_flow = get_comms_data_flow (); // // set comms model and data flow to SERVER/TX // set_comms_model (COMMS_MODEL_SERVER); set_comms_data_flow (COMMS_DATA_FLOW_TX); if (population_placement_filename) { read_population_placement_file (population_placement_filename); } set_comms_model (temp_comms_model); set_comms_data_flow (temp_comms_data_flow); initialise_keysite_farp_enable (get_local_force_entity (ENTITY_SIDE_BLUE_FORCE)); initialise_keysite_farp_enable (get_local_force_entity (ENTITY_SIDE_RED_FORCE)); initialise_briefing_parser (); set_assign_create_waypoint_route (TRUE); }
int unpack_session (char *buffer, int buffer_size, pack_modes mode) { entity *en; entity_types type; int unpack_buffer_overflow; ASSERT (buffer); ASSERT (buffer_size > 0); ASSERT ((mode >= 0) && (mode < NUM_PACK_MODES)); #if !DEBUG_MODULE_PACK_ALL disable_debug_log_entity_args (); #endif set_comms_data_flow (COMMS_DATA_FLOW_RX); #if DEBUG_MODULE_PACK_ALL debug_log ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); debug_log ("UNPACK SESSION: buffer_size = %d", buffer_size); debug_log ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); #endif ///////////////////////////////////////////////////////////////// set_gunship_screen_progress_message (GUNSHIPS_SCREEN_GENERATING_CAMPAIGN_TEXT); initialise_entity_list_validation (); ///////////////////////////////////////////////////////////////// open_unpack_buffer (buffer, buffer_size); // // unpack sector entities first // ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_sector_data (mode); // // unpack pylon entities // ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_pylon_data (mode); // // unpack segment entities // ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_segment_data (mode); // // unpack bridge entities // ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_bridge_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_session_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// en = get_local_entity_first_child (get_session_entity (), LIST_TYPE_FORCE); while (en) { unpack_local_force_data (en, mode); en = get_local_entity_child_succ (en, LIST_TYPE_FORCE); } ///////////////////////////////////////////////////////////////// if (mode == PACK_MODE_CLIENT_SESSION) { reinitialise_client_ai_system (); } ///////////////////////////////////////////////////////////////// // // unpack remaining entities // type = unpack_entity_type (); while (type != ENTITY_TYPE_UNKNOWN) { ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// #if DEBUG_MODULE debug_log ("EN_SESSN: unpacking %s", entity_type_database [type].name); #endif unpack_local_entity_data (NULL, type, mode); type = unpack_entity_type (); } // // unpack other entity data // ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_keysite_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_regen_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_city_building_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_scenic_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_site_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_site_updatable_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_anti_aircraft_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_group_data (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// unpack_local_division_database (mode); unpack_local_message_log (mode); unpack_group_callsign_database (mode); ///////////////////////////////////////////// update_gunships_screen_progress_indicator (); ///////////////////////////////////////////// #if LANDING_ROUTE_CHECK unpack_debug_entity_landing_locks (mode); #endif unpack_buffer_overflow = get_unpack_buffer_overflow (); close_unpack_buffer (); ///////////////////////////////////////////////////////////////// process_entity_list_link_validation (); process_entity_list_root_validation (); #if 1 repair_landing_entity_locks (mode); #endif process_entity_smoke_list_creation (); process_entity_sound_effect_creation (); ///////////////////////////////////////////////////////////////// initialise_entity_list_validation (); ///////////////////////////////////////////////////////////////// // // Any processes which can only be completed when ALL entities have been unpacked // validate_local_group_data (); #if DEBUG_MODULE_PACK_ALL debug_log ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); debug_log ("UNPACK SESSION: unpack_buffer_overflow = %d", unpack_buffer_overflow); debug_log ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); #endif set_comms_data_flow (COMMS_DATA_FLOW_TX); #if !DEBUG_MODULE_PACK_ALL enable_debug_log_entity_args (); #endif return (unpack_buffer_overflow); }