OpenClonk
C4ControlEMMoveObject Class Referenceabstract

#include <C4Control.h>

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

Public Member Functions

 C4ControlEMMoveObject ()
 
 C4ControlEMMoveObject (C4ControlEMObjectAction eAction, C4Real tx, C4Real ty, C4Object *pTargetObj, int32_t iObjectNum=0, int32_t *pObjects=nullptr, const char *szScript=nullptr, bool drag_finished=false)
 
 ~C4ControlEMMoveObject () 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
 
virtual bool Sync () 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 Public Member Functions

static C4ControlEMMoveObjectCreateObject (const C4ID &id, C4Real x, C4Real y, C4Object *container)
 

Protected Attributes

C4ControlEMObjectAction eAction {EMMO_Move}
 
C4Real tx
 
C4Real ty
 
int32_t iTargetObj {0}
 
int32_t iObjectNum {0}
 
int32_t * pObjects {nullptr}
 
StdStrBuf StringParam
 
bool drag_finished {false}
 
int32_t iByClient
 

Detailed Description

Definition at line 453 of file C4Control.h.

Constructor & Destructor Documentation

◆ C4ControlEMMoveObject() [1/2]

C4ControlEMMoveObject::C4ControlEMMoveObject ( )
inline

Definition at line 456 of file C4Control.h.

Referenced by CreateObject().

456 : tx(Fix0), ty(Fix0) { }
const C4Real Fix0
Definition: C4Real.h:312
Here is the caller graph for this function:

◆ C4ControlEMMoveObject() [2/2]

C4ControlEMMoveObject::C4ControlEMMoveObject ( C4ControlEMObjectAction  eAction,
C4Real  tx,
C4Real  ty,
C4Object pTargetObj,
int32_t  iObjectNum = 0,
int32_t *  pObjects = nullptr,
const char *  szScript = nullptr,
bool  drag_finished = false 
)

Definition at line 1206 of file C4Control.cpp.

1208  : eAction(eAction), tx(tx), ty(ty), iTargetObj(pTargetObj ? pTargetObj->Number : 0),
1210 {
1211 
1212 }
C4ControlEMObjectAction eAction
Definition: C4Control.h:462
StdStrBuf StringParam
Definition: C4Control.h:467

◆ ~C4ControlEMMoveObject()

C4ControlEMMoveObject::~C4ControlEMMoveObject ( )
override

Definition at line 1224 of file C4Control.cpp.

References C4Object::Action, C4Object::AssignRemoval(), C4Id2Def(), C4VBool(), C4VInt(), C4VObj(), C4PropList::Call(), C4ControlPacket::CompileFunc(), Console, C4Game::CreateObject(), C4Object::Def, DFA_ATTACH, C4Object::DoCon(), drag_finished, eAction, C4Console::EditCursor, EMMO_Create, EMMO_Duplicate, EMMO_Enter, EMMO_Exit, EMMO_Move, EMMO_MoveForced, EMMO_Remove, EMMO_Script, EMMO_Transform, C4Object::Enter(), C4ControlPacket::Execute(), C4Object::Exit(), Fix0, C4Object::fix_x, C4Object::fix_y, fixtoi(), C4Object::ForcePosition(), FormatString(), FullCon, Game, C4Object::GetCon(), StdStrBuf::getData(), C4Object::GetProcedure(), C4PropList::GetPropertyInt(), C4Object::GetR(), C4Object::GetX(), C4Object::GetY(), C4Def::GrowthType, C4ControlPacket::iByClient, C4EditCursor::InvalidateSelection(), iObjectNum, StdCompiler::isDeserializer(), iTargetObj, LoadResStr(), C4ControlPacket::LocalControl(), C4Console::Message(), mkArrayAdapt(), mkIntPackAdapt(), mkNamingAdapt(), C4Object::Mobile, NO_OWNER, C4Def::NoHorizontalMove, C4PropListNumbered::Number, C4Game::ObjectCount(), Objects, C4EditCursor::OnSelectionChanged(), P_EditorCollection, P_EditorInitialize, P_EditorPlacementLimit, C4EditCursor::PerformDuplication(), pObjects, PSF_EditCursorMoved, C4Def::Rotateable, C4GameObjects::SafeObjectPointer(), C4ControlScript::SCOPE_Global, C4ControlPacket::SetByClient(), C4Object::SetRotation(), C4PropList::Status, StringParam, C4Action::Target, tx, ty, StdCompiler::Value(), C4Object::xdir, and C4Object::ydir.

1225 {
1226  delete [] pObjects; pObjects = nullptr;
1227 }
Here is the call 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(), C4ControlSyncCheck::GetAllCrewPosX(), C4ControlVote::getDescWarning(), C4ControlPlayerAction::InitPlayerControl(), C4ControlJoinPlayer::PreRec(), C4ControlPacket::Sync(), and ~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:

◆ CreateObject()

C4ControlEMMoveObject * C4ControlEMMoveObject::CreateObject ( const C4ID id,
C4Real  x,
C4Real  y,
C4Object container 
)
static

Definition at line 1214 of file C4Control.cpp.

References C4ControlEMMoveObject(), EMMO_Create, and StartSoundEffect().

Referenced by C4EditCursor::ApplyCreateObject(), and C4Game::DropDef().

1215 {
1216 #ifdef WITH_QT_EDITOR
1217  ::StartSoundEffect("UI::Click2");
1218 #endif
1219  auto ctl = new C4ControlEMMoveObject(EMMO_Create, x, y, container);
1220  ctl->StringParam = id.ToString();
1221  return ctl;
1222 }
C4SoundInstance * StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance, int32_t iPitch, C4SoundModifier *modifier)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Execute()

◆ 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:

◆ 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().

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:

◆ 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().

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

◆ Sync()

virtual bool C4ControlPacket::Sync ( ) const
inlinevirtualinherited

Reimplemented in C4ControlVoteEnd, C4ControlVote, C4ControlMessage, C4ControlPlayerInfo, C4ControlClientRemove, C4ControlClientUpdate, C4ControlClientJoin, and C4ControlSyncCheck.

Definition at line 55 of file C4Control.h.

References C4ControlPacket::CompileFunc().

Referenced by C4Playback::Check(), and C4GameControl::DoInput().

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

◆ 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

◆ drag_finished

bool C4ControlEMMoveObject::drag_finished {false}
protected

Definition at line 468 of file C4Control.h.

Referenced by ~C4ControlEMMoveObject().

◆ eAction

C4ControlEMObjectAction C4ControlEMMoveObject::eAction {EMMO_Move}
protected

Definition at line 462 of file C4Control.h.

Referenced by ~C4ControlEMMoveObject().

◆ iByClient

◆ iObjectNum

int32_t C4ControlEMMoveObject::iObjectNum {0}
protected

Definition at line 465 of file C4Control.h.

Referenced by ~C4ControlEMMoveObject().

◆ iTargetObj

int32_t C4ControlEMMoveObject::iTargetObj {0}
protected

Definition at line 464 of file C4Control.h.

Referenced by ~C4ControlEMMoveObject().

◆ pObjects

int32_t* C4ControlEMMoveObject::pObjects {nullptr}
protected

Definition at line 466 of file C4Control.h.

Referenced by ~C4ControlEMMoveObject().

◆ StringParam

StdStrBuf C4ControlEMMoveObject::StringParam
protected

Definition at line 467 of file C4Control.h.

Referenced by ~C4ControlEMMoveObject().

◆ tx

C4Real C4ControlEMMoveObject::tx
protected

Definition at line 463 of file C4Control.h.

Referenced by ~C4ControlEMMoveObject().

◆ ty

C4Real C4ControlEMMoveObject::ty
protected

Definition at line 463 of file C4Control.h.

Referenced by ~C4ControlEMMoveObject().


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