示例#1
0
文件: safemem.c 项目: Comanche93/eech
void reset_safe_memory_counter (void)
{
	if (report_safe_memory_warnings)
	{
		debug_colour_log (DEBUG_COLOUR_AMBER, "NOTE! Safe memory counter reset");
	}

	safe_memory_counter = 0;

	debug_watch ("Total safe memory allocated: %d", MT_INT, &total_safe_memory_allocated);
	debug_watch ("Maximum safe memory allocated: %d", MT_INT, &maximum_safe_memory_allocated);
	debug_watch ("Safe memory counter: %d", MT_INT, &safe_memory_counter );
}
示例#2
0
connection_list_type *register_connection (DPID connection_id)
{

	connection_list_type
		*new_connection;

	//
	// stop pause or time acceleration if game is not single player
	//

	set_min_time_acceleration (NULL);

	//
	//
	//

	if (new_connection = get_connection_list_item (connection_id))
	{

		#if SERVER_DEBUG

		debug_log ("SERVER: already registered connection %d", connection_id);

		#endif

		return new_connection;
	}
	else
	{

		new_connection = (connection_list_type *) malloc_heap_mem (sizeof (connection_list_type));

		memset (new_connection, 0, sizeof (connection_list_type));

		new_connection->connection_receive_buffer = (unsigned char *) malloc_heap_mem (command_line_comms_connection_receive_size);

		new_connection->connection_receive_buffer_size = command_line_comms_connection_receive_size;

		debug_log ("SERVER: connection receive buffer size = %d, commandline %d", new_connection->connection_receive_buffer_size, command_line_comms_connection_receive_size);

		new_connection->already_sent_query_data = FALSE;

		new_connection->group_resend_timer = 0.0;

		new_connection->personal_resend_timer = 0.0;

		new_connection->connection_id = connection_id;

		new_connection->next = connection_list_head;

		new_connection->receive_group_frame_id = 0;

		new_connection->receive_personal_frame_id = 0;

		new_connection->send_personal_frame_id = 0;

		connection_list_head = new_connection;

		debug_log ("SERVER: registering new connection %d", connection_id);

		#if SERVER_DEBUG

		debug_watch ("Connection id %d data", MT_INT, &new_connection->connection_id);
		debug_watch ("	number of packets				= %d", MT_INT, &new_connection->number_of_packets);
		debug_watch ("	size								= %d", MT_INT, &new_connection->size);
		//debug_watch ("	send group id					= %d", MT_INT, &new_connection->send_group_frame_id);
		debug_watch ("	send personal id				= %d", MT_INT, &new_connection->send_personal_frame_id);
		debug_watch ("	receive group id				= %d", MT_INT, &new_connection->receive_group_frame_id);
		debug_watch ("	receive personal id				= %d", MT_INT, &new_connection->receive_personal_frame_id);
		debug_watch ("	rerequest counter				= %d", MT_INT, &new_connection->packet_rerequested);
		debug_watch ("	gunship ptr						= %d", MT_INT, &new_connection->gunship_entity);
		debug_watch ("	player ptr							= %d", MT_INT, &new_connection->pilot_entity);
		debug_watch ("	gunship number				= %d", MT_INT, &new_connection->gunship_number);
		//debug_watch ("	last packet time				 	= %d", MT_INT, &new_connection->time);
		debug_watch ("	group resend time				 	= %f", MT_FLOAT, &new_connection->group_resend_timer);
		debug_watch ("	personal resend time			 	= %f", MT_FLOAT, &new_connection->personal_resend_timer);

		#endif

		return new_connection;
	}
}
示例#3
0
void brief_initialise_game (void)
{

	////////////////////////////////////////
	set_game_status (GAME_STATUS_UNINITIALISED);
	set_comms_model (COMMS_MODEL_SERVER);
	////////////////////////////////////////

	////////////////////////////////////////
	debug_watch ("Game status                                           =  %s", MT_STRING_PTR, &game_status_string);
	debug_watch ("Comms model                                           =  %s", MT_STRING_PTR, &comms_model_string);
	////////////////////////////////////////

	////////////////////////////////////////
	//
	// WARNING!     INITIALISATION ORDER IS CRITICAL
	//
	// NOTE :       MEMORY BLOCK SYSTEM CONSTRAINTS;
	//                      DO NOT USE REGISTER_EXIT_FUNCTION
	//                      FOR DEINITIALISATION.
	//
	////////////////////////////////////////

	////////////////////////////////////////
	//
	// INITIALISE GLOBAL OPTIONS
	//
	////////////////////////////////////////

	debug_log ( "Initialising memory system" );

	reset_safe_memory_counter ();

	reset_safe_memory_mapped_file_counter ();

	initialise_memory_block_system ();

	create_memory_block_configuration (memory_block_config, sizeof (memory_block_config) / sizeof (memory_block_configuration));

	////////////////////////////////////////
	//
	// INITIALISE GRAPHICS FILES
	//
	// NB. FIRST PASS CONVERSION ONLY
	//
	////////////////////////////////////////

	debug_log ( "Installing graphics files" );

	//
	// Check the graphics file format
	//

	{

		int
		red_mask,
		green_mask,
		blue_mask,
		alpha_mask;

		get_screen_pixel_format ( &red_mask, &green_mask, &blue_mask, &alpha_mask );

		if (	( red_mask != get_global_graphics_files_red_mask () ) ||
				( green_mask != get_global_graphics_files_green_mask () ) ||
				( blue_mask != get_global_graphics_files_blue_mask () ) ||
				( alpha_mask != get_global_graphics_files_alpha_mask () ) )
		{

			set_global_graphics_files_red_mask ( red_mask );

			set_global_graphics_files_green_mask ( green_mask );

			set_global_graphics_files_blue_mask ( blue_mask );

			set_global_graphics_files_alpha_mask ( alpha_mask );

			set_global_graphics_files_wrong_format ( TRUE );
		}
	}

	if ( (command_line_clean_graphics) || ( ( get_global_graphics_files_wrong_format () ) && ( !command_line_no_graphics_conversion ) ) )
	{

		uninstall_graphics_files ();
	}

	if ((!get_global_graphics_files_installed ()) || command_line_new_graphics)
	{
		while (!install_graphics_files (GRAPHICS_CONVERSION_FIRST_PASS));
	}

	debug_log ( "Opening graphics files" );

	mopen_all_graphics_files (GRAPHICS_CONVERSION_FIRST_PASS);

	//
	// Reset the graphics file format change flag now
	//

	set_global_graphics_files_wrong_format ( FALSE );

	debug_log ( "Installing event stack" );

	initialise_event_stack ();

	debug_log ( "Installing ui" );

	switch (command_line_run_mode)
	{
/*
		case RUN_MODE_AITOOL:
		{

			push_event (aitool_events, "aitool events");

			break;
		}
*/
		case RUN_MODE_NORMAL:
		default:
		{

			push_event (ui_events, "ui events");

			break;
		}
	}

	initialise_dinput_to_ascii_conversion_table ();

	debug_log ( "Initialising ui system" );

	initialise_ui_system (2000);

	debug_log ( "Initialising ui font" );

	//
	// Hack in to support all font resolutions
	//

	set_ui_font_resolution (get_global_3d_visual_screen_width (), get_global_3d_visual_screen_height ());
	initialise_ui_font ();

	set_ui_font_type (UI_FONT_ARIAL_18);

	debug_log ( "Initialising ui objects" );

	initialise_ui_objects ();

	debug_log ( "Initialising ui menus" );


	////////////////////////////////////////
	//
	// INITIALISE LANGUAGE DATABASE
	//
	////////////////////////////////////////

//ö	initialise_language_database ();



	initialise_title_screen ();
	initialise_init_screen ();

	debug_log ( "Initialising ui mouseptr" );

	initialise_mouse_pointer ((rgb_packed *) get_graphics_file_data (GRAPHICS_UI_COMMON_MOUSE_POINTER));

	debug_log ( "Finished brief install" );
}