| 464 | } |
| 465 | |
| 466 | void Trap::exportTileDataToStream(std::ostream& os, Tile* tile, TileData* tileData) const |
| 467 | { |
| 468 | TrapTileData* trapTileData = static_cast<TrapTileData*>(tileData); |
| 469 | os << "\t" << (trapTileData->isActivated() ? 1 : 0); |
| 470 | if(getGameMap()->isInEditorMode()) |
| 471 | return; |
| 472 | |
| 473 | os << "\t" << trapTileData->mHP; |
| 474 | os << "\t" << trapTileData->getReloadTime(); |
| 475 | os << "\t" << trapTileData->getNbShootsBeforeDeactivation(); |
| 476 | os << "\t" << trapTileData->mClaimedValue; |
| 477 | |
| 478 | // We only save enemy seats that have vision on the building |
| 479 | std::vector<Seat*> seatsToSave; |
| 480 | for(Seat* seat : trapTileData->mSeatsVision) |
| 481 | { |
| 482 | if(getSeat()->isAlliedSeat(seat)) |
| 483 | continue; |
| 484 | |
| 485 | seatsToSave.push_back(seat); |
| 486 | } |
| 487 | uint32_t nbSeatsVision = seatsToSave.size(); |
| 488 | os << "\t" << nbSeatsVision; |
| 489 | for(Seat* seat : seatsToSave) |
| 490 | os << "\t" << seat->getId(); |
| 491 | } |
| 492 | |
| 493 | bool Trap::importTileDataFromStream(std::istream& is, Tile* tile, TileData* tileData) |
| 494 | { |
nothing calls this directly
no test coverage detected