#3189 closed enhancement (fixed)
GuiInterface/Mirage code cleanup
Reported by: | leper | Owned by: | leper |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 19 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Itms, sanderd17, mimo | Patch: |
Description
Currently GuiInterface has some strange constructs to get the correct data for miraged entities. The attached patch (incomplete (not removing Health() etc makes it work), wip) adds a QueryMiragedInterface to get cmpMirage or the implementation of that interface.
This might cause some issues if cmpMirage doesn't provide functions (for examples see GuiInterface uses) that are used, but those errors should be easy to detect.
Providing the same interface makes client code a lot simpler and less error prone (wrong ordering).
Attachments (2)
Change History (7)
by , 9 years ago
Attachment: | guiinterface_mirage_cleanup.diff added |
---|
by , 9 years ago
Attachment: | QueryMiragedInterface.diff added |
---|
comment:1 by , 9 years ago
Cc: | added |
---|---|
Keywords: | patch review added |
The above patch adds QueryMiragedInterface
and uses that where applicable. It also exposes some more functions via cmpMirage
(which eg allows to display the amount of builders when the entity was last seen (not implemented)).
During this process I noticed that cmpResourceSupply.GetGatherers()
is not really needed by most of the code (except AI, though I didn't dig into that; so that's why I'm CCing mimo) so I added a cmpResourceSupply.GetNumGatherers()
and cleaned up both by using arrow functions.
comment:3 by , 9 years ago
In fact, the AI also uses only the number of gatherers. I've changed the code accordingly, and in your patch, line 284 of AIProxy.js should better be changed to use the new function GetNumGatherers.
comment:5 by , 9 years ago
Keywords: | review removed |
---|
Thanks for the comments. Still needs code to serialize Set
in the engine (similar to #2475).
wip (as in incomplete); slightly broken (removes Health() and similar though still used (see first point))