Ejemplo n.º 1
0
void unpack_client_server_entity_data (entity *en)
{
    if (get_comms_model () == COMMS_MODEL_SERVER)
    {
        unpack_local_entity_data (en, get_local_entity_type (en), PACK_MODE_UPDATE_ENTITY);

        transmit_entity_comms_message (ENTITY_COMMS_UPDATE, en);
    }
    else
    {
        ASSERT (get_comms_model () == COMMS_MODEL_CLIENT);

        unpack_local_entity_data (en, get_local_entity_type (en), PACK_MODE_UPDATE_ENTITY);
    }
}
Ejemplo n.º 2
0
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);
}