It appears that trade is not being properly accounted for in the wealth run rate at the top of the Population (F2) screen.
At the end of a recent econ update, the top of my F2 screen said I had 65551 wealth, with a run rate of -122. Over the next few days, the run rate gradually dropped; after 4 days (i.e. just before the next econ update, since I was using 1-day updates) it stood at 65604 wealth, and a run rate of -69. Hitting a 1-day update (and going through the econ cycle) it was back to 65503 and -112. The correct run rate would be -48.
It appears that what is going on is that the code to refresh the run rate during an econ update is just comparing the wealth of the start of the update to the wealth at the end - this is ignoring the trade that flowed in during the 5-day.
I believe you are correct. At the start of an update the existing wealth is recorded for the Race as PreviousWealth and the run rate is always the current wealth minus the PreviousWealth.
Assume that a Race has 1100 wealth and is losing 100 during every economic update. At the start of the first economic update the PreviousWealth will be recorded as 1100. Once the update is over, the current wealth will be 1000 and the run rate will correctly show -100. Now lets assume that the race starts to generate trade income and 40 comes in before the start of the next economic update. Before that update takes place, the current wealth will be 1040 and the run rate will show as -60. The program will then record the current Wealth as PreviousWealth (1040) and run the update, using up another 100 wealth and taking the current wealth to 940. This will result in a run rate of -100, whereas in reality the difference between the wealth situation at the end of the first and second updates is only -60.
Therefore I think I need to also record the wealth at the end of an update as well. I'll call it StartingWealth. Now what I do is record the PreviousWealth figure as the previous StartingWealth rather than the current wealth. Using the same scenario as above, that means after the first update the PreviousWealth will still be 1100 (as no trade is involved yet) and I will also record a StartingWealth figure of 1000 after the update is completed. The current wealth is 1000 so the run rate (current wealth minus the PreviousWealth) is -100. Now the 40 trade comes in and takes the current wealth to 1040. However, at the start of the next update I record PreviousWealth as 1000 as that is the StartingWealth figure (not the current wealth). After the update is complete and 100 has been deducted from the 1040 current wealth, leaving 940, I record the new StartingWealth figure of 940. The run rate is now -60 (current wealth minus the PreviousWealth figure of 1000), which is also correct.
Going through one more update to check it works. Assume 30 trade income before the next update, which takes the current wealth to 970. At the start of the next update I record PreviousWealth as 940 (which was is the StartingWealth from above) and run the update. The -100 during the update takes the current wealth figure to 870, which is recorded as the new StartingWealth. The run rate is now -70 (current wealth minus the PreviousWealth figure of 940), which is correct compared to the same point after the last update.
Steve