Some background:
I'm using multiple map controls to display the player's inventory and crafting windows. When I update the Inventory window I need to clear the map control inside to refresh it. The only way I can think to do this is by using:
src.client.screen = null
The problem with this is if my crafting window is open, or there are any other elements on the screen, they ALL get reset and also need to be refreshed.
Is there a way I can "null" the map control inside the Inventory window without nulling the entire client screen?
I should mention I'm starting from Schnitzelnagler's Crafting Demo, which creates a Grid inside the map to hold each item in the user's contents.
Each time the inventory is opened, this code is called: mob/verb/UpdateInv() Is this still the "wrong" way of using a map? I use the same system for the crafting window, but they're conflicting because of the "src.client.screeen = null" to reset the inventory. Without the line, the inventory window stacks a Grid on a new layer above the old each time it's opened. |
Tooffless wrote:
Is this still the "wrong" way of using a map? Very much so. Right here: for(var/Grid/G in src.client.screen) If you ever loop over the world or screen looking for something specific, you've designed your data structures incorrectly. You aren't hanging on to data how you should be. I wrote a whole snippet sunday on this topic. |
Heard. Reading through all of that (including the wild-ass comments...), I've come to the realization that I just need to rework A LOT of the system lol.
Thanks a lot for putting me on a new path so I didn't waste a bunch of time making things worse. |
You might also see some value from this post
BYOND has come a long way. We no longer jam hundreds of objects into the screen, because we have something better now: vis_contents. Check out the bit specifically about UI widgets in the post I linked. There's a better way than what schnitzelnagler had access to in '09. |
There is no built in way to filter screen objects by which map control they are showing on, and you should avoid doing it, because it's extra work on the server for something you should be tracking yourself.