Skip to content

Commit 462bfbc

Browse files
committed
add lofts and special types to MCDPatches.
1 parent 43add89 commit 462bfbc

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

src/Ruleset/MCDPatch.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ void MCDPatch::load(const YAML::Node &node)
7878
int terrainHeight = (*i)["terrainHeight"].as<int>();
7979
_terrainHeight.push_back(std::make_pair(MCDIndex, terrainHeight));
8080
}
81+
if ((*i)["specialType"])
82+
{
83+
int specialType = (*i)["specialType"].as<int>();
84+
_specialTypes.push_back(std::make_pair(MCDIndex, specialType));
85+
}
86+
if ((*i)["LOFTS"])
87+
{
88+
std::vector<int> lofts = (*i)["LOFTS"].as< std::vector<int> >();
89+
_LOFTS.push_back(std::make_pair(MCDIndex, lofts));
90+
}
8191
}
8292
}
8393

@@ -111,6 +121,19 @@ void MCDPatch::modifyData(MapDataSet *dataSet) const
111121
{
112122
dataSet->getObjects()->at(i->first)->setTerrainLevel(i->second);
113123
}
124+
for (std::vector<std::pair<size_t, int> >::const_iterator i = _specialTypes.begin(); i != _specialTypes.end(); ++i)
125+
{
126+
dataSet->getObjects()->at(i->first)->setSpecialType(i->second, dataSet->getObjects()->at(i->first)->getObjectType());
127+
}
128+
for (std::vector<std::pair<size_t, std::vector<int> > >::const_iterator i = _LOFTS.begin(); i != _LOFTS.end(); ++i)
129+
{
130+
int layer = 0;
131+
for (std::vector<int>::const_iterator j = i->second.begin(); j != i->second.end(); ++j)
132+
{
133+
dataSet->getObjects()->at(i->first)->setLoftID(*j, layer);
134+
++layer;
135+
}
136+
}
114137
}
115138

116139
}

src/Ruleset/MCDPatch.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class MapDataSet;
3232
class MCDPatch
3333
{
3434
private:
35-
std::vector<std::pair<size_t, int> > _bigWalls, _TUWalks, _TUFlys, _TUSlides, _deathTiles, _terrainHeight;
35+
std::vector<std::pair<size_t, int> > _bigWalls, _TUWalks, _TUFlys, _TUSlides, _deathTiles, _terrainHeight, _specialTypes;
36+
std::vector<std::pair<size_t, std::vector<int> > > _LOFTS;
3637
public:
3738
/// Creates an MCD Patch.
3839
MCDPatch();

0 commit comments

Comments
 (0)