[Avida-SVN] r2344 - development/source/cpu
dknoester at myxo.css.msu.edu
dknoester at myxo.css.msu.edu
Tue Feb 19 08:08:42 PST 2008
Author: dknoester
Date: 2008-02-19 11:08:42 -0500 (Tue, 19 Feb 2008)
New Revision: 2344
Modified:
development/source/cpu/cHardwareCPU.cc
Log:
Bugfix in if-resources instruction.
Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc 2008-02-19 14:39:09 UTC (rev 2343)
+++ development/source/cpu/cHardwareCPU.cc 2008-02-19 16:08:42 UTC (rev 2344)
@@ -3128,7 +3128,8 @@
bool cHardwareCPU::Inst_IfResources(cAvidaContext& ctx)
{
// These are the current levels of resources at this cell:
- const tArray<double>& resources = organism->GetOrgInterface().GetResources();
+ const tArray<double> resources = organism->GetOrgInterface().GetResources() +
+ organism->GetOrgInterface().GetDemeResources(organism->GetOrgInterface().GetDemeID());
// Now we loop through the different reactions, checking to see if their
// required resources are below what's available. If so, we skip ahead an
@@ -3140,7 +3141,7 @@
while(!processes.AtEnd()) {
const cReactionProcess* proc = processes.Next();
cResource* res = proc->GetResource(); // Infinite resource == 0.
- if((res != 0) && (proc->GetMinNumber() < resources[res->GetID()])) {
+ if((res != 0) && (resources[res->GetID()] < proc->GetMinNumber())) {
IP().Advance();
return true;
}
More information about the Avida-cvs
mailing list