satoshinm / NetCraft

Web-based fork of fogleman/Craft ⛺
https://satoshinm.github.io/NetCraft/
MIT License
57 stars 13 forks source link

Boolification #110

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

https://github.com/satoshinm/NetCraft/issues/109

https://en.wikipedia.org/wiki/C_data_types#stdbool.h

satoshinm commented 7 years ago

Completed adding bools everywhere, or at least anywhere I could find int being used as a boolean. This is not without a downside: other forks of Craft may be difficult to merge back in, incorporating their changes. Can't go back easily.

But it does make the code significantly clearer, especially as parameters are passed in (is 0 meant to be an ordinal number, or false? no longer need to guess. same with 1 vs true), and in function return values (bool will always be one of two values, such as in bool hit_test_face, it returns true if the hit test was successful, not the block type hit, unlike int hit_test!)