Yeah, lots of loops. I couldn't think of another way to do it that would allow both A)Store the shift and cap together, and B)If you go back below(or over) the cap, it comes back into effect.
Not sure the paired list would do the second one, there.
Yeah, googledocs doesn't work with C++ very well.

Grey Fox post this (//statement ? true : false

, let me get rid of a few if checks. I also changed the last bit of code, fixed the decay/storage rate...
Not sure if it's the way you guys intended to do it, but I set it so that the sqr of the current total shift (exact amount is done via a global define) is taken out of per-turn shift each turn. Makes it more difficult to reach large shifts. At the same time, though, every few turns a portion of that total shift is stored in a new variable... This one is immune to the decay. Means that the farther you get from the base alignment, the slower it is... But you can still get there.
As of now I'm fairly satisfied with the mechanic. Needs actual values/balance work, but that will come after the next phase of my expansion....
Edit: Updated the GoogleDocs code.
My last post, btw, was related to the global defines for the decay/storage rates.... The values in xml were floats, but I was calling them as an int.
