MCPcopy Create free account
hub / github.com/ddnet/ddnet / PlaceBorderTiles

Method PlaceBorderTiles

src/game/editor/mapitems/map.cpp:1076–1097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1074}
1075
1076void CEditorMap::PlaceBorderTiles()
1077{
1078 std::shared_ptr<CLayerTiles> pT = std::static_pointer_cast<CLayerTiles>(SelectedLayerType(0, LAYERTYPE_TILES));
1079
1080 for(int i = 0; i < pT->m_Width * pT->m_Height; ++i)
1081 {
1082 if(i % pT->m_Width < 2 || i % pT->m_Width > pT->m_Width - 3 || i < pT->m_Width * 2 || i > pT->m_Width * (pT->m_Height - 2))
1083 {
1084 int x = i % pT->m_Width;
1085 int y = i / pT->m_Width;
1086
1087 CTile Current = pT->m_pTiles[i];
1088 Current.m_Index = 1;
1089 pT->SetTile(x, y, Current);
1090 }
1091 }
1092
1093 int GameGroupIndex = std::find(m_vpGroups.begin(), m_vpGroups.end(), m_pGameGroup) - m_vpGroups.begin();
1094 m_EditorHistory.RecordAction(std::make_shared<CEditorBrushDrawAction>(this, GameGroupIndex), "Tool 'Make borders'");
1095
1096 OnModify();
1097}

Callers 1

PopupEventMethod · 0.80

Calls 4

beginMethod · 0.80
endMethod · 0.80
RecordActionMethod · 0.80
SetTileMethod · 0.45

Tested by

no test coverage detected