예제 #1
0
bool CASW_Mission_Manager::AllMarinesDead()
{
	if (!ASWGameRules() || !ASWGameResource())
		return false;

	// can't be all dead if we haven't left briefing yet!
	if (ASWGameRules()->GetGameState() < ASW_GS_INGAME)
		return false;

	int iMax = ASWGameResource()->GetMaxMarineResources();
	for (int i=0;i<iMax;i++)
	{
		CASW_Marine_Resource *pMarineResource = ASWGameResource()->GetMarineResource(i);
		if (pMarineResource && pMarineResource->GetHealthPercent() > 0)
		{
			return false;	// we have a live marine, so they're not all dead
		}
	}
	return true;  // arg all dead!
}
int CASW_Game_Resource::CountAllAliveMarines( void )
{
	int m = GetMaxMarineResources();
	int iMarines = 0;
	for ( int i = 0; i < m; i++ )
	{
		CASW_Marine_Resource *pMR = GetMarineResource( i );
		if ( !pMR )
			continue;

		CASW_Marine *pMarine = pMR->GetMarineEntity();
		if ( !pMarine )
			continue;

		if ( pMR->GetHealthPercent() > 0 )
		{
			iMarines++;
		}
	}
	return iMarines;
}