Zitat von
Hagen0
Frag Charriu oder Ramk. Charriu sagt normalerweise, dass ihm diese Stellen (Stadtmanagement, Produktion) zu heiß sind, um daran herumzubasteln.
Letztlich verantwortlich ist die hier dick markierte Zeile im Code:
Code:
int CvCity::getHurryCost(bool bExtra, int iProductionLeft, int iHurryModifier, int iModifier) const
{
int iProduction = (iProductionLeft * iHurryModifier + 99) / 100; // round up
if (bExtra)
{
int iExtraProduction = getExtraProductionDifference(iProduction, iModifier);
if (iExtraProduction > 0)
{
int iAdjustedProd = iProduction * iProduction;
// round up
iProduction = (iAdjustedProd + (iExtraProduction - 1)) / iExtraProduction;
}
}
}
Das sieht schon recht merkwürdig aus, weil das Quadrat der Produktion Verwendung findet.
Auf unser Siedler-Beispiel mit 55 angewendet ergibt sich:
• iProductionLeft und das obere iProduction sind beide 45
• iExtraProduction ist 45*1.5 = 67 (abgerundete 67.5)
• Zweites iProduction =(45² + (67 - 1)) / 67 = 31 (abgerundete 31.2...);
Ohne Rundung der Zwischenwerte wären es nur 30.98, d.h. mit Rundung am Ende kommt man auf die gewünschten 30 Hämmer.
Mir ist leider nicht klar, warum sie es so implementiert haben, wie es aktuell ist. Das macht die Änderung nicht so einfach.
Auf den ersten Blick würde ich sagen man kann es folgendermaßen korrigieren/vereinfachen:
Code:
int iProductionFactor10000 = getExtraProductionDifference(10000, iModifier); // Ergibt Modifikationsfaktor mal 10000
// iProduction = (iProduction * 10000) / iProductionFactor10000; // Abrundung wäre hier falsch
iProduction = (iProduction * 10000 + (iProductionFactor10000-1)) / iProductionFactor10000; // Aufrundung