- limit current resource amounts to max storage allowed at game start

This commit is contained in:
Mark Vejvoda 2011-04-25 06:39:40 +00:00
parent a77aa5e4be
commit cb113514e1
3 changed files with 7 additions and 7 deletions

View File

@ -737,14 +737,11 @@ void Faction::removeStore(const UnitType *unitType){
limitResourcesToStore();
}
void Faction::limitResourcesToStore()
{
for(int i=0; i<resources.size(); ++i)
{
void Faction::limitResourcesToStore() {
for(int i=0; i<resources.size(); ++i) {
Resource *r= &resources[i];
Resource *s= &store[i];
if(r->getType()->getClass() != rcStatic && r->getAmount()>s->getAmount())
{
if(r->getType()->getClass() != rcStatic && r->getAmount()>s->getAmount()) {
r->setAmount(s->getAmount());
}
}

View File

@ -195,11 +195,11 @@ public:
int getFrameCount();
void signalWorkerThread(int frameIndex);
bool isWorkerThreadSignalCompleted(int frameIndex);
void limitResourcesToStore();
std::string toString() const;
private:
void limitResourcesToStore();
void resetResourceAmount(const ResourceType *rt);
};

View File

@ -1272,6 +1272,9 @@ void World::initUnits() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unit created for unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,unit->toString().c_str());
}
}
// Ensure Starting Resource Amount are adjusted to max store levels
f->limitResourcesToStore();
}
map.computeNormals();
map.computeInterpolatedHeights();