MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / notifySeatVision

Method notifySeatVision

source/entities/Building.cpp:446–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444}
445
446void 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
473TileData* Building::createTileData(Tile* tile)
474{

Callers 1

Calls 2

getIsHumanMethod · 0.80
getPlayerMethod · 0.45

Tested by

no test coverage detected