forked from eu07/maszyna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvent.h
118 lines (110 loc) · 3.4 KB
/
Event.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#ifndef EventH
#define EventH
#include "Classes.h"
#include "dumb3d.h"
using namespace Math3D;
typedef enum
{
tp_Unknown,
tp_Sound,
tp_SoundPos,
tp_Exit,
tp_Disable,
tp_Velocity,
tp_Animation,
tp_Lights,
tp_UpdateValues,
tp_GetValues,
tp_PutValues,
tp_Switch,
tp_DynVel,
tp_TrackVel,
tp_Multiple,
tp_AddValues,
tp_Ignored,
tp_CopyValues,
tp_WhoIs,
tp_LogValues,
tp_Visible,
tp_Voltage,
tp_Message,
tp_Friction
} TEventType;
const int update_memstring = 0x0000001; // zmodyfikowaæ tekst (UpdateValues)
const int update_memval1 = 0x0000002; // zmodyfikowaæ pierwsz¹ wartosæ
const int update_memval2 = 0x0000004; // zmodyfikowaæ drug¹ wartosæ
const int update_memadd = 0x0000008; // dodaæ do poprzedniej zawartoœci
const int update_load = 0x0000010; // odczytaæ ³adunek
const int update_only = 0x00000FF; // wartoϾ graniczna
const int conditional_memstring = 0x0000100; // porównanie tekstu
const int conditional_memval1 = 0x0000200; // porównanie pierwszej wartoœci liczbowej
const int conditional_memval2 = 0x0000400; // porównanie drugiej wartoœci
const int conditional_else = 0x0010000; // flaga odwrócenia warunku (przesuwana bitowo)
const int conditional_anyelse = 0x0FF0000; // do sprawdzania, czy s¹ odwrócone warunki
const int conditional_trackoccupied = 0x1000000; // jeœli tor zajêty
const int conditional_trackfree = 0x2000000; // jeœli tor wolny
const int conditional_propability = 0x4000000; // zale¿nie od generatora lizcb losowych
const int conditional_memcompare = 0x8000000; // porównanie zawartoœci
union TParam
{
void *asPointer;
TMemCell *asMemCell;
TGroundNode *nGroundNode;
TTrack *asTrack;
TAnimModel *asModel;
TAnimContainer *asAnimContainer;
TTrain *asTrain;
TDynamicObject *asDynamic;
TEvent *asEvent;
bool asBool;
double asdouble;
int asInt;
TTextSound *tsTextSound;
char *asText;
TCommandType asCommand;
TTractionPowerSource *psPower;
};
class TEvent // zmienne: ev*
{ // zdarzenie
private:
void Conditions(cParser *parser, AnsiString s);
public:
AnsiString asName;
bool bEnabled; // false gdy ma nie byæ dodawany do kolejki (skanowanie sygna³ów)
int iQueued; // ile razy dodany do kolejki
// bool bIsHistory;
TEvent *evNext; // nastêpny w kolejce
TEvent *evNext2;
TEventType Type;
double fStartTime;
double fDelay;
TDynamicObject *Activator;
TParam Params[13]; // McZapkie-070502 //Ra: zamieniæ to na union/struct
unsigned int iFlags; // zamiast Params[8] z flagami warunku
AnsiString asNodeName; // McZapkie-100302 - dodalem zeby zapamietac nazwe toru
TEvent *evJoined; // kolejny event z t¹ sam¹ nazw¹ - od wersji 378
double fRandomDelay; // zakres dodatkowego opóŸnienia
public: // metody
TEvent(AnsiString m = "");
~TEvent();
void Init();
void Load(cParser *parser, vector3 *org);
void AddToQuery(TEvent *e);
AnsiString CommandGet();
TCommandType Command();
double ValueGet(int n);
vector3 PositionGet();
bool StopCommand();
void StopCommandSent();
void Append(TEvent *e);
};
//---------------------------------------------------------------------------
#endif