Block updating
Posted: Tue Oct 25, 2011 21:19
I'm quite in trouble when updating a block.
As you can see from my fork I'm trying to implement a "modular door", as suggested in a post. I need to use quite a lot the NodeMetadata class to define properties and let a single node handle every "child" (if a portion of a door is opened, for example, every node must be "opened"). To make the code run smooth I decided to let the doors handle pointers to parent and children. And that's the problem: when a TOCLIENT_BLOCKDATA command is sent, the new block is naturally deserialized. But the deserialization process is gradual, and the client crashes exactly when the MapNode and NodeMetadata information is partially saved in the MapBlock.
I thought to one solution (and maybe it could be THE solution, but I need your help) for this problem: I added the method MapSector::setBlock, to which a Mapblock object is passed (like MapSector::insertBlock) and sets (instead of inserting) the new node and then deleting the old one. The problem is... the client "flashes" when the block is completely rewritten.
So... what do you think I can do? Mutex-ing the client so a block is not rendered as new when it's rewritten? Making a new command to explicitly update Metadata? I'm trying to find a good solution, but I'm quite short of ideas.
I'll wait for your help!
-- dodomorandi
As you can see from my fork I'm trying to implement a "modular door", as suggested in a post. I need to use quite a lot the NodeMetadata class to define properties and let a single node handle every "child" (if a portion of a door is opened, for example, every node must be "opened"). To make the code run smooth I decided to let the doors handle pointers to parent and children. And that's the problem: when a TOCLIENT_BLOCKDATA command is sent, the new block is naturally deserialized. But the deserialization process is gradual, and the client crashes exactly when the MapNode and NodeMetadata information is partially saved in the MapBlock.
I thought to one solution (and maybe it could be THE solution, but I need your help) for this problem: I added the method MapSector::setBlock, to which a Mapblock object is passed (like MapSector::insertBlock) and sets (instead of inserting) the new node and then deleting the old one. The problem is... the client "flashes" when the block is completely rewritten.
So... what do you think I can do? Mutex-ing the client so a block is not rendered as new when it's rewritten? Making a new command to explicitly update Metadata? I'm trying to find a good solution, but I'm quite short of ideas.
I'll wait for your help!
-- dodomorandi