whoward69
DLL Minion
Why do I do this? It seemed so simple! All I wanted to do was open the City View screen in Buy Plot mode from within the DLL/C++ code.
In theory, 4 lines of code, taken from the "Select Next City" and "Open City View" keyboard short-cuts code, plus one line to select the mode (same as clicking the Buy Plots button)
There appear to be internal sequencing issues within those calls caused by the camera moving and zooming. Most of the time you'll get the capital, regardless of what pCity is, some times the correct city, never the buy plots screen - although it may flash on and off as if taunting you as the camera pans across the map!
None of this is helped by not having the DLLUI source code
11 hours later I have a C++/Lua solution (that involves the C++ code "opening" a Lua dialog pop-up which opens the City View screen and fakes the Buy Plots button) - did I mention the sequencing issues in the Lua UI methods caused by the camera panning/zooming ...
So the moral of the tail. Avoid DLLUI-> like the plague (unless you have a lot of free time on your hands!) Or if you don't, don't try and do something that the devs didn't need themselves
EDIT: The answer to the question "Why?" is in the spoiler/thumbnail
In theory, 4 lines of code, taken from the "Select Next City" and "Open City View" keyboard short-cuts code, plus one line to select the mode (same as clicking the Buy Plots button)
Code:
DLLUI->selectCity(GC.WrapCityPointer(pCity).get());
DLLUI->setInterfaceMode(INTERFACEMODE_PURCHASE_PLOT);
DLLUI->selectLookAtCity();
DLLUI->lookAtSelectionPlot();
There appear to be internal sequencing issues within those calls caused by the camera moving and zooming. Most of the time you'll get the capital, regardless of what pCity is, some times the correct city, never the buy plots screen - although it may flash on and off as if taunting you as the camera pans across the map!
None of this is helped by not having the DLLUI source code

11 hours later I have a C++/Lua solution (that involves the C++ code "opening" a Lua dialog pop-up which opens the City View screen and fakes the Buy Plots button) - did I mention the sequencing issues in the Lua UI methods caused by the camera panning/zooming ...
So the moral of the tail. Avoid DLLUI-> like the plague (unless you have a lot of free time on your hands!) Or if you don't, don't try and do something that the devs didn't need themselves

EDIT: The answer to the question "Why?" is in the spoiler/thumbnail

Spoiler :