Refactored reversing logic into seperate function
This commit is contained in:
parent
3a7c0c8ce9
commit
6fa99a211e
@ -274,8 +274,19 @@ inline eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline eBlockFace ReverseBlockFace(eBlockFace a_BlockFace)
|
||||||
|
{
|
||||||
|
switch (a_BlockFace)
|
||||||
|
{
|
||||||
|
case BLOCK_FACE_YP: return BLOCK_FACE_YM;
|
||||||
|
case BLOCK_FACE_XP: return BLOCK_FACE_XM;
|
||||||
|
case BLOCK_FACE_ZP: return BLOCK_FACE_ZM;
|
||||||
|
case BLOCK_FACE_YM: return BLOCK_FACE_YP;
|
||||||
|
case BLOCK_FACE_XM: return BLOCK_FACE_XP;
|
||||||
|
case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
|
||||||
|
default: return a_BlockFace;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns the textual representation of the BlockFace constant. */
|
/** Returns the textual representation of the BlockFace constant. */
|
||||||
|
@ -499,20 +499,9 @@ void cIncrementalRedstoneSimulator::HandleRedstoneLever(int a_RelBlockX, int a_R
|
|||||||
SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
|
SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
|
||||||
|
|
||||||
eBlockFace Dir = cBlockLeverHandler::BlockMetaDataToBlockFace(Meta);
|
eBlockFace Dir = cBlockLeverHandler::BlockMetaDataToBlockFace(Meta);
|
||||||
switch (Dir) // Now, flip the direction into the type used by SetBlockLinkedPowered()
|
|
||||||
{
|
Dir = ReverseBlockFace(Dir);
|
||||||
case BLOCK_FACE_YP: Dir = BLOCK_FACE_YM; break;
|
|
||||||
case BLOCK_FACE_XP: Dir = BLOCK_FACE_XM; break;
|
|
||||||
case BLOCK_FACE_ZP: Dir = BLOCK_FACE_ZM; break;
|
|
||||||
case BLOCK_FACE_YM: Dir = BLOCK_FACE_YP; break;
|
|
||||||
case BLOCK_FACE_XM: Dir = BLOCK_FACE_XP; break;
|
|
||||||
case BLOCK_FACE_ZM :Dir = BLOCK_FACE_ZP; break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
ASSERT(!"Unhandled lever metadata!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Dir);
|
SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user