Nicer fix for crash

This commit is contained in:
def 2019-01-10 15:39:11 +01:00
parent 1c85c962ef
commit 16f6e23aaa
2 changed files with 9 additions and 10 deletions

View file

@ -365,15 +365,15 @@ void CAutoMapper::ProceedLocalized(CLayerTiles *pLayer, int ConfigID, int Seed,
CConfiguration *pConf = &m_lConfigs[ConfigID];
int CommitFromX = max(X + pConf->m_StartX, 0);
int CommitFromY = max(Y + pConf->m_StartY, 0);
int CommitToX = min(X + Width + pConf->m_EndX, pLayer->m_Width);
int CommitToY = min(Y + Height + pConf->m_EndY, pLayer->m_Height);
int CommitFromX = clamp(X + pConf->m_StartX, 0, pLayer->m_Width);
int CommitFromY = clamp(Y + pConf->m_StartY, 0, pLayer->m_Height);
int CommitToX = clamp(X + Width + pConf->m_EndX, 0, pLayer->m_Width);
int CommitToY = clamp(Y + Height + pConf->m_EndY, 0, pLayer->m_Height);
int UpdateFromX = max(X + 3 * pConf->m_StartX, 0);
int UpdateFromY = max(Y + 3 * pConf->m_StartY, 0);
int UpdateToX = min(X + Width + 3 * pConf->m_EndX, pLayer->m_Width);
int UpdateToY = min(Y + Height + 3 * pConf->m_EndY, pLayer->m_Height);
int UpdateFromX = clamp(X + 3 * pConf->m_StartX, 0, pLayer->m_Width);
int UpdateFromY = clamp(Y + 3 * pConf->m_StartY, 0, pLayer->m_Height);
int UpdateToX = clamp(X + Width + 3 * pConf->m_EndX, 0, pLayer->m_Width);
int UpdateToY = clamp(Y + Height + 3 * pConf->m_EndY, 0, pLayer->m_Height);
CLayerTiles *pUpdateLayer;
if (UpdateFromX != 0 || UpdateFromY != 0 || UpdateToX != pLayer->m_Width || UpdateToY != pLayer->m_Width)

View file

@ -432,8 +432,7 @@ void CLayerTiles::BrushDraw(CLayer *pBrush, float wx, float wy)
SetTile(fx, fy, l->m_pTiles[y*l->m_Width+x]);
}
if(sx >= 0 && sx + l->m_Width < m_Width && sy >= 0 && sy + l->m_Height < m_Height)
FlagModified(sx, sy, l->m_Width, l->m_Height);
FlagModified(sx, sy, l->m_Width, l->m_Height);
}
void CLayerTiles::BrushFlipX()