cBlockArea:Write() quasi-randomly triggering assertion
#1
So, it seems that cBlockArea:Write()'s assertion line
ASSERT((a_DataTypes & GetDataTypes()) == a_DataTypes);
is randomly triggering, Russian Roulette style.

For instance, for a simple plugin I wrote to test some changes:

function OnPlayerUsedItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType, BlockMeta)

local Area = cBlockArea();
Area:Read(Player:GetWorld(),
        BlockX - MOVER_SIZE_X, BlockX + MOVER_SIZE_X,
        BlockY - MOVER_SIZE_Y, BlockY + MOVER_SIZE_Y,
        BlockZ - MOVER_SIZE_Z, BlockZ + MOVER_SIZE_Z,
        cBlockArea().baMetas + cBlockArea().baTypes
    );
    --[[
if (Player:GetEquippedItem().m_ItemType == E_ITEM_EMERALD) then
    print("RotateCW Test\n");
    Area:RotateCW();
elseif (Player:GetEquippedItem().m_ItemType == E_ITEM_DIAMOND) then
    print("RotateCCW Test\n");
    Area:RotateCCW();
    end
    ]]
    Area:Write(
        Player:GetWorld(),
        BlockX - MOVER_SIZE_X,
        BlockY - MOVER_SIZE_Y,
        BlockZ - MOVER_SIZE_Z,
        cBlockArea().baMetas + cBlockArea().baTypes
    );
    return false;
end

I will enter the game and right-click a block. The first time everything works fine and I've set a break point up to check this; Both the passed datatype and the datatype of the object are the same.

I will then click a second time. The Write function will run correctly at first, but then it runs a second time immediately afterwards and this time the object has a datatype of "0," so the assertion triggers.

I don't know why it's doing this, and it's getting in the way of fixing an unrelated issue (Implementing Rotation functions for the block handlers.)
Reply
Thanks given by:


Messages In This Thread
cBlockArea:Write() quasi-randomly triggering assertion - by Narroo - 02-22-2014, 06:15 AM



Users browsing this thread: 1 Guest(s)