mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
only load + save auto mappers for tile layers, not physics layers
This commit is contained in:
parent
b8760cdce5
commit
d123d928b4
|
@ -439,6 +439,8 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
||||||
|
|
||||||
df.AddItem(MAPITEMTYPE_LAYER, LayerCount, sizeof(Item), &Item);
|
df.AddItem(MAPITEMTYPE_LAYER, LayerCount, sizeof(Item), &Item);
|
||||||
|
|
||||||
|
// save auto mapper of each tile layer (not physics layer)
|
||||||
|
if(!Item.m_Flags) {
|
||||||
CMapItemAutoMapperConfig ItemAutomapper;
|
CMapItemAutoMapperConfig ItemAutomapper;
|
||||||
ItemAutomapper.m_Version = CMapItemAutoMapperConfig::CURRENT_VERSION;
|
ItemAutomapper.m_Version = CMapItemAutoMapperConfig::CURRENT_VERSION;
|
||||||
ItemAutomapper.m_GroupId = GroupCount;
|
ItemAutomapper.m_GroupId = GroupCount;
|
||||||
|
@ -451,6 +453,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
||||||
|
|
||||||
df.AddItem(MAPITEMTYPE_AUTOMAPPER_CONFIG, AutomapperCount, sizeof(ItemAutomapper), &ItemAutomapper);
|
df.AddItem(MAPITEMTYPE_AUTOMAPPER_CONFIG, AutomapperCount, sizeof(ItemAutomapper), &ItemAutomapper);
|
||||||
AutomapperCount++;
|
AutomapperCount++;
|
||||||
|
}
|
||||||
|
|
||||||
GItem.m_NumLayers++;
|
GItem.m_NumLayers++;
|
||||||
LayerCount++;
|
LayerCount++;
|
||||||
|
@ -1280,10 +1283,13 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
||||||
if(pItem->m_Version == CMapItemAutoMapperConfig::CURRENT_VERSION)
|
if(pItem->m_Version == CMapItemAutoMapperConfig::CURRENT_VERSION)
|
||||||
{
|
{
|
||||||
if(pItem->m_GroupId >= 0 && pItem->m_GroupId < m_lGroups.size() &&
|
if(pItem->m_GroupId >= 0 && pItem->m_GroupId < m_lGroups.size() &&
|
||||||
pItem->m_LayerId >= 0 && pItem->m_LayerId < m_lGroups[pItem->m_GroupId]->m_lLayers.size() &&
|
pItem->m_LayerId >= 0 && pItem->m_LayerId < m_lGroups[pItem->m_GroupId]->m_lLayers.size()) {
|
||||||
m_lGroups[pItem->m_GroupId]->m_lLayers[pItem->m_LayerId]->m_Type == LAYERTYPE_TILES)
|
CLayer *pLayer = m_lGroups[pItem->m_GroupId]->m_lLayers[pItem->m_LayerId];
|
||||||
{
|
if (pLayer->m_Type == LAYERTYPE_TILES) {
|
||||||
CLayerTiles *pLayer = (CLayerTiles *)m_lGroups[pItem->m_GroupId]->m_lLayers[pItem->m_LayerId];
|
CLayerTiles *pLayer = (CLayerTiles *)m_lGroups[pItem->m_GroupId]->m_lLayers[pItem->m_LayerId];
|
||||||
|
// only load auto mappers for tile layers (not physics layers)
|
||||||
|
if (!(pLayer->m_Game || pLayer->m_Tele || pLayer->m_Speedup ||
|
||||||
|
pLayer->m_Front || pLayer->m_Switch || pLayer->m_Tune)) {
|
||||||
pLayer->m_AutoMapperConfig = pItem->m_AutomapperConfig;
|
pLayer->m_AutoMapperConfig = pItem->m_AutomapperConfig;
|
||||||
pLayer->m_Seed = pItem->m_AutomapperSeed;
|
pLayer->m_Seed = pItem->m_AutomapperSeed;
|
||||||
pLayer->m_AutoAutoMap = !!(pItem->m_Flags & CMapItemAutoMapperConfig::FLAG_AUTOMATIC);
|
pLayer->m_AutoAutoMap = !!(pItem->m_Flags & CMapItemAutoMapperConfig::FLAG_AUTOMATIC);
|
||||||
|
@ -1292,6 +1298,8 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue