improved magic effect IDs

deque
Marc Zinnschlag 10 years ago
parent 23fd314294
commit 850dbb55a5

@ -1,6 +1,7 @@
#include "loadmgef.hpp"
#include <stdexcept>
#include <sstream>
#include <boost/lexical_cast.hpp>
@ -192,8 +193,7 @@ void MagicEffect::load(ESMReader &esm)
{
esm.getHNT(mIndex, "INDX");
if (mIndex>=0 && mIndex<Length)
mId = sIds[mIndex];
mId = indexToId (mIndex);
esm.getHNT(mData, "MEDT", 36);
if (esm.getFormat() == 0)
@ -564,4 +564,29 @@ MagicEffect::MagnitudeDisplayType MagicEffect::getMagnitudeDisplayType() const {
mAreaSound.clear();
mDescription.clear();
}
std::string MagicEffect::indexToId (int index)
{
std::ostringstream stream;
if (index!=-1)
{
stream << "#";
if (index<100)
{
stream << "0";
if (index<10)
stream << "0";
}
stream << index;
if (index>=0 && index<Length)
stream << sIds[index];
}
return stream.str();
}
}

@ -252,6 +252,8 @@ struct MagicEffect
Length
};
static std::string indexToId (int index);
};
}
#endif

Loading…
Cancel
Save