GSOC Day 12 – Resource Overlay
My task today was to convert the Resources overlay to work with tp04. This mostly involved updating the ways in which it dealt with positions and resource counts, and since I already had functions to work with both, it was a relatively straightforward task. Or so I thought.
The first complication was that there were multiple places in the code where no errors appeared but updates still had to be made. For instance, there might be a check that always would show an object having no resources, so no error would be thrown but it would skip the rest of the function. I eventually found all of these.
The other problem took me quite some time to work out – even after replacing all instances of outdated code, I still couldn’t get anything to draw on the overlay, and then the program would busy-loop and freeze. I tried numerous changes, but none of them seemed to help until I decided to test a replacement of the underlying “Proportional” overlay class with the “Systems” overlay, which I already knew would draw. This did finally draw, so I realized that something in the Proportional class’s UpdateAll() or UpdateOne() methods was causing the problem. I couldn’t just remove the UpdateAll() method, because the base class’s methods don’t draw with different sizes and in the proper order. I was able, however, to delete the UpdateOne() method and add in a call to the base class’s UpdateAll(), and this finally fixed the problem.
Here’s a screenshot of the new Resources overlay in action:
After I finish up this set of patches tomorrow, I’ll be starting on the Orders panel. Mithro seems confident that the Orders changes won’t be terribly difficult, so here’s hoping.