Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
handfsm.c
Go to the documentation of this file.
1 void hndDebugPrint (string s)
2 {
3 #ifdef INV_DEBUG
4  PrintToRPT("" + s); // comment/uncomment to hide/see debug logs
5 #else
6  //Print("" + s); // comment/uncomment to hide/see debug logs
7 #endif
8 }
9 void hndDebugSpam (string s)
10 {
11 #ifdef INV_DEBUG_SPAM
12  PrintToRPT("" + s); // comment/uncomment to hide/see debug logs
13 #else
14  //Print("" + s); // comment/uncomment to hide/see debug logs
15 #endif
16 }
17 void hndDebugSpamALot (string s)
18 {
19 #ifdef INV_DEBUG_SPAM_FREQ
20  PrintToRPT("" + s); // comment/uncomment to hide/see debug logs
21 #else
22  //Print("" + s); // comment/uncomment to hide/see debug logs
23 #endif
24 }
25 
26 
27 
29 
30 
34 class HandFSM extends HFSMBase<HandStateBase, HandEventBase, HandActionBase, HandGuardBase>
35 {
36  int GetCurrentStateID ()
37  {
38  /*if (m_States.Count() == 2)
39  {
40  int s0 = m_States[0].GetCurrentStateID();
41  int s1 = m_States[1].GetCurrentStateID() << 8;
42  return s1 | s0;
43  }*/
44  return 0;
45  }
46 
51  protected bool SyncStateFromID (int id)
52  {
53  /*if (id == 0)
54  return false;
55 
56  int s0 = id & 0x000000ff;
57  int s1 = id & 0x0000ff00;
58 
59  int count = m_Transitions.Count();
60  bool set0 = false;
61  bool set1 = false;
62  for (int i = 0; i < count; ++i)
63  {
64  HandTransition t = m_Transitions.Get(i);
65  if (!set0 && t.m_srcState && s0 == t.m_srcState.GetCurrentStateID())
66  {
67  m_States[0] = t.m_srcState;
68  set0 = true;
69  }
70  if (!set1 && t.m_srcState && s1 == t.m_srcState.GetCurrentStateID())
71  {
72  m_States[1] = t.m_srcState;
73  set1 = true;
74  }
75  if (set0 && set1)
76  return true;
77  }*/
78  return false;
79  }
80 
84  bool OnStoreLoad (ParamsReadContext ctx, int version)
85  {
86  /*int id = 0;
87  ctx.Read(id);
88  if (SyncStateFromID(id))
89  if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] OnStoreLoad - loaded current state from id=" + id);
90  else
91  Print("[hndfsm] Warning! OnStoreLoad - cannot load curent hand state, id=" + id);*/
92  return true;
93  }
94 
99  {
100  /*int id = GetCurrentStateID();
101  ctx.Write(id);
102  if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] OnStoreSave - saving current state=" + GetCurrentState() + " id=" + id);*/
103  }
104 
108  void NetSyncCurrentStateID (int id)
109  {
110  /*if (SyncStateFromID(id))
111  if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] NetSyncCurrentStateID - loaded current state from id=" + id);
112  else
113  Print("[hndfsm] NetSyncCurrentStateID called with null, ignoring request to set current fsm state.");*/
114  }
115 };
116 
HandTransition
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
Definition: handfsm.c:28
HFSMBase
base class for hierarchic finite state machine
GetCurrentStateID
override int GetCurrentStateID()
Definition: hand_states.c:29
hndDebugSpamALot
void hndDebugSpamALot(string s)
Definition: handfsm.c:17
NetSyncCurrentStateID
override void NetSyncCurrentStateID(int id)
Definition: dayzplayerinventory.c:2059
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
HandFSM
Hand finite state machine.
hndDebugSpam
void hndDebugSpam(string s)
Definition: handfsm.c:9
hndDebugPrint
void hndDebugPrint(string s)
Definition: handfsm.c:1
PrintToRPT
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
FSMTransition
represents transition src -— event[guard]/action -—|> dst
OnStoreSave
void OnStoreSave(ParamsWriteContext ctx)
Definition: modifierbase.c:229
OnStoreLoad
bool OnStoreLoad(ParamsReadContext ctx, int version)
Definition: modifiersmanager.c:270