Store last AI package in savegame

0.6.3
Andrei Kortunov 7 years ago
parent 3a0ee78d2b
commit 3d0631cfcc

@ -393,6 +393,8 @@ void AiSequence::writeState(ESM::AiSequence::AiSequence &sequence) const
{ {
(*iter)->writeState(sequence); (*iter)->writeState(sequence);
} }
sequence.mLastAiPackage = mLastAiPackage;
} }
void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence) void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence)
@ -404,7 +406,7 @@ void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence)
int count = 0; int count = 0;
for (std::vector<ESM::AiSequence::AiPackageContainer>::const_iterator it = sequence.mPackages.begin(); for (std::vector<ESM::AiSequence::AiPackageContainer>::const_iterator it = sequence.mPackages.begin();
it != sequence.mPackages.end(); ++it) it != sequence.mPackages.end(); ++it)
{ {
if (isActualAiPackage(it->mType)) if (isActualAiPackage(it->mType))
count++; count++;
} }
@ -463,6 +465,8 @@ void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence)
mPackages.push_back(package.release()); mPackages.push_back(package.release());
} }
mLastAiPackage = sequence.mLastAiPackage;
} }
void AiSequence::fastForward(const MWWorld::Ptr& actor, AiState& state) void AiSequence::fastForward(const MWWorld::Ptr& actor, AiState& state)

@ -156,6 +156,8 @@ namespace AiSequence
break; break;
} }
} }
esm.writeHNT ("LAST", mLastAiPackage);
} }
void AiSequence::load(ESMReader &esm) void AiSequence::load(ESMReader &esm)
@ -223,6 +225,8 @@ namespace AiSequence
return; return;
} }
} }
esm.getHNOT (mLastAiPackage, "LAST");
} }
} }
} }

@ -148,10 +148,14 @@ namespace ESM
struct AiSequence struct AiSequence
{ {
AiSequence() {} AiSequence()
{
mLastAiPackage = -1;
}
~AiSequence(); ~AiSequence();
std::vector<AiPackageContainer> mPackages; std::vector<AiPackageContainer> mPackages;
int mLastAiPackage;
void load (ESMReader &esm); void load (ESMReader &esm);
void save (ESMWriter &esm) const; void save (ESMWriter &esm) const;

Loading…
Cancel
Save