Allow selecting switch number 0 in editor again

This reverts part of #5993 to allow switch number 0 to be selected again.
Switch number 0 is permanently enabled, so it useful for tiles that should always be switched on.
Eventually tiles that don't work with switch 0 (e.g. switch open/close tiles) should be made unplaceable and the switch number should be hidden for tiles where it doesn't have any effect (e.g. jump tiles). See #5995.
This commit is contained in:
Robert Müller 2022-11-01 21:52:49 +01:00
parent 333c3ed82d
commit d6d88d4370

View file

@ -1646,7 +1646,7 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View, void *pContext)
}; };
CProperty aProps[] = { CProperty aProps[] = {
{"Number", pEditor->m_SwitchNum, PROPTYPE_INT_STEP, 1, 255}, {"Number", pEditor->m_SwitchNum, PROPTYPE_INT_STEP, 0, 255},
{"Delay", pEditor->m_SwitchDelay, PROPTYPE_INT_STEP, 0, 255}, {"Delay", pEditor->m_SwitchDelay, PROPTYPE_INT_STEP, 0, 255},
{nullptr}, {nullptr},
}; };
@ -1657,7 +1657,7 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View, void *pContext)
if(Prop == PROP_SwitchNumber) if(Prop == PROP_SwitchNumber)
{ {
pEditor->m_SwitchNum = (NewVal - 1 + 255) % 255 + 1; pEditor->m_SwitchNum = (NewVal + 256) % 256;
} }
else if(Prop == PROP_SwitchDelay) else if(Prop == PROP_SwitchDelay)
{ {