Fix optional resources.

Correctly set the optional flag in the ResourceRate constructor and
preserve it when building the output rates array.
Correct some whitespace issues.
Add the OutputRates to the final list.

I had failed to notice the difference between OutputRatios and OutputRates
(I was wondering why things were done twice...)
Cache loaded rates
Merge branch 'taniwha-optional-resource-fix' into develop