DayZ 1.24
Loading...
Searching...
No Matches
HandFSM.c
Go to the documentation of this file.
1void 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}
9void 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}
17void 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
28
29
33class HandFSM extends HFSMBase<HandStateBase, HandEventBase, HandActionBase, HandGuardBase>
34{
36 {
37 /*if (m_States.Count() == 2)
38 {
39 int s0 = m_States[0].GetCurrentStateID();
40 int s1 = m_States[1].GetCurrentStateID() << 8;
41 return s1 | s0;
42 }*/
43 return 0;
44 }
45
50 protected bool SyncStateFromID(int id)
51 {
52 /*if (id == 0)
53 return false;
54
55 int s0 = id & 0x000000ff;
56 int s1 = id & 0x0000ff00;
57
58 int count = m_Transitions.Count();
59 bool set0 = false;
60 bool set1 = false;
61 for (int i = 0; i < count; ++i)
62 {
63 HandTransition t = m_Transitions.Get(i);
64 if (!set0 && t.m_srcState && s0 == t.m_srcState.GetCurrentStateID())
65 {
66 m_States[0] = t.m_srcState;
67 set0 = true;
68 }
69 if (!set1 && t.m_srcState && s1 == t.m_srcState.GetCurrentStateID())
70 {
71 m_States[1] = t.m_srcState;
72 set1 = true;
73 }
74 if (set0 && set1)
75 return true;
76 }*/
77 return false;
78 }
79
84 {
85 /*int id = 0;
86 ctx.Read(id);
87 if (SyncStateFromID(id))
88 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] OnStoreLoad - loaded current state from id=" + id);
89 else
90 Print("[hndfsm] Warning! OnStoreLoad - cannot load curent hand state, id=" + id);*/
91 return true;
92 }
93
98 {
99 /*int id = GetCurrentStateID();
100 ctx.Write(id);
101 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] OnStoreSave - saving current state=" + GetCurrentState() + " id=" + id);*/
102 }
103
108 {
109 /*if (SyncStateFromID(id))
110 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] NetSyncCurrentStateID - loaded current state from id=" + id);
111 else
112 Print("[hndfsm] NetSyncCurrentStateID called with null, ignoring request to set current fsm state.");*/
113 }
114};
115
void hndDebugSpam(string s)
Definition HandFSM.c:9
void hndDebugSpamALot(string s)
Definition HandFSM.c:17
void hndDebugPrint(string s)
Definition HandFSM.c:1
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
Definition HandFSM.c:27
bool SyncStateFromID(int id)
load from database - reverse lookup for state from saved id
Definition HandFSM.c:50
void OnStoreSave(ParamsWriteContext ctx)
save state of fsm
Definition HandFSM.c:97
bool OnStoreLoad(ParamsReadContext ctx, int version)
load state of fsm
Definition HandFSM.c:83
void NetSyncCurrentStateID(int id)
Engine callback - network synchronization of FSM's state. not intended to direct use.
Definition HandFSM.c:107
base class for hierarchic finite state machine
Hand finite state machine.
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...