OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ControlPlayerMouse Class Referenceabstract

#include <C4Control.h>

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

Public Types

enum  Action { CPM_NoAction = 0, CPM_Hover = 0x01, CPM_Drop = 0x02 }
 

Public Member Functions

 C4ControlPlayerMouse ()
 
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 C4ControlPlayerMouseHover (const C4Player *player, const C4Object *target, const C4Object *old_target, const C4Object *drag=nullptr)
 
static C4ControlPlayerMouseDragDrop (const C4Player *player, const C4Object *target, const C4Object *drag)
 

Protected Attributes

int32_t iByClient
 

Detailed Description

Definition at line 233 of file C4Control.h.

Member Enumeration Documentation

Enumerator
CPM_NoAction 
CPM_Hover 
CPM_Drop 

Definition at line 236 of file C4Control.h.

Constructor & Destructor Documentation

C4ControlPlayerMouse::C4ControlPlayerMouse ( )
inline

Definition at line 244 of file C4Control.h.

244 : player(NO_OWNER) {}
const int NO_OWNER
Definition: C4Constants.h:138

Member Function Documentation

void C4ControlPacket::CompileFunc ( StdCompiler pComp)
overridevirtualinherited

Implements C4PacketBase.

Definition at line 70 of file C4Control.cpp.

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

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

Here is the call graph for this function:

C4ControlPlayerMouse * C4ControlPlayerMouse::DragDrop ( const C4Player player,
const C4Object target,
const C4Object drag 
)
static

Definition at line 459 of file C4Control.cpp.

References C4Player::Number, and C4PropListNumbered::Number.

Referenced by C4MouseControl::ButtonUpDragScript().

460 {
461  assert(player != nullptr);
462  if (!player) return nullptr;
463 
464  auto control = new C4ControlPlayerMouse();
465  control->action = CPM_Drop;
466  control->player = player->Number;
467  control->drag_obj = drag ? drag->Number : 0;
468  control->target_obj = target ? target->Number : 0;
469  return control;
470 }
int32_t Number
Definition: C4Player.h:86

Here is the caller graph for this function:

virtual void C4ControlPacket::Execute ( ) const
pure virtualinherited

Referenced by C4GameControl::DoSyncCheck(), C4GameControl::ExecControlPacket(), and C4Control::Execute().

Here is the caller graph for this function:

int32_t C4ControlPacket::getByClient ( ) const
inlineinherited

Definition at line 42 of file C4Control.h.

References C4ControlPacket::iByClient.

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

42 { return iByClient; }
int32_t iByClient
Definition: C4Control.h:39

Here is the caller graph for this function:

bool C4ControlPacket::HostControl ( ) const
inlineinherited

Definition at line 44 of file C4Control.h.

References C4ClientIDHost.

44 { return iByClient == C4ClientIDHost; }
int32_t iByClient
Definition: C4Control.h:39
const int32_t C4ClientIDHost
Definition: C4Client.h:25
C4ControlPlayerMouse * C4ControlPlayerMouse::Hover ( const C4Player player,
const C4Object target,
const C4Object old_target,
const C4Object drag = nullptr 
)
static

Definition at line 446 of file C4Control.cpp.

References C4Player::Number, and C4PropListNumbered::Number.

Referenced by C4MouseControl::UpdateCursorTarget().

447 {
448  assert(player != nullptr);
449  if (!player) return nullptr;
450 
451  auto control = new C4ControlPlayerMouse();
452  control->action = CPM_Hover;
453  control->player = player->Number;
454  control->drag_obj = drag ? drag->Number : 0;
455  control->target_obj = target ? target->Number : 0;
456  control->old_obj = old_target ? old_target->Number : 0;
457  return control;
458 }
int32_t Number
Definition: C4Player.h:86

Here is the caller graph for this function:

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:

bool C4ControlPacket::LocalControl ( ) const
inherited

Definition at line 60 of file C4Control.cpp.

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

61 {
62  return iByClient == ::Control.ClientID();
63 }
int32_t iByClient
Definition: C4Control.h:39
C4GameControl Control
int32_t ClientID() const

Here is the call graph for this function:

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

Definition at line 149 of file C4Packet2.cpp.

Referenced by MkC4NetIOPacket().

150 {
151  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(*this), addr);
152 }

Here is the caller graph for this function:

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

Definition at line 154 of file C4Packet2.cpp.

References mkDecompileAdapt(), and mkInsertAdapt().

155 {
156  return C4NetIOPacket(DecompileToBuf<StdCompilerBinWrite>(mkInsertAdapt(mkDecompileAdapt(*this), cStatus)), addr);
157 }
StdDecompileAdapt< T > mkDecompileAdapt(const T &rValue)
Definition: StdAdaptors.h:153
StdInsertAdapt< T, I > mkInsertAdapt(T &&rObj, I &&rIns, bool fBefore=true)
Definition: StdAdaptors.h:437

Here is the call graph for this function:

virtual bool C4ControlPacket::PreExecute ( ) const
inlinevirtualinherited

Reimplemented in C4ControlJoinPlayer.

Definition at line 48 of file C4Control.h.

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

48 { return true; }

Here is the caller graph for this function:

virtual void C4ControlPacket::PreRec ( C4Record pRecord)
inlinevirtualinherited

Reimplemented in C4ControlJoinPlayer.

Definition at line 50 of file C4Control.h.

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

50 { }

Here is the caller graph for this function:

void C4ControlPacket::SetByClient ( int32_t  iByClient)
inherited

Definition at line 65 of file C4Control.cpp.

References C4ControlPacket::iByClient.

66 {
67  iByClient = inByClient;
68 }
int32_t iByClient
Definition: C4Control.h:39
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.

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

55 { return true; }

Here is the caller graph for this function:

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

Definition at line 159 of file C4Packet2.cpp.

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

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

160 {
161  if (pStatus) *pStatus = Pkt.getStatus();
162  CompileFromBuf<StdCompilerBinRead>(*this, pStatus ? Pkt.getPBuf() : Pkt.getRef());
163 }
StdBuf getPBuf() const
Definition: C4NetIO.h:320
C4NetIOPacket getRef() const
Definition: C4NetIO.h:323
uint8_t getStatus() const
Definition: C4NetIO.h:317

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int32_t C4ControlPacket::iByClient
protectedinherited

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