| 328 | } |
| 329 | |
| 330 | bool Seat::hasVisionOnTile(Tile* tile) |
| 331 | { |
| 332 | if(!mGameMap->isServerGameMap()) |
| 333 | { |
| 334 | // On client side, we check only for the local player |
| 335 | if(this != mGameMap->getLocalPlayer()->getSeat()) |
| 336 | return false; |
| 337 | |
| 338 | return tile->getLocalPlayerHasVision(); |
| 339 | } |
| 340 | |
| 341 | // AI players have vision on every tile |
| 342 | if(mPlayer == nullptr) |
| 343 | return true; |
| 344 | if(!mPlayer->getIsHuman()) |
| 345 | return true; |
| 346 | |
| 347 | if(tile->getX() >= static_cast<int>(mTilesStates.size())) |
| 348 | { |
| 349 | OD_LOG_ERR("Tile=" + Tile::displayAsString(tile)); |
| 350 | return false; |
| 351 | } |
| 352 | if(tile->getY() >= static_cast<int>(mTilesStates[tile->getX()].size())) |
| 353 | { |
| 354 | OD_LOG_ERR("Tile=" + Tile::displayAsString(tile)); |
| 355 | return false; |
| 356 | } |
| 357 | |
| 358 | TileStateNotified& stateTile = mTilesStates[tile->getX()][tile->getY()]; |
| 359 | |
| 360 | return stateTile.mVisionTurnCurrent; |
| 361 | } |
| 362 | |
| 363 | void Seat::initSeat() |
| 364 | { |
no test coverage detected