From 8ac4fe6d5ba5091923c7fdf1fa88724d827706fa Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Fri, 26 May 2017 19:11:17 +0500 Subject: 2017-05-26 --- src/world/Block.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/world/Block.cpp') diff --git a/src/world/Block.cpp b/src/world/Block.cpp index 64e5330..3cf09db 100644 --- a/src/world/Block.cpp +++ b/src/world/Block.cpp @@ -2,9 +2,18 @@ Block::~Block() {} -Block::Block(unsigned short idAndState, unsigned char light) : id(idAndState >> 4), state(idAndState & 0x0F), - light(light) {} +Block::Block(unsigned short idAndState, unsigned char light) : id(idAndState >> 4), state(idAndState & 0x0F) {} -Block::Block(unsigned short id, unsigned char state, unsigned char light) : id(id), state(state), light(light) {} +Block::Block(unsigned short id, unsigned char state, unsigned char light) : id(id), state(state) {} -Block::Block() : id(0), state(0), light(0) {} +Block::Block() : id(0), state(0) {} + +bool operator<(const Block &lhs, const Block &rhs) { + if (lhs.id < rhs.id) + return true; + if (lhs.id == rhs.id) { + if (lhs.state != rhs.state) + return lhs.state < rhs.state; + } + return false; +} -- cgit v1.2.3