FSerialization::SyncUnits()
- Defined in
- CvUnit.cpp, line 77
- Hook name
CivHooks::FSerialization_SyncUnits
Hooks
static bool BeforeFSerialization_SyncUnits();static void AfterFSerialization_SyncUnits();static void ReplaceFSerialization_SyncUnits(void (*original)());CivRegisterBefore<CivHooks::FSerialization_SyncUnits>(host, &BeforeFSerialization_SyncUnits);CivRegisterAfter<CivHooks::FSerialization_SyncUnits>(host, &AfterFSerialization_SyncUnits);CivRegisterReplace<CivHooks::FSerialization_SyncUnits>(host, &ReplaceFSerialization_SyncUnits);
Code
77void SyncUnits()78{79 if(GC.getGame().isNetworkMultiPlayer())80 {81 PlayerTypes authoritativePlayer = GC.getGame().getActivePlayer();8283 std::set<CvUnit*>::const_iterator i;84 for(i = unitsToCheck.begin(); i != unitsToCheck.end(); ++i)85 {86 const CvUnit* unit = *i;8788 if(unit)89 {90 const CvPlayer& player = GET_PLAYER(unit->getOwner());91 if(unit->getOwner() == authoritativePlayer || (gDLL->IsHost() && !player.isHuman() && player.isAlive()))92 {93 const FAutoArchive& archive = unit->getSyncArchive();94 if(archive.hasDeltas())95 {96 FMemoryStream memoryStream;97 std::vector<std::pair<std::string, std::string> > callStacks;98 archive.saveDelta(memoryStream, callStacks);99 gDLL->sendUnitSyncCheck(unit->getOwner(), unit->GetID(), memoryStream, callStacks);100 }101 }102 }103 }104 }105}
Calls
- CvGame::getActivePlayer() const
- CvGame::isNetworkMultiPlayer() const
- CvGlobals::getDLLIFace()
- CvGlobals::getGame()
- CvPlayer::isAlive() const
- CvPlayer::isHuman() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvUnit::GetID() const
- CvUnit::getOwner() const
- CvUnit::getSyncArchive() const
FAutoArchive::hasDeltasFAutoArchive::saveDeltaFMemoryStream::FMemoryStreamICvEngineUtility1::IsHostICvEngineUtility1::sendUnitSyncCheckstd::_Tree::beginstd::_Tree::const_iterator::const_iteratorstd::_Tree::const_iterator::operator!=std::_Tree::const_iterator::operator*std::_Tree::const_iterator::operator++std::_Tree::const_iterator::operator=std::_Tree::endstd::vector::vector