Originally posted by E
Ok, I think I figured what you are saying and it compiles and it works EXCEPT I removed the
Ok, I think I figured what you are saying and it compiles and it works EXCEPT I removed the
Code:
((m_buyingResources[g] + m_collectingResources[g]) > 0)
Originally posted by E
Not sure how to fit that back in... but here is the code and i did anothre compiled revision
Not sure how to fit that back in... but here is the code and i did anothre compiled revision
Code:
if(rec->GetNumNeedsCityGood() > 0) { sint32 g; bool found = false; for(g = 0; g < rec->GetNumNeedsCityGood(); g++) { if((HasResource(rec->GetNeedsCityGoodIndex(g))) || m_buyingResources[rec->GetNeedsCityGoodIndex(g)]) found = true; break; } if(!found) return FALSE; }
And the code does not do what it is supposed to do. If in the array is just one good than it is ok, but if there are more goods in the list that are supposed to be checked these aren't checked. The break breaks the loop in its first iteration. So what did I tell you about brace-blocks?
And one thing I should have done at first is to insist on the indention, the if(!found) is on the same level as the for loop.
-Martin
Comment