Merge branch 'milek-dev' into gfx-work

This commit is contained in:
milek7
2018-10-26 10:56:04 +02:00
2 changed files with 12 additions and 4 deletions

View File

@@ -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 );

View File

@@ -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