4127: Editor Bug Fixed r=def- a=HamidReza585

Fixed reported bug: #4007 

![ScreenShot](https://user-images.githubusercontent.com/57710259/131328675-41404b79-1b60-4e2b-8ab5-215c552432eb.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
- [ ] 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: HamidReza <57710259+HamidReza585@users.noreply.github.com>
This commit is contained in:
bors[bot] 2021-08-30 11:03:59 +00:00 committed by GitHub
commit f48249786c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ CTile CLayerGame::GetTile(int x, int y)
void CLayerGame::SetTile(int x, int y, CTile tile)
{
if(tile.m_Index == TILE_THROUGH_CUT)
if(tile.m_Index == TILE_THROUGH_CUT && m_pEditor->m_SelectEntitiesImage == "DDNet")
{
if(!m_pEditor->m_Map.m_pFrontLayer)
{
@ -43,7 +43,7 @@ void CLayerGame::SetTile(int x, int y, CTile tile)
}
else
{
if(m_pEditor->m_Map.m_pFrontLayer && m_pEditor->m_Map.m_pFrontLayer->GetTile(x, y).m_Index == TILE_THROUGH_CUT)
if(m_pEditor->m_SelectEntitiesImage == "DDNet" && m_pEditor->m_Map.m_pFrontLayer && m_pEditor->m_Map.m_pFrontLayer->GetTile(x, y).m_Index == TILE_THROUGH_CUT)
{
CTile air = {TILE_AIR};
m_pEditor->m_Map.m_pFrontLayer->CLayerTiles::SetTile(x, y, air); // NOLINT(bugprone-parent-virtual-call)