MCPcopy Create free account
hub / github.com/SpartanJ/eepp / update

Method update

src/eepp/scene/actionmanager.cpp:108–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void ActionManager::update( const Time& time, Action** actions, size_t count ) {
109 std::vector<Action*> removeList;
110 std::vector<Action*> deferredRemoveList;
111
112 // Copy the deferred remove list under lock to avoid data races during the loop.
113 {
114 Lock l( mMutex );
115 if ( !mActionsRemoveList.empty() )
116 deferredRemoveList = mActionsRemoveList;
117 }
118
119 for ( size_t i = 0; i < count; i++ ) {
120 Action* action = actions[i];
121
122 if ( std::find( deferredRemoveList.begin(), deferredRemoveList.end(), action ) !=
123 deferredRemoveList.end() )
124 continue;
125
126 action->update( time );
127
128 if ( action->isDone() ) {
129 action->sendEvent( Action::ActionType::OnDone );
130
131 removeList.emplace_back( action );
132 }
133 }
134
135 mUpdating = false;
136
137 // Atomically get the list of deferred removals and clear the shared list.
138 {
139 Lock l( mMutex );
140 deferredRemoveList.clear(); // Reuse the vector
141 deferredRemoveList.swap( mActionsRemoveList );
142 }
143
144 // Process actions that were queued for removal.
145 for ( auto it = deferredRemoveList.begin(); it != deferredRemoveList.end(); ++it )
146 removeAction( *it );
147
148 // Process actions that finished during this update.
149 for ( auto it = removeList.begin(); it != removeList.end(); ++it )
150 removeAction( *it );
151}
152
153void ActionManager::update( const Time& time ) {
154 if ( isEmpty() )

Callers

nothing calls this directly

Calls 12

findFunction · 0.85
isEmptyFunction · 0.85
updateFunction · 0.85
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
isDoneMethod · 0.45
sendEventMethod · 0.45
clearMethod · 0.45
swapMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected