* Why not ```!ret->produce.nonZero()``` instead of checking each resource separately?
* since the second part of if is repeated, you should make it a single if and nest the rest within it
* assigning proper resources count depending on building id could be done using a switch or, even better,  std::map<BuildingID, TResources>.