diff --git a/logic.c b/logic.c index e5ea9de..ed7c153 100644 --- a/logic.c +++ b/logic.c @@ -30,12 +30,12 @@ static inline int heightMask( const int a ){ return ( 1 << a ) - 1; } -static inline int safeHeigthMask( const int a ){ +static inline int safeHeightMask( const int a ){ return a > 0 ? heightMask( a ) : 0; } -static inline int bottomHeigthMask( const int a, const int b ){ - return safeHeigthMask( bottom( a, b ) ); +static inline int bottomHeightMask( const int a, const int b ){ + return safeHeightMask( bottom( a, b ) ); } void playMove( @@ -73,7 +73,7 @@ void calcWins( wins->same.vertical2 [ i ] = ~( board.column [ i ] ^ board.column [ i ] >> 1 ) - & safeHeigthMask( board.height [ i ] - 1 ); + & safeHeightMask( board.height [ i ] - 1 ); // Actually check for win wins->same.vertical4 [ i ] = wins->same.vertical2 [ i ] @@ -99,21 +99,21 @@ void calcWins( wins->same.horizontal2 [ i ] = ~( board.column [ i ] ^ board.column [ i + 1 ] ) - & bottomHeigthMask( + & bottomHeightMask( board.height [ i ], board.height [ i + 1 ] ); wins->same.diagonalUp2 [ i ] = ~( board.column [ i ] ^ board.column [ i + 1 ] >> 1 ) - & bottomHeigthMask( + & bottomHeightMask( board.height [ i ], board.height [ i + 1 ] - 1 ); wins->same.diagonalDown2 [ i ] = ~( board.column [ i ] ^ board.column [ i + 1 ] << 1 ) - & bottomHeigthMask( + & bottomHeightMask( board.height [ i ], board.height [ i + 1 ] + 1 )