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

Method exportTileDataToStream

source/traps/Trap.cpp:466–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464}
465
466void 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
493bool Trap::importTileDataFromStream(std::istream& is, Tile* tile, TileData* tileData)
494{

Callers

nothing calls this directly

Calls 6

isInEditorModeMethod · 0.80
getReloadTimeMethod · 0.80
isAlliedSeatMethod · 0.80
isActivatedMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected