[Done] Windowing refactoring
#1
I think we've hit the spot when patching up the cWindow and the jewelry around it is no longer feasible. It's time for refactoring this part of the code. Currently (rev 850-ish), chests aren't working and some windows are near impossible to implement (doublechest).

I propose a change like this:
A window is made up of several "areas". These areas each correspond to slots with a similar purpose. For example, the inventory area, or the crafting grid area, or chest storage area. Each area knows its items, the number of slots and whether it's per-player (inventory), global (chest) or temporary (crafting grid). A common ancestor for the area classes knows how to handle clicks within that area.

A window, then, is a collection of these areas, with slot numbers assigned ascending for each area. The window object is then just a simple container class that redirects click events to the individual areas and receives update commands from areas (furnace smelting etc.) A Window can be bound to a block (chest) or to an entity (player, storage minecart). A single window object can be shared among multiple players.

As for shift-clicks, they are moving stuff between areas automagically, so we need a way for an area to call out to other areas and ask them, "Do you want this stack? And how much of it?" This should be easy to route through the parent window. If not for any reason, then the parent window could be subclassed for the wanted functionality.

Comments, ideas?
Reply
Thanks given by:


Messages In This Thread
[Done] Windowing refactoring - by xoft - 09-10-2012, 06:19 AM
RE: Windowing refactoring - by Taugeshtu - 09-10-2012, 06:40 AM
RE: Windowing refactoring - by xoft - 09-10-2012, 06:45 AM
RE: Windowing refactoring - by FakeTruth - 09-10-2012, 06:41 AM
RE: Windowing refactoring - by Taugeshtu - 09-10-2012, 06:57 AM
RE: Windowing refactoring - by xoft - 09-14-2012, 04:14 AM
RE: Windowing refactoring - by NiLSPACE - 09-17-2012, 04:49 AM
RE: Windowing refactoring - by xoft - 09-17-2012, 04:52 AM
RE: Windowing refactoring - by NiLSPACE - 09-17-2012, 05:00 AM
RE: Windowing refactoring - by xoft - 09-17-2012, 05:14 AM
RE: Windowing refactoring - by xoft - 09-20-2012, 10:21 PM
RE: Windowing refactoring - by xoft - 09-21-2012, 06:03 AM
RE: Windowing refactoring - by xoft - 09-22-2012, 06:57 AM
RE: [Done] Windowing refactoring - by NiLSPACE - 09-22-2012, 07:07 AM
RE: [Done] Windowing refactoring - by xoft - 09-22-2012, 07:11 AM
RE: [Done] Windowing refactoring - by NiLSPACE - 09-22-2012, 07:19 AM
RE: [Done] Windowing refactoring - by xoft - 09-22-2012, 07:35 AM



Users browsing this thread: 1 Guest(s)