update saving AI packages

actorid
greye 12 years ago
parent 7606ebafd6
commit 597b88e95a

@ -40,5 +40,32 @@ namespace ESM
void AIPackageList::save(ESMWriter &esm)
{
typedef std::vector<AIPackage>::iterator PackageIter;
for (PackageIter it = mList.begin(); it != mList.end(); ++it) {
switch (it->mType) {
case AI_Wander:
esm.writeHNT("AI_W", it->mWander, sizeof(it->mWander));
break;
case AI_Travel:
esm.writeHNT("AI_T", it->mTravel, sizeof(it->mTravel));
break;
case AI_Activate:
esm.writeHNT("AI_A", it->mActivate, sizeof(it->mActivate));
break;
case AI_Escort:
case AI_Follow: {
const char *name = (it->mType == AI_Escort) ? "AI_E" : "AI_F";
esm.writeHNT(name, it->mTarget, sizeof(it->mTarget));
esm.writeHNOCString("CNDT", it->mCellName);
break;
}
default:
break;
}
}
}
}

@ -35,7 +35,7 @@ namespace ESM
struct AITravel
{
float mX, mY, mZ;
long mUnk;
int mUnk;
};
struct AITarget

@ -47,6 +47,9 @@ void Creature::save(ESMWriter &esm)
mInventory.save(esm);
mSpells.save(esm);
if (mHasAI) {
esm.writeHNT("AIDT", mAiData, sizeof(mAiData));
}
mAiPackage.save(esm);
}

@ -15,8 +15,6 @@ namespace ESM
struct GameSetting : public Record
{
std::string mId;
// One of these is used depending on the variable type
std::string mStr;
int mI;

@ -81,6 +81,15 @@ void NPC::save(ESMWriter &esm)
mInventory.save(esm);
mSpells.save(esm);
if (mHasAI) {
esm.writeHNT("AIDT", mAiData, sizeof(mAiData));
}
typedef std::vector<Dest>::iterator DestIter;
for (DestIter it = mTransport.begin(); it != mTransport.end(); ++it) {
esm.writeHNT("DODT", it->mPos, sizeof(it->mPos));
esm.writeHNOCString("DNAM", it->mCellName);
}
mAiPackage.save(esm);
}

@ -226,7 +226,7 @@ namespace ESMS
std::string id2 = toLower (id);
X& ref = list[id2];
ref.mId = id;
ref.setId(id);
ref.load(esm);
}

Loading…
Cancel
Save