Skip to content

Commit 5b8029e

Browse files
committed
Fix dropdown menus in sensing blocks
1 parent 29b37d7 commit 5b8029e

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/blocks/sensingblocks.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ void SensingBlocks::compileTouchingObject(Compiler *compiler)
115115
{
116116
Input *input = compiler->input(TOUCHINGOBJECTMENU);
117117

118-
if (input->type() != Input::Type::ObscuredShadow) {
119-
assert(input->pointsToDropdownMenu());
118+
if (input->pointsToDropdownMenu()) {
120119
std::string value = input->selectedMenuItem();
121120

122121
if (value == "_mouse_")
@@ -144,8 +143,7 @@ void SensingBlocks::compileDistanceTo(Compiler *compiler)
144143
{
145144
Input *input = compiler->input(DISTANCETOMENU);
146145

147-
if (input->type() != Input::Type::ObscuredShadow) {
148-
assert(input->pointsToDropdownMenu());
146+
if (input->pointsToDropdownMenu()) {
149147
std::string value = input->selectedMenuItem();
150148

151149
if (value == "_mouse_")
@@ -240,8 +238,7 @@ void SensingBlocks::compileOf(Compiler *compiler)
240238
assert(input);
241239
BlockFunc f = nullptr;
242240

243-
if (input->type() != Input::Type::ObscuredShadow) {
244-
assert(input->pointsToDropdownMenu());
241+
if (input->pointsToDropdownMenu()) {
245242
std::string value = input->selectedMenuItem();
246243

247244
IEngine *engine = compiler->engine();

test/blocks/sensing_blocks_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class SensingBlocksTest : public testing::Test
8686
else {
8787
auto input = addNullInput(block, name, id);
8888
auto menu = std::make_shared<Block>(block->id() + "_menu", block->opcode() + "_menu");
89+
menu->setShadow(true);
8990
input->setValueBlock(menu);
9091
addDropdownField(menu, name, static_cast<SensingBlocks::Fields>(-1), selectedValue, static_cast<SensingBlocks::FieldValues>(-1));
9192
}

0 commit comments

Comments
 (0)