mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
isolated inc and dec events
This commit is contained in:
12
Track.cpp
12
Track.cpp
@@ -106,13 +106,13 @@ TIsolated * TIsolated::Find(std::string const &n)
|
||||
return pRoot;
|
||||
};
|
||||
|
||||
bool
|
||||
void
|
||||
TIsolated::AssignEvents() {
|
||||
|
||||
evBusy = simulation::Events.FindEvent( asName + ":busy" );
|
||||
evFree = simulation::Events.FindEvent( asName + ":free" );
|
||||
|
||||
return ( evBusy != nullptr ) && ( evFree != nullptr );
|
||||
evInc = simulation::Events.FindEvent( asName + ":inc" );
|
||||
evDec = simulation::Events.FindEvent( asName + ":dec" );
|
||||
}
|
||||
|
||||
void TIsolated::Modify(int i, TDynamicObject *o)
|
||||
@@ -144,6 +144,12 @@ void TIsolated::Modify(int i, TDynamicObject *o)
|
||||
pMemCell->UpdateValues( "", 0, int( pMemCell->Value2() ) | 1, basic_event::flags::value_2 ); // zmieniamy ostatnią wartość na nieparzystą
|
||||
}
|
||||
}
|
||||
|
||||
if (i > 0 && evInc)
|
||||
simulation::Events.AddToQuery(evInc, o);
|
||||
if (i < 0 && evDec)
|
||||
simulation::Events.AddToQuery(evDec, o);
|
||||
|
||||
// pass the event to the parent
|
||||
if( pParent != nullptr ) {
|
||||
pParent->Modify( i, o );
|
||||
|
||||
4
Track.h
4
Track.h
@@ -105,7 +105,7 @@ public:
|
||||
// methods
|
||||
static void DeleteAll();
|
||||
static TIsolated * Find(const std::string &n); // znalezienie obiektu albo utworzenie nowego
|
||||
bool AssignEvents();
|
||||
void AssignEvents();
|
||||
void Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
||||
inline
|
||||
bool
|
||||
@@ -131,6 +131,8 @@ public:
|
||||
std::string asName; // nazwa obiektu, baza do nazw eventów
|
||||
basic_event *evBusy { nullptr }; // zdarzenie wyzwalane po zajęciu grupy
|
||||
basic_event *evFree { nullptr }; // zdarzenie wyzwalane po całkowitym zwolnieniu zajętości grupy
|
||||
basic_event *evInc { nullptr }; // wyzwalane po wjeździe na grupę
|
||||
basic_event *evDec { nullptr }; // wyzwalane po zjazdu z grupy
|
||||
TMemCell *pMemCell { nullptr }; // automatyczna komórka pamięci, która współpracuje z odcinkiem izolowanym
|
||||
private:
|
||||
// members
|
||||
|
||||
Reference in New Issue
Block a user