예제 #1
0
ScenarioObject* Condition::CreatCondition()
{
	Condition *pCondition = new Condition;
	pCondition->Init();
	ms_Gravity.SetValue(_T("1"));
	ms_ReTransLam.SetValue(_T("2300"));
	ms_ReTransTurb.SetValue(_T("4000"));
	ms_AtmosphericPress.SetValue(1);
	ms_AtmosphericPress.SetUnit("atm");
	ms_AtmosphericTemp.SetValue(_T("293.15"));
	pCondition->SetValue(ms_Gravity,1);
	pCondition->SetValue(ms_ReTransLam,2);
	pCondition->SetValue(ms_ReTransTurb,3);
	pCondition->SetValue(ms_AtmosphericPress,4);
	pCondition->SetValue(ms_AtmosphericTemp,5);
	return pCondition;
}
예제 #2
0
bool Trigger::LoadCondition(IniReader *pini, FindProp *pfind)
{
	char sz[128];
	sz[0] = 0;
	int nCondition;
	int cArgs = pini->GetPropertyValue(pfind, "%d,%s", &nCondition, sz);
	if (cArgs == 0)
		return false;
	
	Condition *pcdn = NULL;
	switch (nCondition) {
	case knMissionLoadedCondition:
		pcdn = new MissionLoadedCondition();
		break;

	case knCreditsCondition:
		pcdn = new CreditsCondition();
		break;

	case knOwnsUnitsCondition:
		pcdn = new OwnsUnitsCondition();
		break;

	case knAreaContainsUnitsCondition:
		pcdn = new AreaContainsUnitsCondition();
		break;

	case knPlaceStructureModeCondition:
		pcdn = new PlaceStructureModeCondition();
		break;

	case knMinerCantFindGalaxiteCondition:
		pcdn = new MinerCantFindGalaxiteCondition();
		break;

	case knGalaxiteCapacityReachedCondition:
		pcdn = new GalaxiteCapacityReachedCondition();
		break;

	case knElapsedTimeCondition:
		pcdn = new ElapsedTimeCondition();
		break;

	case knSwitchCondition:
		pcdn = new SwitchCondition();
		break;

	case knPeriodicTimerCondition:
		pcdn = new PeriodicTimerCondition();
		break;

	case knDiscoversSideCondition:
		pcdn = new DiscoversSideCondition();
		break;

	case knCountdownTimerCondition:
		pcdn = new CountdownTimerCondition();
		break;

	case knTestPvarCondition:
		pcdn = new TestPvarCondition();
		break;

	case knHasUpgradesCondition:
		pcdn = new HasUpgradesCondition();
		break;

#ifdef UNDONE
	case knUnitDestroyedCondition:
		pcdn = new UnitDestroyedCondition();
		break;

	case knDeathsCondition:
		pcdn = new DeathsCondition();
		break;

	case knMobileHQDeployableCondition:
		pcdn = new MobileHQDeployableCondition();
		break;

	case knMobileHQDeployedCondition:
		pcdn = new MobileHQDeployedCondition();
		break;

	case knUnitSeesUnitCondition:
		pcdn = new UnitSeesUnitCondition();
		break;

	case knUnitDestroyedCondition:
		pcdn = new UnitDestroyedCondition();
		break;
#endif

	default:
		Assert(false);
		break;
	}
	
	// Init it, error if that failed

	Assert(pcdn != NULL, "out of memory!");
	if (!pcdn->Init(sz)) {
		delete pcdn;
		return false;
	}

	// Link it in last

	Condition **ppcdn = &m_pcdn;
	while ((*ppcdn) != NULL)
		ppcdn = &((*ppcdn)->m_pcdnNext);
	*ppcdn = pcdn;

	return true;
}