Esempio n. 1
0
KRProfileSys::KRProfileSys(KRProfile *W, KRProfile *B, KRCritSys Crt) {
	Crits = Crt;

	Worst = W;
	Best = B;

	AddSpecial(A_25, new KRProfile("A25", Crits));
	AddSpecial(A_50, new KRProfile("A50", Crits));
	AddSpecial(A_75, new KRProfile("A75", Crits));
	AddSpecial(A_EQ, new KRProfile("AEQ", Crits));
	GetSpecial(A_WORST)->ChangeCoeff(0.0);
	GetSpecial(A_25)->ChangeCoeff(0.25);
	GetSpecial(A_50)->ChangeCoeff(0.50);
	GetSpecial(A_75)->ChangeCoeff(0.75);
	GetSpecial(A_BEST)->ChangeCoeff(1.0);
	GetSpecial(A_EQ)->ChangeCoeff(0);

	for (int i = 0; i < Crits.GetSize(); i++) {
		int Worst = 0, Best = 0;
		if (!Crits.GetByIndex(i).dec) {
			Worst = GetWorst()->GetValue(i);
			Best = GetBest()->GetValue(i);
		}
		else {
			Worst = GetWorst()->GetValue(i);
			Best = GetBest()->GetValue(i);
		}
		ChangeSpecial(A_25, i, (Worst + (Worst + Best) / 2.0) / 2.0);
		ChangeSpecial(A_50, i, (Worst + Best) / 2.0);
		ChangeSpecial(A_75, i, (Best + (Worst + Best) / 2.0) / 2.0);
		ChangeSpecial(A_EQ, i, (Worst + Best) / 2.0);
	}
	std::vector<int>P;
	P.resize(Crits.GetSize());
	Crits.SetPrority(P);
}
Esempio n. 2
0
void UniverseObject::SetSpecialCapacity(const std::string& name, float capacity) {
    if (m_specials.find(name) != m_specials.end())
        m_specials[name].second = capacity;
    else
        AddSpecial(name, capacity);
}