alter ESM::Script for storing id as std::string

actorid
greye 12 years ago
parent f0ecbbb056
commit 5ac54d1fff

@ -676,12 +676,6 @@ namespace MWWorld
return mExtEnd;
}
};
template <>
class Store<ESM::Script>
{
};
} //end namespace
#endif

@ -6,9 +6,18 @@
namespace ESM
{
struct SCHD
{
NAME32 mName;
SCHDstruct mData;
};
void Script::load(ESMReader &esm)
{
esm.getHNT(mData, "SCHD", 52);
SCHD data;
esm.getHNT(data, "SCHD", 52);
mData = data.mData;
mId = data.mName.toString();
// List of local variables
if (esm.isNextSub("SCVR"))
@ -48,7 +57,13 @@ void Script::save(ESMWriter &esm)
for (std::vector<std::string>::iterator it = mVarNames.begin(); it != mVarNames.end(); ++it)
varNameString.append(*it);
esm.writeHNT("SCHD", mData, 52);
SCHD data;
memset(&data, 0, sizeof(data));
data.mData = mData;
memcpy(data.mName.name, mId.c_str(), mId.size());
esm.writeHNT("SCHD", data, 52);
if (!mVarNames.empty())
{

@ -42,13 +42,13 @@ public:
approach though.
*/
NAME32 mName;
// These describe the sizes we need to allocate for the script
// data.
int mNumShorts, mNumLongs, mNumFloats, mScriptDataSize, mStringTableSize;
}; // 52 bytes
std::string mId;
SCHDstruct mData;
std::vector<std::string> mVarNames; // Variable names

Loading…
Cancel
Save