@@ -142,7 +142,6 @@ void Engine::frame()
142142 auto index = it - m_runningScripts.begin ();
143143 m_runningScripts.erase (m_runningScripts.begin () + index);
144144 m_scriptPositions.erase (m_scriptPositions.begin () + index);
145- scriptCount--;
146145 }
147146 m_scriptsToRemove.clear ();
148147}
@@ -153,7 +152,6 @@ void Engine::frame()
153152 */
154153void Engine::start ()
155154{
156- scriptCount = 0 ;
157155 for (auto target : m_targets) {
158156 auto gfBlocks = target->greenFlagBlocks ();
159157 for (auto block : gfBlocks)
@@ -165,7 +163,6 @@ void Engine::start()
165163void Engine::stop ()
166164{
167165 m_runningScripts.clear ();
168- scriptCount = 0 ;
169166}
170167
171168/* ! Starts a script with the given top level block as the given Target (a sprite or the stage). */
@@ -186,7 +183,6 @@ void Engine::startScript(std::shared_ptr<Block> topLevelBlock, std::shared_ptr<T
186183 auto vm = m_scripts[topLevelBlock].get ();
187184 m_runningScripts.push_back (vm);
188185 m_scriptPositions.push_back (vm->bytecode ());
189- scriptCount++;
190186 }
191187}
192188
@@ -205,7 +201,6 @@ void libscratchcpp::Engine::broadcast(unsigned int index, VirtualMachine *source
205201 } else {
206202 m_runningScripts.push_back (vm);
207203 m_scriptPositions.push_back (vm->bytecode ());
208- scriptCount++;
209204 }
210205 }
211206}
@@ -249,7 +244,7 @@ void Engine::run()
249244 auto lastFrameTime = std::chrono::steady_clock::now ();
250245 // Execute the frame
251246 frame ();
252- if (scriptCount <= 0 )
247+ if (m_runningScripts. size () <= 0 )
253248 break ;
254249
255250 // Sleep until the time for the next frame
@@ -279,27 +274,6 @@ void Engine::breakFrame()
279274 m_breakFrame = true ;
280275}
281276
282- /* ! Call this from a block implementation to prevent the engine from moving to next block. */
283- void libscratchcpp::Engine::stayOnCurrentBlock ()
284- {
285- m_stayOnCurrentBlock = true ;
286- }
287-
288- /* !
289- * Call this from a block implementation to force screen refresh after the current loop period (if the block is in a loop).\n
290- * This should for example called from some motion and looks blocks.
291- */
292- void Engine::breakAtomicScript ()
293- {
294- m_atomic = false ;
295- }
296-
297- /* ! Returns true if the current script is atomic (e. g. there's a loop running without screen refresh). */
298- bool Engine::isAtomic ()
299- {
300- return m_atomic;
301- }
302-
303277/* ! Registers the given block section. */
304278void Engine::registerSection (std::shared_ptr<IBlockSection> section)
305279{
0 commit comments