improved magic effect IDs

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

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

Loading…
Cancel
Save