| 383 | } |
| 384 | |
| 385 | bool TrapDoor::canDoorBeOnTile(GameMap* gameMap, Tile* tile) |
| 386 | { |
| 387 | // We check if the tile is suitable. It can only be built on 2 full tiles |
| 388 | Tile* tileW = gameMap->getTile(tile->getX() - 1, tile->getY()); |
| 389 | Tile* tileE = gameMap->getTile(tile->getX() + 1, tile->getY()); |
| 390 | |
| 391 | if((tileW != nullptr) && |
| 392 | (tileE != nullptr) && |
| 393 | tileW->isFullTile() && |
| 394 | tileE->isFullTile()) |
| 395 | { |
| 396 | // Ok |
| 397 | return true; |
| 398 | } |
| 399 | |
| 400 | Tile* tileS = gameMap->getTile(tile->getX(), tile->getY() - 1); |
| 401 | Tile* tileN = gameMap->getTile(tile->getX(), tile->getY() + 1); |
| 402 | if((tileS != nullptr) && |
| 403 | (tileN != nullptr) && |
| 404 | tileS->isFullTile() && |
| 405 | tileN->isFullTile()) |
| 406 | { |
| 407 | // Ok |
| 408 | return true; |
| 409 | } |
| 410 | |
| 411 | return false; |
| 412 | } |
| 413 | |
| 414 | bool TrapDoor::permitsVision(Tile* tile) |
| 415 | { |
nothing calls this directly
no test coverage detected