Hey guys!
I believe I tracked down the bug that was described here:
https://forums.civfanatics.com/thre...-bugs-and-todos.449958/page-116#post-14964697
The correct code in CvCity.cpp, lines 1015 and 1016 should imo be:
Code:
1015 setImportsLimit((YieldTypes) iData1, (iData2 >> 16) & 0xFFFF); //shift and then mask, because never trust that 0s are shifted in from the left
1016 setMaintainLevel((YieldTypes) iData1, iData2 & 0xFFFF);
My reasoning is this:
-) In CvDLLButtonPopup.cpp on lines 3054 and 3056 it is established that the import limit goes to the spinbox with id "NUM_YIELD_TYPES+iYield" and the export limit/maintain level goes to the spinbox with id "iYield".
Code:
3054 gDLL->getInterfaceIFace()->popupCreateSpinBox(pPopup, iYield, L"", pCity->getMaintainLevel(eYield), 10, 999, 0);
3056 gDLL->getInterfaceIFace()->popupCreateSpinBox(pPopup, NUM_YIELD_TYPES+iYield, L"", pCity->getImportsLimit(eYield), 10, 999, 0);
-) In CvDLLButtonPopup.cpp on line 823 and lines 831 through 836 the values are concatenated with the import limit in the left 16 bits and the export limit/maintain level in the right 16 bits.
Code:
823 int iLevel = pPopupReturn->getSpinnerWidgetValue(iYield);
831 int iMaxLevel = pPopupReturn->getSpinnerWidgetValue(NUM_YIELD_TYPES + iYield);
832 bool bImportsLimitChanged = iMaxLevel != pCity->getImportsLimit(eYield);
833
834 int iBuffer = (iMaxLevel << 16);
835 iBuffer |= iLevel & 0xFFFF;
836 iLevel = iBuffer;
I have seen Erik Sandbraaten made this commit:
https://sourceforge.net/p/religion-.../ci/add7113453a6af836042e761b286033d0174e61c/
which, as far as I can tell from looking at the code, introduced this behavior.
I am pretty confident I got this one right. I did not build and test it, but because as of how the code is, the workaround for this bug, when I want to change import/exp limits, is to open the import/exp dialog, close it again (then the values are switched) then open it again, make my changes - to the spinbox of the other value - and then close it again. And this workaround works perfectly.
Can I wish for something as a bug finding and solution providing reward?
1) Please fix at least the bug and make a 2.7.1beta3 for download asap. Because I have no means to compile this for the next time. And I would like to keep playing without that workaround.
2) If you want to give me even more, make the value for the import limit go to the left spinbox and the export limit to the right one. Because this is far more intuitive. Left spinbox below checkbox "Import" and right spinbox below checkbox "Export". I did not check all the code, but I believe it should be along simply switching the IDs of the spinboxes ("NUM_YIELD_TYPES + iYield" and "iYield") in all function calls.
And/Or even better: Add lables. "Import up to" and "Export down to". When I played my first time 2 years ago or so, it took me quite some time to figure out what the spinboxes are for and what value should go where.
Thanks a bunch!