Get light from chunk
#5
It's not a big deal :
- BlockDataReader is proposing a pure virtual read(Chunk&, BlockId) method, that is implemented by BlockTypeReader, BlockMetaReader, BlockLightReader, BlockDayLightReader.... whatever you want
- Chunk::UnBoundGetXXX receive a BlockDataReader& and call it's read method (not knowing what is read).
- Finally the value can be retrieved from the BlockDataReader object.

Additionally, I made a Composite of BlockDataReader, that allow to pass multiple reader to the same method call.

Edit 2 : Additionally, I add a templated value-storing intermediate class.

As you responded on GitHub, I assume You've already red it anyway.
Thanks

Edit : I often encourage my teams to work that way. Very short classes with very few and very short public methods. Each one having a small (and so easy to fulfill) responsibility. The may picture being drawn by assembling those small parts. Of course, we cannot do that here because :
1. the history is strong, there would be a lot to do
2. what we get in terms of maintainability, we may lose it (or some) in terms performances.
Reply
Thanks given by:


Messages In This Thread
Get light from chunk - by mgueydan - 09-08-2013, 09:08 PM
RE: Get light from chunk - by xoft - 09-09-2013, 01:02 AM
RE: Get light from chunk - by mgueydan - 09-11-2013, 01:08 AM
RE: Get light from chunk - by xoft - 09-11-2013, 01:24 AM
RE: Get light from chunk - by mgueydan - 09-11-2013, 02:02 AM
RE: Get light from chunk - by xoft - 09-11-2013, 03:54 PM



Users browsing this thread: 1 Guest(s)