3586: Disallow some more switch entities r=heinrich5991 a=def-

As reported by ReD

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


3587: Fix color picker positioning (fixes #3574) r=heinrich5991 a=def-

![screenshot-20210201@193418](https://user-images.githubusercontent.com/2335377/106502369-93256080-64c4-11eb-832f-6c2318d63e87.png)
## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
bors[bot] 2021-02-01 20:49:35 +00:00 committed by GitHub
commit ed9abba485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 19 deletions

View file

@ -1612,25 +1612,17 @@ ColorHSLA CMenus::RenderHSLColorPicker(const CUIRect *pRect, unsigned int *pColo
PickerRect.w = ms_ColorPicker.ms_Width;
PickerRect.h = ms_ColorPicker.ms_Height;
if(ms_ColorPicker.m_pColor != pColor && !UI()->MouseInside(&PickerRect))
{
ms_ColorPicker.m_X = UI()->MouseX();
ms_ColorPicker.m_Y = UI()->MouseY();
ms_ColorPicker.m_pColor = pColor;
ms_ColorPicker.m_Active = true;
ms_ColorPicker.m_AttachedRect = *pRect;
ms_ColorPicker.m_HSVColor = color_cast<ColorHSVA, ColorHSLA>(HSLColor).Pack(false);
}
}
else
{
ms_ColorPicker.m_X = UI()->MouseX();
ms_ColorPicker.m_Y = UI()->MouseY();
ms_ColorPicker.m_pColor = pColor;
ms_ColorPicker.m_Active = true;
ms_ColorPicker.m_AttachedRect = *pRect;
ms_ColorPicker.m_HSVColor = color_cast<ColorHSVA, ColorHSLA>(HSLColor).Pack(false);
if(ms_ColorPicker.m_pColor == pColor || UI()->MouseInside(&PickerRect))
return HSLColor;
}
CUIRect *pScreen = UI()->Screen();
ms_ColorPicker.m_X = minimum(UI()->MouseX(), pScreen->w - ms_ColorPicker.ms_Width);
ms_ColorPicker.m_Y = minimum(UI()->MouseY(), pScreen->h - ms_ColorPicker.ms_Height);
ms_ColorPicker.m_pColor = pColor;
ms_ColorPicker.m_Active = true;
ms_ColorPicker.m_AttachedRect = *pRect;
ms_ColorPicker.m_HSVColor = color_cast<ColorHSVA, ColorHSLA>(HSLColor).Pack(false);
}
return HSLColor;

View file

@ -74,7 +74,7 @@ bool IsValidSwitchTile(int Index)
Index == TILE_SUBTRACT_TIME ||
Index == TILE_ALLOW_TELE_GUN ||
Index == TILE_ALLOW_BLUE_TELE_GUN ||
IsValidEntity(Index));
(IsValidEntity(Index) && Index >= ENTITY_OFFSET + ENTITY_ARMOR_1));
}
bool IsValidTuneTile(int Index)