mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-09 09:39:53 +00:00
Fix a bug for NpcStats::mUsedIds in savegames, and added a compile-time guard to prevent similar errors in the future.
This commit is contained in:
parent
dfacf8c044
commit
51020fdb5f
@ -74,6 +74,18 @@ class ESMWriter
|
|||||||
endRecord(name);
|
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>
|
template<typename T>
|
||||||
void writeHNT(const std::string& name, const T& data, int size)
|
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();
|
for (std::vector<std::string>::const_iterator iter (mUsedIds.begin()); iter!=mUsedIds.end();
|
||||||
++iter)
|
++iter)
|
||||||
esm.writeHNT ("USED", *iter);
|
esm.writeHNString ("USED", *iter);
|
||||||
|
|
||||||
if (mTimeToStartDrowning)
|
if (mTimeToStartDrowning)
|
||||||
esm.writeHNT ("DRTI", mTimeToStartDrowning);
|
esm.writeHNT ("DRTI", mTimeToStartDrowning);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user