Skip to content

Commit 537ff52

Browse files
committed
Remove broadcast running methods from IEngine
1 parent 4d00b3f commit 537ff52

File tree

4 files changed

+0
-63
lines changed

4 files changed

+0
-63
lines changed

include/scratchcpp/iengine.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,6 @@ class LIBSCRATCHCPP_EXPORT IEngine
207207
/*! Toggles sprite fencing. */
208208
virtual void setSpriteFencingEnabled(bool enable) = 0;
209209

210-
/*! Returns true if there are any running script of the broadcast with the given index. */
211-
virtual bool broadcastRunning(unsigned int index) = 0;
212-
213-
/*! Returns true if there are any running script of the given broadcast. */
214-
virtual bool broadcastByPtrRunning(Broadcast *broadcast) = 0;
215-
216210
/*!
217211
* Call this from a block implementation to force a redraw (screen refresh).
218212
* \note This has no effect in "run without screen refresh" custom blocks.

src/engine/internal/engine.cpp

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -960,57 +960,6 @@ void Engine::setSpriteFencingEnabled(bool enable)
960960
m_spriteFencingEnabled = enable;
961961
}
962962

963-
bool Engine::broadcastRunning(unsigned int index)
964-
{
965-
if (index < 0 || index >= m_broadcasts.size())
966-
return false;
967-
968-
return broadcastByPtrRunning(m_broadcasts[index].get());
969-
}
970-
971-
bool Engine::broadcastByPtrRunning(Broadcast *broadcast)
972-
{
973-
if (broadcast->isBackdropBroadcast()) {
974-
// This broadcast belongs to a backdrop
975-
assert(m_broadcastMap.find(broadcast) == m_broadcastMap.cend());
976-
977-
for (auto thread : m_threads) {
978-
if (!thread->atEnd()) {
979-
Script *script = thread->script();
980-
auto topBlock = script->topBlock();
981-
982-
const auto &scripts = m_backdropChangeHats[script->target()];
983-
auto scriptIt = std::find(scripts.begin(), scripts.end(), script);
984-
auto scriptFieldMapIt = m_scriptHatFields.find(script);
985-
986-
if (scriptFieldMapIt != m_scriptHatFields.cend()) {
987-
const auto &fieldMap = scriptFieldMapIt->second;
988-
auto fieldIt = fieldMap.find(HatField::Backdrop);
989-
assert(fieldIt != fieldMap.cend());
990-
assert(topBlock->findFieldById(fieldIt->second));
991-
992-
if ((scriptIt != scripts.end()) && (topBlock->findFieldById(fieldIt->second)->value().toString() == broadcast->name()))
993-
return true;
994-
}
995-
}
996-
}
997-
} else {
998-
// This is a regular broadcast
999-
assert(m_broadcastMap.find(broadcast) != m_broadcastMap.cend());
1000-
const auto &scripts = m_broadcastMap[broadcast];
1001-
1002-
for (auto thread : m_threads) {
1003-
if (!thread->atEnd()) {
1004-
auto it = std::find_if(scripts.begin(), scripts.end(), [thread](Script *script) { return thread->script() == script; });
1005-
1006-
if (it != scripts.end())
1007-
return true;
1008-
}
1009-
}
1010-
}
1011-
return false;
1012-
}
1013-
1014963
void Engine::requestRedraw()
1015964
{
1016965
m_redrawRequested = true;

src/engine/internal/engine.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ class Engine : public IEngine
9898
bool spriteFencingEnabled() const override;
9999
void setSpriteFencingEnabled(bool enable) override;
100100

101-
bool broadcastRunning(unsigned int index) override;
102-
bool broadcastByPtrRunning(Broadcast *broadcast) override;
103-
104101
void requestRedraw() override;
105102

106103
ITimer *timer() const override;

test/mocks/enginemock.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ class EngineMock : public IEngine
8080
MOCK_METHOD(bool, spriteFencingEnabled, (), (const, override));
8181
MOCK_METHOD(void, setSpriteFencingEnabled, (bool), (override));
8282

83-
MOCK_METHOD(bool, broadcastRunning, (unsigned int), (override));
84-
MOCK_METHOD(bool, broadcastByPtrRunning, (Broadcast *), (override));
85-
8683
MOCK_METHOD(void, requestRedraw, (), (override));
8784

8885
MOCK_METHOD(ITimer *, timer, (), (const, override));

0 commit comments

Comments
 (0)