Example #1
0
File: vbl.c Project: DrItanium/moo
void check_recording_replaying(
	void)
{
	short player_index, queue_size;

	if (replay.game_is_being_recorded)
	{
		boolean enough_data_to_save= TRUE;
	
		// it's time to save the queues if all of them have >= RECORD_CHUNK_SIZE flags in them.
		for (player_index= 0; enough_data_to_save && player_index<dynamic_world->player_count; player_index++)
		{
			queue_size= get_recording_queue_size(player_index);
			if (queue_size < RECORD_CHUNK_SIZE)	enough_data_to_save= FALSE;
		}
		
		if(enough_data_to_save)
		{
			boolean success;
			unsigned long freespace;
			FileDesc recording_file;
			
			get_recording_filedesc(&recording_file);

			success= get_freespace_on_disk(&recording_file, &freespace);
			if (success && freespace>(RECORD_CHUNK_SIZE*sizeof(short)*sizeof(long)*dynamic_world->player_count))
			{
				for (player_index= 0; player_index<dynamic_world->player_count; player_index++)
				{
					save_recording_queue_chunk(player_index);
				}
			}
		}
	}
	else if (replay.game_is_being_replayed)
	{
		boolean load_new_data= TRUE;
	
		// it's time to refill the requeues if they all have < RECORD_CHUNK_SIZE flags in them.
		for (player_index= 0; load_new_data && player_index<dynamic_world->player_count; player_index++)
		{
			queue_size= get_recording_queue_size(player_index);
			if(queue_size>= RECORD_CHUNK_SIZE) load_new_data= FALSE;
		}
		
		if(load_new_data)
		{
			// at this point, weÕve determined that the queues are sufficently empty, so
			// weÕll fill Õem up.
			read_recording_queue_chunks();
		}
	}

	return;
}
Example #2
0
void check_recording_replaying(
	void)
{
	short player_index, queue_size;

	if (replay.game_is_being_recorded)
	{
		bool enough_data_to_save= true;
	
		// it's time to save the queues if all of them have >= RECORD_CHUNK_SIZE flags in them.
		for (player_index= 0; enough_data_to_save && player_index<dynamic_world->player_count; player_index++)
		{
			queue_size= get_recording_queue_size(player_index);
			if (queue_size < RECORD_CHUNK_SIZE)	enough_data_to_save= false;
		}
		
		if(enough_data_to_save)
		{
			bool success;
			uint32 freespace = 0;
			FileSpecifier FilmFile_Check;
			
			get_recording_filedesc(FilmFile_Check);

			success= FilmFile_Check.GetFreeSpace(freespace);
			if (success && freespace>(RECORD_CHUNK_SIZE*sizeof(int16)*sizeof(uint32)*dynamic_world->player_count))
			{
				for (player_index= 0; player_index<dynamic_world->player_count; player_index++)
				{
					save_recording_queue_chunk(player_index);
				}
			}
		}
	}
	else if (replay.game_is_being_replayed)
	{
		bool load_new_data= true;
	
		// it's time to refill the requeues if they all have < RECORD_CHUNK_SIZE flags in them.
		for (player_index= 0; load_new_data && player_index<dynamic_world->player_count; player_index++)
		{
			queue_size= get_recording_queue_size(player_index);
			if(queue_size>= RECORD_CHUNK_SIZE) load_new_data= false;
		}
		
		if(load_new_data)
		{
			// at this point, we've determined that the queues are sufficently empty, so
			// we'll fill 'em up.
			read_recording_queue_chunks();
		}
	}
}