No Description

block.cpp 659B

1234567891011121314151617181920212223242526272829
  1. #include "block.h"
  2. Block::Block() {
  3. }
  4. Block::Block(uint16_t word)
  5. {
  6. tile = word & 0x3ff;
  7. collision = (word >> 10) & 0x3;
  8. elevation = (word >> 12) & 0xf;
  9. }
  10. Block::Block(const Block &block) {
  11. tile = block.tile;
  12. collision = block.collision;
  13. elevation = block.elevation;
  14. }
  15. uint16_t Block::rawValue() {
  16. return (tile & 0x3ff) + ((collision & 0x3) << 10) + ((elevation & 0xf) << 12);
  17. }
  18. bool Block::operator ==(Block other) {
  19. return (tile == other.tile) && (collision == other.collision) && (elevation == other.elevation);
  20. }
  21. bool Block::operator !=(Block other) {
  22. return !(operator ==(other));
  23. }