| 27 | } |
| 28 | |
| 29 | void CLayerGame::SetTile(int x, int y, CTile Tile) |
| 30 | { |
| 31 | if(Tile.m_Index == TILE_THROUGH_CUT && Editor()->m_SelectEntitiesImage == "DDNet") |
| 32 | { |
| 33 | if(!Map()->m_pFrontLayer) |
| 34 | { |
| 35 | std::shared_ptr<CLayer> pLayerFront = std::make_shared<CLayerFront>(Map(), m_Width, m_Height); |
| 36 | Map()->MakeFrontLayer(pLayerFront); |
| 37 | Map()->m_pGameGroup->AddLayer(pLayerFront); |
| 38 | int GameGroupIndex = std::find(Map()->m_vpGroups.begin(), Map()->m_vpGroups.end(), Map()->m_pGameGroup) - Map()->m_vpGroups.begin(); |
| 39 | int LayerIndex = Map()->m_vpGroups[GameGroupIndex]->m_vpLayers.size() - 1; |
| 40 | Map()->m_EditorHistory.RecordAction(std::make_shared<CEditorActionAddLayer>(Map(), GameGroupIndex, LayerIndex)); |
| 41 | } |
| 42 | CLayerTiles::SetTile(x, y, CTile{TILE_NOHOOK}); |
| 43 | Map()->m_pFrontLayer->CLayerTiles::SetTile(x, y, CTile{TILE_THROUGH_CUT}); // NOLINT(bugprone-parent-virtual-call) |
| 44 | } |
| 45 | else |
| 46 | { |
| 47 | if(Editor()->m_SelectEntitiesImage == "DDNet" && Map()->m_pFrontLayer && Map()->m_pFrontLayer->GetTile(x, y).m_Index == TILE_THROUGH_CUT) |
| 48 | { |
| 49 | Map()->m_pFrontLayer->CLayerTiles::SetTile(x, y, CTile{TILE_AIR}); // NOLINT(bugprone-parent-virtual-call) |
| 50 | } |
| 51 | if(Editor()->IsAllowPlaceUnusedTiles() || IsValidGameTile(Tile.m_Index)) |
| 52 | { |
| 53 | CLayerTiles::SetTile(x, y, Tile); |
| 54 | } |
| 55 | else |
| 56 | { |
| 57 | CLayerTiles::SetTile(x, y, CTile{TILE_AIR}); |
| 58 | ShowPreventUnusedTilesWarning(); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | bool CLayerGame::IsEmpty() const |
| 64 | { |
no test coverage detected