What follows is traffic from this thread:
It esentially addresses reimplementing the hungerfood flag, that is alread in the game but doesnt work (presumably because food is managed by city not empire like pw or gold). I also suggested adding a new flag: hungergold, that would make units cost gold per turn.
Martin made a good suggestion about hungerfood saying that the total should be added up then divided by cities and subtracted from each city...this would have to consider new cities and those with more surplus than others but thats to b e discussed.
_____________________________________
rfom gs/readiness.cpp
It looks like this code looks to see if a unit has the hungershield flag and then looks for the value after it and then subtracts that value from the players PW.
So it looks like that in order to fix hungerfood or add hungergold, we'd have to create the flag and then look for the number value after the flag...
Also the unit support code I listed previously doesnt mention hungerfood which may be why the flag appears unimplemented
Is there an empire-wide food variable? I thought it was city based. If so, where would you deduct the food from? -E
There is no such variable. That's why I said it would be a big job - you'd have to comprehensively rework the way food is handled. - J Bytheway
Would it be coprehensive to have the system look for the city with the highest excess food first and subrtract from it until it was no longer then subtract from the next highest one. - E
"Basically a function that checks for the city with highest bonus, subtracts, checks again, subtracts, etc until either all are supplied or there is no bonus food left...
This system reminds me of Civ2, a city based instead of a empire wide based system, however maybe that could achieved over the food coefficent from the government stuff, or somewhere a function that calls us how many food must be deducted from each city.
Something like:
Needed food by units / number of cities and then substract it from all cities."
-Martin
i think I like that idea for food better Martin. I think this highlights a bigger issue with food though, that there is no distribution system that models a real world situation. Like egypt was rome's bread basket and Rome grew based on food imports, likewise with the midwest. I guess a future issue, probably in governor.cpp, would be able to shift food (maybe also with the trade route system)
As for gold, its managed empire-wide so it shouldnt be as hard to implement right?
I think I hould open this up in a new thread, in the source code...
It esentially addresses reimplementing the hungerfood flag, that is alread in the game but doesnt work (presumably because food is managed by city not empire like pw or gold). I also suggested adding a new flag: hungergold, that would make units cost gold per turn.
Martin made a good suggestion about hungerfood saying that the total should be added up then divided by cities and subtracted from each city...this would have to consider new cities and those with more surplus than others but thats to b e discussed.
_____________________________________
rfom gs/readiness.cpp
Code:
void MilitaryReadiness::SupportUnit(const Unit &u, sint32 gov) { double unitCost = GetSupportCost(u); m_cost += unitCost; g_network.Block(m_owner); ENQUEUE(); g_network.Unblock(m_owner); } double MilitaryReadiness::GetSupportCost(const Unit &u) { if(u.GetIsProfessional()) return 0; if(u.GetNeedsNoSupport()) return 0; double unitCost; if(u.GetDBRec()->GetIsSpecialForces()) { unitCost = u.GetShieldHunger() * GetSpecialForcesSupportModifier(g_player[m_owner]->GetGovernmentType()); } else { unitCost = u.GetShieldHunger() * GetSupportModifier(g_player[m_owner]->GetGovernmentType()); } unitCost -= unitCost * double((double)wonderutil_GetReadinessCostReduct ion( g_player[m_owner]->GetBuiltWonders()) / 100.0); unitCost *= g_theGovernmentDB->Get(g_player[m_owner]->m_government_type)->GetSupportCoef(); return unitCost;
It looks like this code looks to see if a unit has the hungershield flag and then looks for the value after it and then subtracts that value from the players PW.
So it looks like that in order to fix hungerfood or add hungergold, we'd have to create the flag and then look for the number value after the flag...
Also the unit support code I listed previously doesnt mention hungerfood which may be why the flag appears unimplemented
Code:
sint32 Unit::GetShieldHunger() const { return GetDBRec()->GetShieldHunger(); } sint32 Unit::GetFoodHunger() const { return GetDBRec()->GetFoodHunger();
There is no such variable. That's why I said it would be a big job - you'd have to comprehensively rework the way food is handled. - J Bytheway
Would it be coprehensive to have the system look for the city with the highest excess food first and subrtract from it until it was no longer then subtract from the next highest one. - E
"Basically a function that checks for the city with highest bonus, subtracts, checks again, subtracts, etc until either all are supplied or there is no bonus food left...
This system reminds me of Civ2, a city based instead of a empire wide based system, however maybe that could achieved over the food coefficent from the government stuff, or somewhere a function that calls us how many food must be deducted from each city.
Something like:
Needed food by units / number of cities and then substract it from all cities."
-Martin
i think I like that idea for food better Martin. I think this highlights a bigger issue with food though, that there is no distribution system that models a real world situation. Like egypt was rome's bread basket and Rome grew based on food imports, likewise with the midwest. I guess a future issue, probably in governor.cpp, would be able to shift food (maybe also with the trade route system)
As for gold, its managed empire-wide so it shouldnt be as hard to implement right?
I think I hould open this up in a new thread, in the source code...
Comment