From cb113514e17e199cf7946dedf007922facf2a3df Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Mon, 25 Apr 2011 06:39:40 +0000 Subject: [PATCH] - limit current resource amounts to max storage allowed at game start --- source/glest_game/type_instances/faction.cpp | 9 +++------ source/glest_game/type_instances/faction.h | 2 +- source/glest_game/world/world.cpp | 3 +++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/glest_game/type_instances/faction.cpp b/source/glest_game/type_instances/faction.cpp index 500e4138..9e101f0d 100644 --- a/source/glest_game/type_instances/faction.cpp +++ b/source/glest_game/type_instances/faction.cpp @@ -737,14 +737,11 @@ void Faction::removeStore(const UnitType *unitType){ limitResourcesToStore(); } -void Faction::limitResourcesToStore() -{ - for(int i=0; igetType()->getClass() != rcStatic && r->getAmount()>s->getAmount()) - { + if(r->getType()->getClass() != rcStatic && r->getAmount()>s->getAmount()) { r->setAmount(s->getAmount()); } } diff --git a/source/glest_game/type_instances/faction.h b/source/glest_game/type_instances/faction.h index d1d60fd1..0d6122a0 100644 --- a/source/glest_game/type_instances/faction.h +++ b/source/glest_game/type_instances/faction.h @@ -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); }; diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index 81709c4b..f2f99d2c 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -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();