EmperorFool
Deity
I have just committed a smallish change that may have a big impact. When coding, you can now alt-tab out of the game, modify some Python, and alt-tab back in. All Python modules will be reloaded so you can see your changes immediately.
Now, this used to work before (partially), but PLE broke that feature entirely. Not only have I fixed the problems with PLE, but I've fixed the problems from the original Civ4 code as well!
The problem child was CvMainInterface, as usual. This screen is created only once and kept showing forever. The problem is that the Python objects holding its state are recreated when the modules are reloaded, but the interfaceScreen() function isn't called again.
My first attempt was to simply call that function after initializing BUG, but that broke the minimap. So I've split the function into two parts. The new part sets all of the instance variables (self.foo), leaving the interface-drawing code in interfaceScreen(). Whenever you add a new element to this screen, you need to make sure you split apart your code accordingly. Look at the examples; it's pretty straight-forward.
To be perfectly clear:
The initState() function must not draw on the screen.
and
The interfaceScreen() function must not create any instance (self.foo) or global variables. It is free to alter existing ones, however. Understand that after reloading Python modules, interfaceScreen() won't be called again.
Now, these are tricky areas and I was careful, but I wouldn't be surprised if we get new problems. So let me know ASAP if you see any crazy behavior.
Now, this used to work before (partially), but PLE broke that feature entirely. Not only have I fixed the problems with PLE, but I've fixed the problems from the original Civ4 code as well!
The problem child was CvMainInterface, as usual. This screen is created only once and kept showing forever. The problem is that the Python objects holding its state are recreated when the modules are reloaded, but the interfaceScreen() function isn't called again.
My first attempt was to simply call that function after initializing BUG, but that broke the minimap. So I've split the function into two parts. The new part sets all of the instance variables (self.foo), leaving the interface-drawing code in interfaceScreen(). Whenever you add a new element to this screen, you need to make sure you split apart your code accordingly. Look at the examples; it's pretty straight-forward.
To be perfectly clear:
The initState() function must not draw on the screen.
and
The interfaceScreen() function must not create any instance (self.foo) or global variables. It is free to alter existing ones, however. Understand that after reloading Python modules, interfaceScreen() won't be called again.
Now, these are tricky areas and I was careful, but I wouldn't be surprised if we get new problems. So let me know ASAP if you see any crazy behavior.