Fix a bug for NpcStats::mUsedIds in savegames, and added a compile-time guard to prevent similar errors in the future.

deque
scrawl 11 years ago
parent dfacf8c044
commit 51020fdb5f

@ -74,6 +74,18 @@ class ESMWriter
endRecord(name);
}
private:
// Prevent using writeHNT with strings. This already happened by accident and results in
// state being discarded without any error on writing or reading it. :(
// writeHNString and friends must be used instead.
void writeHNT(const std::string &name, std::string data)
{
}
void writeT(const std::string& data)
{
}
public:
template<typename T>
void writeHNT(const std::string& name, const T& data, int size)
{

@ -140,7 +140,7 @@ void ESM::NpcStats::save (ESMWriter &esm) const
for (std::vector<std::string>::const_iterator iter (mUsedIds.begin()); iter!=mUsedIds.end();
++iter)
esm.writeHNT ("USED", *iter);
esm.writeHNString ("USED", *iter);
if (mTimeToStartDrowning)
esm.writeHNT ("DRTI", mTimeToStartDrowning);

Loading…
Cancel
Save