diff --git a/TAPI b/TAPI index 1d99dc3..fdd1ab1 160000 --- a/TAPI +++ b/TAPI @@ -1 +1 @@ -Subproject commit 1d99dc3e99afb192299e85804a2e6b194c480bf6 +Subproject commit fdd1ab1a986473ec5fe97189e17e2f2ca012dc7a diff --git a/include/game.h b/include/game.h index a54970e..6d08d8b 100644 --- a/include/game.h +++ b/include/game.h @@ -24,9 +24,7 @@ public: bool operator==(const UserInfo& other) const; - constexpr bool operator!=(const UserInfo& other) const { - return other.id != id && other.username != username; - } + bool operator!=(const UserInfo& other) const; }; Game(); diff --git a/src/bot.cpp b/src/bot.cpp index 74320fb..cc38a6c 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -81,6 +81,8 @@ bool Bot::handleCallback(TelegramAPI::Manager* api, TelegramAPI::CallbackQuery& delret; } +#undef delret + void Bot::stop() { } diff --git a/src/game.cpp b/src/game.cpp index 6e6c583..29b3e89 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -14,6 +14,14 @@ bool Game::UserInfo::operator==(const UserInfo& other) const { return username == other.username; } +bool Game::UserInfo::operator!=(const UserInfo& other) const { + if(id != 0 && other.id != 0) { + return id != other.id; + } + + return other.username != username; +} + Game::Game() { for(uint_fast8_t i = 0; i < SIZE * SIZE; ++i) { field[i] = SYM::NONE; @@ -65,12 +73,16 @@ bool Game::isFull() const { } bool Game::turn(uint_fast8_t x, uint_fast8_t y, const UserInfo& player) { - if(!isInField(x, y)) return false; - if(!ready()) return false; + if(!isInField(x, y)) { + return false; + } + if(!ready()) { + return false; + } - Log::info << "turn player: " << player.id << " n: " << player.name << " u: " << player.username; - Log::info << "playerA: " << playerA.id << " n: " << playerA.name << " u: " << playerA.username << " e: " << (player == playerA); - Log::info << "playerB: " << playerB.id << " n: " << playerB.name << " u: " << playerB.username << " e: " << (player == playerB); + // Log::info << "turn player: " << player.id << " n: " << player.name << " u: " << player.username; + // Log::info << "playerA: " << playerA.id << " n: " << playerA.name << " u: " << playerA.username << " e: " << (player == playerA); + // Log::info << "playerB: " << playerB.id << " n: " << playerB.name << " u: " << playerB.username << " e: " << (player == playerB); // playerA