Fix FillSelection with no selected brush

As reported by BannZay on Discord
This commit is contained in:
12pm 2019-04-30 14:24:13 +02:00
parent 9699d4ef06
commit 3f76e17830

View file

@ -419,7 +419,7 @@ void CLayerTiles::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
CLayerTiles *pLt = static_cast<CLayerTiles*>(pBrush);
bool Destructive = m_pEditor->m_BrushDrawDestructive || IsEmpty(pLt);
bool Destructive = m_pEditor->m_BrushDrawDestructive || Empty || IsEmpty(pLt);
for(int y = 0; y < h; y++)
{
@ -432,7 +432,7 @@ void CLayerTiles::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
continue;
bool HasTile = GetTile(fx, fy).m_Index;
if(pLt->GetTile(x, y).m_Index == TILE_THROUGH_CUT)
if(!Empty && pLt->GetTile(x, y).m_Index == TILE_THROUGH_CUT)
{
if(m_Game && m_pEditor->m_Map.m_pFrontLayer)
{
@ -448,7 +448,7 @@ void CLayerTiles::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
continue;
if(Empty)
m_pTiles[fy*m_Width+fx].m_Index = 1;
m_pTiles[fy*m_Width+fx].m_Index = 0;
else
SetTile(fx, fy, pLt->m_pTiles[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)]);
}
@ -1212,7 +1212,7 @@ void CLayerTele::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
CLayerTele *pLt = static_cast<CLayerTele*>(pBrush);
bool Destructive = m_pEditor->m_BrushDrawDestructive || IsEmpty(pLt);
bool Destructive = m_pEditor->m_BrushDrawDestructive || Empty || IsEmpty(pLt);
for(int y = 0; y < h; y++)
{
@ -1499,7 +1499,7 @@ void CLayerSpeedup::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
CLayerSpeedup *pLt = static_cast<CLayerSpeedup*>(pBrush);
bool Destructive = m_pEditor->m_BrushDrawDestructive || IsEmpty(pLt);
bool Destructive = m_pEditor->m_BrushDrawDestructive || Empty || IsEmpty(pLt);
for(int y = 0; y < h; y++)
{
@ -1832,7 +1832,7 @@ void CLayerSwitch::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
CLayerSwitch *pLt = static_cast<CLayerSwitch*>(pBrush);
bool Destructive = m_pEditor->m_BrushDrawDestructive || IsEmpty(pLt);
bool Destructive = m_pEditor->m_BrushDrawDestructive || Empty || IsEmpty(pLt);
for(int y = 0; y < h; y++)
{
@ -2114,7 +2114,7 @@ void CLayerTune::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
CLayerTune *pLt = static_cast<CLayerTune*>(pBrush);
bool Destructive = m_pEditor->m_BrushDrawDestructive || IsEmpty(pLt);
bool Destructive = m_pEditor->m_BrushDrawDestructive || Empty || IsEmpty(pLt);
for(int y = 0; y < h; y++)
{