1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +00:00

prepared skill record for use in editor

This commit is contained in:
Marc Zinnschlag 2013-03-21 14:30:27 +01:00
parent 947ab6635b
commit 7df0f6aaee
2 changed files with 30 additions and 0 deletions

View file

@ -1,5 +1,7 @@
#include "loadskil.hpp" #include "loadskil.hpp"
#include <sstream>
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
@ -98,6 +100,22 @@ void Skill::load(ESMReader &esm)
esm.getHNT(mIndex, "INDX"); esm.getHNT(mIndex, "INDX");
esm.getHNT(mData, "SKDT", 24); esm.getHNT(mData, "SKDT", 24);
mDescription = esm.getHNOString("DESC"); mDescription = esm.getHNOString("DESC");
// create an ID from the index and the name (only used in the editor and likely to change in the
// future)
std::ostringstream stream;
stream << "#";
if (mIndex<10)
stream << "0";
stream << mIndex;
if (mIndex>=0 && mIndex<Length)
stream << sSkillNameIds[mIndex].substr (6);
mId = stream.str();
} }
void Skill::save(ESMWriter &esm) void Skill::save(ESMWriter &esm)
{ {
@ -105,4 +123,11 @@ void Skill::save(ESMWriter &esm)
esm.writeHNT("SKDT", mData, 24); esm.writeHNT("SKDT", mData, 24);
esm.writeHNOString("DESC", mDescription); esm.writeHNOString("DESC", mDescription);
} }
void Skill::blank()
{
mData.mAttribute = 0;
mData.mSpecialization = 0;
mData.mUseValue[0] = mData.mUseValue[1] = mData.mUseValue[2] = mData.mUseValue[3] = 1.0;
}
} }

View file

@ -19,6 +19,8 @@ class ESMWriter;
struct Skill struct Skill
{ {
std::string mId;
struct SKDTstruct struct SKDTstruct
{ {
int mAttribute; // see defs.hpp int mAttribute; // see defs.hpp
@ -73,6 +75,9 @@ struct Skill
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm); void save(ESMWriter &esm);
void blank();
///< Set record to default state (does not touch the ID/index).
}; };
} }
#endif #endif