OpenClonk
C4ControlSyncCheck Class Referenceabstract

#include <C4Control.h>

Inheritance diagram for C4ControlSyncCheck:
[legend]
Collaboration diagram for C4ControlSyncCheck:
[legend]

Public Member Functions

 C4ControlSyncCheck ()
 
void Set ()
 
int32_t getFrame () const
 
bool Sync () const override
 
int32_t getByClient () const
 
bool LocalControl () const
 
bool HostControl () const
 
void SetByClient (int32_t iByClient)
 
virtual bool PreExecute () const
 
virtual void Execute () const =0
 
virtual void PreRec (C4Record *pRecord)
 
virtual bool Lobby () const
 
void CompileFunc (StdCompiler *pComp) override
 
C4NetIOPacket pack (const C4NetIO::addr_t &addr=C4NetIO::addr_t()) const
 
C4NetIOPacket pack (uint8_t cStatus, const C4NetIO::addr_t &addr=C4NetIO::addr_t()) const
 
void unpack (const C4NetIOPacket &Pkt, char *pStatus=nullptr)
 

Static Protected Member Functions

static int32_t GetAllCrewPosX ()
 

Protected Attributes

int32_t Frame
 
int32_t ControlTick
 
int32_t RandomCount
 
int32_t AllCrewPosX
 
int32_t PXSCount
 
int32_t MassMoverIndex
 
int32_t ObjectCount
 
int32_t ObjectEnumerationIndex
 
int32_t SectShapeSum
 
int32_t iByClient
 

Detailed Description

Definition at line 317 of file C4Control.h.

Constructor & Destructor Documentation

◆ C4ControlSyncCheck()

C4ControlSyncCheck::C4ControlSyncCheck ( )
default

Referenced by C4ControlPlayerAction::InitPlayerControl().

Here is the caller graph for this function:

Member Function Documentation

◆ CompileFunc()

void C4ControlPacket::CompileFunc ( StdCompiler pComp)
overridevirtualinherited

Implements C4PacketBase.

Definition at line 70 of file C4Control.cpp.

References C4Control::C4Control(), C4ControlPacket::iByClient, mkIntPackAdapt(), mkNamingAdapt(), and StdCompiler::Value().

Referenced by C4ControlEMDrawTool::C4ControlEMDrawTool(), C4ControlMenuCommand::C4ControlMenuCommand(), C4ControlPlayerSelect::C4ControlPlayerSelect(), C4ControlReInitScenario::C4ControlReInitScenario(), C4Control::CompileFunc(), C4ControlPlayerControl::ControlItem::CompileFunc(), C4ControlPlayerControl::ControlItem::ControlItem(), C4Control::Delete(), C4ControlPlayerMouse::DragDrop(), GetAllCrewPosX(), C4ControlVote::getDescWarning(), C4ControlPlayerAction::InitPlayerControl(), C4ControlJoinPlayer::PreRec(), C4ControlPacket::Sync(), and C4ControlEMMoveObject::~C4ControlEMMoveObject().

71 {
72  // Section must be set by caller
73  pComp->Value(mkNamingAdapt(mkIntPackAdapt(iByClient), "ByClient", -1));
74 }
int32_t iByClient
Definition: C4Control.h:39
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
Definition: StdAdaptors.h:92
void Value(const T &rStruct)
Definition: StdCompiler.h:161
StdIntPackAdapt< T > mkIntPackAdapt(T &rVal)
Definition: StdAdaptors.h:777
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Execute()

◆ GetAllCrewPosX()

int32_t C4ControlSyncCheck::GetAllCrewPosX ( )
staticprotected

Definition at line 759 of file C4Control.cpp.

References C4Window::Active, C4Control::Add(), C4ClientList::Add(), AllCrewPosX, C4Config::AtExePath(), C4ClientIDHost, C4ClientIDUnknown, C4LDR_Desync, C4GameControl::ChangeToLocal(), CID_SyncCheck, C4Network2::Clear(), C4GameControl::ClientID(), C4Game::Clients, C4ControlPacket::CompileFunc(), Config, Console, Control, ControlTick, CUT_Activate, CUT_None, CUT_SetObserver, CUT_SetReady, C4Game::DoGameOver(), C4RoundResults::EvaluateNetwork(), C4ControlPacket::Execute(), C4PlayerList::First, C4Object::fix_x, fixtoi(), StdStrBuf::Format(), FormatString(), Frame, Game, C4ClientList::getClientByID(), StdStrBuf::getData(), C4Network2::GetLobby(), C4Client::getName(), C4GameControl::GetSyncCheck(), C4ControlPacket::iByClient, C4Client::isActivated(), C4GameControl::isCtrlHost(), C4Network2::isEnabled(), C4Client::isLobbyReady(), C4Client::isLocal(), C4GameControl::isNetwork(), C4Client::isObserver(), C4GameControl::isReplay(), C4Network2::LeagueNotifyDisconnect(), LoadResStr(), Log(), LogF(), LogFatal(), MassMoverIndex, mkIntPackAdapt(), mkNamingAdapt(), Network, C4Player::Next, C4RoundResults::NR_NetError, ObjectCount, ObjectEnumerationIndex, C4GameLobby::MainDlg::OnClientJoin(), C4Network2Players::OnClientPart(), C4GameLobby::MainDlg::OnClientPart(), C4GameLobby::MainDlg::OnClientReadyStateChange(), pGUI, C4Network2::Players, Players, PXSCount, RandomCount, RandomCount, C4ClientList::Remove(), C4PlayerList::RemoveAtClient(), C4Network2ResList::RemoveAtClient(), C4Network2::ResList, C4Game::RoundResults, C4GameSave::Save(), SectShapeSum, C4Client::SetActivated(), C4GameControl::SetActivated(), C4Client::SetLobbyReady(), C4Client::SetObserver(), StartSoundEffect(), C4GameControl::SyncChecks, C4Game::SyncClearance(), C4Game::Synchronize(), C4Console::UpdateMenus(), C4Console::UpdateNetMenu(), and StdCompiler::Value().

760 {
761  int32_t cpx=0;
762  for (C4Player *pPlr=::Players.First; pPlr; pPlr=pPlr->Next)
763  for (C4Object *member : pPlr->Crew)
764  cpx += fixtoi(member->fix_x, 100);
765  return cpx;
766 }
C4Player * First
Definition: C4PlayerList.h:31
C4PlayerList Players
C4Real fix_x
Definition: C4Object.h:125
C4Player * Next
Definition: C4Player.h:142
int fixtoi(const C4Fixed &x)
Definition: C4Real.h:259
Here is the call graph for this function:

◆ getByClient()

int32_t C4ControlPacket::getByClient ( ) const
inlineinherited

Definition at line 42 of file C4Control.h.

References C4ControlPacket::iByClient, and C4ControlPacket::LocalControl().

Referenced by C4Network2::GetVote(), and C4Network2::OpenVoteDialog().

42 { return iByClient; }
int32_t iByClient
Definition: C4Control.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFrame()

int32_t C4ControlSyncCheck::getFrame ( ) const
inline

Definition at line 333 of file C4Control.h.

Referenced by C4GameControl::GetSyncCheck(), and C4GameControl::RemoveOldSyncChecks().

333 { return Frame; }
Here is the caller graph for this function:

◆ HostControl()

bool C4ControlPacket::HostControl ( ) const
inlineinherited

Definition at line 44 of file C4Control.h.

References C4ClientIDHost, and C4ControlPacket::SetByClient().

Referenced by C4ControlEMDrawTool::C4ControlEMDrawTool(), C4Control::CompileFunc(), and C4ControlVote::getDescWarning().

44 { return iByClient == C4ClientIDHost; }
int32_t iByClient
Definition: C4Control.h:39
const int32_t C4ClientIDHost
Definition: C4Client.h:25
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lobby()

virtual bool C4ControlPacket::Lobby ( ) const
inlinevirtualinherited

Reimplemented in C4ControlMessage, C4ControlPlayerInfo, C4ControlClientRemove, C4ControlClientUpdate, C4ControlClientJoin, and C4ControlSet.

Definition at line 53 of file C4Control.h.

Referenced by C4GameControl::DoInput().

53 { return false; }
Here is the caller graph for this function:

◆ LocalControl()

bool C4ControlPacket::LocalControl ( ) const
inherited

Definition at line 60 of file C4Control.cpp.

References C4GameControl::ClientID(), Control, and C4ControlPacket::iByClient.

Referenced by C4ControlJoinPlayer::C4ControlJoinPlayer(), C4Control::CompileFunc(), C4ControlPacket::getByClient(), and C4ControlEMMoveObject::~C4ControlEMMoveObject().

61 {
62  return iByClient == ::Control.ClientID();
63 }
int32_t iByClient
Definition: C4Control.h:39
int32_t ClientID() const
C4GameControl Control
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pack() [1/2]

C4NetIOPacket C4PacketBase::pack ( const C4NetIO::addr_t addr = C4NetIO::addr_t()) const
inherited

Definition at line 150 of file C4Packet2.cpp.

Referenced by MkC4NetIOPacket().

151 {
152  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(*this), addr);
153 }
Here is the caller graph for this function:

◆ pack() [2/2]

C4NetIOPacket C4PacketBase::pack ( uint8_t  cStatus,
const C4NetIO::addr_t addr = C4NetIO::addr_t() 
) const
inherited

Definition at line 155 of file C4Packet2.cpp.

References mkDecompileAdapt(), and mkInsertAdapt().

156 {
157  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(mkInsertAdapt(mkDecompileAdapt(*this), cStatus)), addr);
158 }
StdDecompileAdapt< T > mkDecompileAdapt(const T &rValue)
Definition: StdAdaptors.h:153
StdInsertAdapt< T, I > mkInsertAdapt(T &&rObj, I &&rIns, bool fBefore=true)
Definition: StdAdaptors.h:455
Here is the call graph for this function:

◆ PreExecute()

virtual bool C4ControlPacket::PreExecute ( ) const
inlinevirtualinherited

Reimplemented in C4ControlJoinPlayer.

Definition at line 48 of file C4Control.h.

References C4ControlPacket::Execute().

Referenced by C4Control::Delete(), C4GameControl::ExecControlPacket(), and C4Control::PreExecute().

48 { return true; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PreRec()

virtual void C4ControlPacket::PreRec ( C4Record pRecord)
inlinevirtualinherited

Reimplemented in C4ControlJoinPlayer.

Definition at line 50 of file C4Control.h.

Referenced by C4Control::Delete(), C4Control::PreRec(), and C4Record::Rec().

50 { }
Here is the caller graph for this function:

◆ Set()

void C4ControlSyncCheck::Set ( )

Definition at line 746 of file C4Control.cpp.

References Control, C4GameControl::ControlTick, C4PXSSystem::Count, C4MassMoverSet::CreatePtr, C4Game::FrameCounter, Game, C4PropListNumbered::GetEnumerationIndex(), C4LSectors::getShapeSum(), MassMover, C4ObjectList::ObjectCount(), Objects, PXS, RandomCount, and C4GameObjects::Sectors.

Referenced by C4GameControl::DoSyncCheck().

747 {
752  PXSCount = ::PXS.Count;
757 }
int32_t ControlTick
Definition: C4GameControl.h:89
static int32_t GetAllCrewPosX()
Definition: C4Control.cpp:759
C4Game Game
Definition: C4Globals.cpp:52
size_t Count
Definition: C4PXS.h:44
int32_t FrameCounter
Definition: C4Game.h:129
int32_t AllCrewPosX
Definition: C4Control.h:325
static int32_t GetEnumerationIndex()
Definition: C4PropList.h:225
C4GameControl Control
int ObjectCount(C4ID id=C4ID::None) const
C4PXSSystem PXS
Definition: C4PXS.cpp:423
int32_t ControlTick
Definition: C4Control.h:323
C4LSectors Sectors
Definition: C4GameObjects.h:42
C4MassMoverSet MassMover
int getShapeSum() const
Definition: C4Sector.cpp:199
int32_t SectShapeSum
Definition: C4Control.h:330
int32_t ObjectEnumerationIndex
Definition: C4Control.h:329
int32_t MassMoverIndex
Definition: C4Control.h:327
int32_t RandomCount
Definition: C4Control.h:324
C4GameObjects Objects
Definition: C4Globals.cpp:48
int32_t CreatePtr
Definition: C4MassMover.h:44
int32_t ObjectCount
Definition: C4Control.h:328
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetByClient()

void C4ControlPacket::SetByClient ( int32_t  iByClient)
inherited

Definition at line 65 of file C4Control.cpp.

References C4ControlPacket::iByClient.

Referenced by C4ControlPacket::HostControl(), and C4ControlEMMoveObject::~C4ControlEMMoveObject().

66 {
67  iByClient = inByClient;
68 }
int32_t iByClient
Definition: C4Control.h:39
Here is the caller graph for this function:

◆ Sync()

bool C4ControlSyncCheck::Sync ( ) const
inlineoverridevirtual

Reimplemented from C4ControlPacket.

Definition at line 334 of file C4Control.h.

References DECLARE_C4CONTROL_VIRTUALS.

334 { return false; }

◆ unpack()

void C4PacketBase::unpack ( const C4NetIOPacket Pkt,
char *  pStatus = nullptr 
)
inherited

Definition at line 160 of file C4Packet2.cpp.

References C4PktBuf::C4PktBuf(), C4NetIOPacket::getPBuf(), C4NetIOPacket::getRef(), and C4NetIOPacket::getStatus().

Referenced by C4IDPacket::C4IDPacket(), and C4Network2IO::HandlePacket().

161 {
162  if (pStatus) *pStatus = Pkt.getStatus();
163  CompileFromBuf<StdCompilerBinRead>(*this, pStatus ? Pkt.getPBuf() : Pkt.getRef());
164 }
uint8_t getStatus() const
Definition: C4NetIO.h:318
StdBuf getPBuf() const
Definition: C4NetIO.h:321
C4NetIOPacket getRef() const
Definition: C4NetIO.h:324
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ AllCrewPosX

int32_t C4ControlSyncCheck::AllCrewPosX
protected

Definition at line 325 of file C4Control.h.

Referenced by GetAllCrewPosX().

◆ ControlTick

int32_t C4ControlSyncCheck::ControlTick
protected

Definition at line 323 of file C4Control.h.

Referenced by GetAllCrewPosX().

◆ Frame

int32_t C4ControlSyncCheck::Frame
protected

Definition at line 322 of file C4Control.h.

Referenced by GetAllCrewPosX().

◆ iByClient

◆ MassMoverIndex

int32_t C4ControlSyncCheck::MassMoverIndex
protected

Definition at line 327 of file C4Control.h.

Referenced by GetAllCrewPosX().

◆ ObjectCount

int32_t C4ControlSyncCheck::ObjectCount
protected

Definition at line 328 of file C4Control.h.

Referenced by GetAllCrewPosX().

◆ ObjectEnumerationIndex

int32_t C4ControlSyncCheck::ObjectEnumerationIndex
protected

Definition at line 329 of file C4Control.h.

Referenced by GetAllCrewPosX().

◆ PXSCount

int32_t C4ControlSyncCheck::PXSCount
protected

Definition at line 326 of file C4Control.h.

Referenced by GetAllCrewPosX().

◆ RandomCount

int32_t C4ControlSyncCheck::RandomCount
protected

Definition at line 324 of file C4Control.h.

Referenced by GetAllCrewPosX().

◆ SectShapeSum

int32_t C4ControlSyncCheck::SectShapeSum
protected

Definition at line 330 of file C4Control.h.

Referenced by GetAllCrewPosX().


The documentation for this class was generated from the following files: