I'm very confused with deques/vectors. My current issue is that still I get 'vector not incrementable' if I use SetBlock (which pushes blocks to be ticked into a deque), but not so with FastSetBlock (which doesn't do any updates).
A general view of the problem is like this:
I have no idea why, and pistons are broken because the QueueSetBlock. The only time I delete entries is with:
Is it because I can't have two (processes?) accessing a deque at the same time, and will therefore need a lock?
Yay, a
A general view of the problem is like this:
cRedstoneSimulator::WakeUp { ... case E_BLOCK_REDSTONE_TORCH m_Blocks.push_back(x, y, z) ... } cRedstoneSimulator::Simulate { for (BlockList::iterator itr = m_Blocks.begin(); itr != m_Blocks.end(); ++itr) // BlockList is a std::vector <Vector3i> { BLOCKTYPE Block = m_World.GetBlock(*itr) ... case E_BLOCK_REDSTONE_TORCH HandleRedstoneTorch(*itr) ... } } cRedstoneSimulator::HandleRedstoneTorch(Vector3i a_BlockPos) { ... (Powered torch?) // This tells me that vectors are not incrementable m_World.SetBlock(a_BlockPos, E_BLOCK_REDSTONE_TORCH_OFF, 0) // This works fine m_World.FastSetBlock(a_BlockPos, E_BLOCK_REDSTONE_TORCH_OFF, 0) ... }
I have no idea why, and pistons are broken because the QueueSetBlock. The only time I delete entries is with:
m_Blocks.clear()...at the end.
Is it because I can't have two (processes?) accessing a deque at the same time, and will therefore need a lock?
Yay, a
cCriticalSection m_Cs;did it. Are critical sections good? I have no idea what they are.