Index: ps/trunk/binaries/data/mods/public/simulation/components/ResourceSupply.js
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/components/ResourceSupply.js
+++ ps/trunk/binaries/data/mods/public/simulation/components/ResourceSupply.js
@@ -5,6 +5,9 @@
"" +
"1000" +
"food.meat" +
+ "false" +
+ "25" +
+ "0.8" +
"" +
"" +
"" +
@@ -120,9 +123,7 @@
ResourceSupply.prototype.IsAvailable = function(player, gathererID)
{
- if (this.GetNumGatherers() < this.GetMaxGatherers() || this.gatherers[player].indexOf(gathererID) !== -1)
- return true;
- return false;
+ return this.amount > 0 && (this.GetNumGatherers() < this.GetMaxGatherers() || this.gatherers[player].indexOf(gathererID) !== -1);
};
ResourceSupply.prototype.AddGatherer = function(player, gathererID)
Index: ps/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
+++ ps/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
@@ -70,7 +70,5 @@
TS_ASSERT_UNEVAL_EQUALS(cmpResourceSupply.TakeResources(800), { "amount": 700, "exhausted": true });
TS_ASSERT_EQUALS(cmpResourceSupply.GetCurrentAmount(), 0);
-// The following assertion is not expected
-// The resource should not be available when exhausted
-// (even if the entity is in the destroy queue)
-TS_ASSERT(cmpResourceSupply.IsAvailable(1, 70));
+// The resource is not available when exhausted
+TS_ASSERT(!cmpResourceSupply.IsAvailable(1, 70));