| 444 | } |
| 445 | |
| 446 | void Building::notifySeatVision(Tile* tile, Seat* seat) |
| 447 | { |
| 448 | if(seat->getPlayer() == nullptr) |
| 449 | return; |
| 450 | if(!seat->getPlayer()->getIsHuman()) |
| 451 | return; |
| 452 | |
| 453 | TileData* tileData = mTileData[tile]; |
| 454 | auto it = std::find(tileData->mSeatsVision.begin(), tileData->mSeatsVision.end(), seat); |
| 455 | if(tileData->mHP <= 0) |
| 456 | { |
| 457 | // We remove the seat |
| 458 | if(it == tileData->mSeatsVision.end()) |
| 459 | { |
| 460 | OD_LOG_ERR("building=" + getName() + ", tile=" + Tile::displayAsString(tile)); |
| 461 | return; |
| 462 | } |
| 463 | |
| 464 | tileData->mSeatsVision.erase(it); |
| 465 | return; |
| 466 | } |
| 467 | |
| 468 | // We add vision |
| 469 | if(it == tileData->mSeatsVision.end()) |
| 470 | tileData->mSeatsVision.push_back(seat); |
| 471 | } |
| 472 | |
| 473 | TileData* Building::createTileData(Tile* tile) |
| 474 | { |
no test coverage detected