Skip to content

Commit bbc9a1a

Browse files
committed
Engine: Remove obsolete members
1 parent 773ad44 commit bbc9a1a

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

src/engine/engine.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/
154153
void 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()
165163
void 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. */
304278
void Engine::registerSection(std::shared_ptr<IBlockSection> section)
305279
{

src/engine/engine.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ class LIBSCRATCHCPP_EXPORT Engine
4343
bool broadcastRunning(unsigned int index);
4444

4545
void breakFrame();
46-
void stayOnCurrentBlock();
47-
void breakAtomicScript();
48-
bool isAtomic();
4946

5047
void registerSection(std::shared_ptr<IBlockSection> section);
5148
unsigned int functionIndex(BlockFunc f);
@@ -85,9 +82,6 @@ class LIBSCRATCHCPP_EXPORT Engine
8582
std::vector<BlockFunc> m_functions;
8683

8784
bool m_breakFrame = false;
88-
bool m_stayOnCurrentBlock = false;
89-
bool m_atomic = true;
90-
int scriptCount = 0;
9185
};
9286

9387
} // namespace libscratchcpp

0 commit comments

Comments
 (0)