pub fn command_consume(&mut self, parties: &[Party], flags: BattleFlagsType) -> CommandType
	{
		let mut finished = true;
		let mut priority = 0;
		let mut priority_index = 0;

		// Find a party to start from.
		'outer: for party_index in 0..self.queue.len()
		{
			if self.queue[party_index].command_count() > 0
			{
				for command_index in 0..self.queue[party_index].command_count()
				{
					if let Some(_) = self.queue[party_index].command_get(command_index)
					{
						priority = party_index;
						priority_index = command_index;
						break 'outer;
					}
				}
			}
		}

		// Find the minimum uses the starting point as a base.
		for party_index in priority..self.queue.len()
		{
			for command_index in 0..self.queue[party_index].command_count()
			{
				let priority_command = self.queue[priority].command_get(priority_index);

				if let Some(command) = self.queue[party_index].command_get(command_index)
				{
					if priority != party_index || priority_index != command_index
					{
						finished = false;
					}
					if CommandType::cmp(command, priority_command.unwrap(), parties, flags) == Ordering::Less
					{
						priority = party_index;
						priority_index = command_index;
					}
				}
			}
		}

		let command = self.queue[priority].command_take(priority_index);
		if finished
		{
			self.waiting = self.total;
		}
		command
	}
/// Finds the highest priority command in the queue and pops it.
///
/// The queue must be ready before calling this method.
///
Finds the highest priority command in the queue and pops it.
The queue must be ready before calling this method.
Finds the highest priority command in the queue and pops it . The queue must be ready before calling this method .
pub fn command_consume(&mut self, parties: &[Party], flags: BattleFlagsType) -> CommandType
	{
		let mut finished = true;
		let mut priority = 0;
		let mut priority_index = 0;
		// Find a party to start from.
		'outer: for party_index in 0..self.queue.len()
		{
			if self.queue[party_index].command_count() > 0
			{
				for command_index in 0..self.queue[party_index].command_count()
				{
					if let Some(_) = self.queue[party_index].command_get(command_index)
					{
						priority = party_index;
						priority_index = command_index;
						break 'outer;
					}
				}
			}
		}
		// Find the minimum uses the starting point as a base.
		for party_index in priority..self.queue.len()
		{
			for command_index in 0..self.queue[party_index].command_count()
			{
				let priority_command = self.queue[priority].command_get(priority_index);
				if let Some(command) = self.queue[party_index].command_get(command_index)
				{
					if priority != party_index || priority_index != command_index
					{
						finished = false;
					}
					if CommandType::cmp(command, priority_command.unwrap(), parties, flags) == Ordering::Less
					{
						priority = party_index;
						priority_index = command_index;
					}
				}
			}
		}
		let command = self.queue[priority].command_take(priority_index);
		if finished
		{
			self.waiting = self.total;
		}
		command
	}
pub fn command_consume ( & mut self , parties : & [ Party ] , flags : BattleFlagsType ) -> CommandType { let mut finished = true ; let mut priority = 0 ; let mut priority_index = 0 ; // Find a party to start from. ' outer : for party_index in 0 .. self . queue . len ( ) { if self . queue [ party_index ] . command_count ( ) > 0 { for command_index in 0 .. self . queue [ party_index ] . command_count ( ) { if let Some ( _ ) = self . queue [ party_index ] . command_get ( command_index ) { priority = party_index ; priority_index = command_index ; break ' outer ; } } } } // Find the minimum uses the starting point as a base. for party_index in priority .. self . queue . len ( ) { for command_index in 0 .. self . queue [ party_index ] . command_count ( ) { let priority_command = self . queue [ priority ] . command_get ( priority_index ) ; if let Some ( command ) = self . queue [ party_index ] . command_get ( command_index ) { if priority != party_index || priority_index != command_index { finished = false ; } if CommandType :: cmp ( command , priority_command . unwrap ( ) , parties , flags ) == Ordering :: Less { priority = party_index ; priority_index = command_index ; } } } } let command = self . queue [ priority ] . command_take ( priority_index ) ; if finished { self . waiting = self . total ; } command }
Finds the highest priority command in the queue and pops it.
Finds the highest priority command in the queue and pops it .
&mut self
parties
&[Party]
flags
BattleFlagsType
&mut self
parties
&[Party]
flags
BattleFlagsType