You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw/components/esm3/aisequence.hpp

174 lines
3.8 KiB
C++

#ifndef OPENMW_COMPONENTS_ESM_AISEQUENCE_H
#define OPENMW_COMPONENTS_ESM_AISEQUENCE_H
#include <memory>
#include <string>
#include <vector>
#include "components/esm/defs.hpp"
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2 years ago
#include "components/esm/refid.hpp"
#include "components/esm/util.hpp"
namespace ESM
{
class ESMReader;
class ESMWriter;
namespace AiSequence
{
// format 0, saved games only
// As opposed to AiPackageList, this stores the "live" version of AI packages.
enum AiPackages
{
Ai_Wander = fourCC("WAND"),
Ai_Travel = fourCC("TRAV"),
Ai_Escort = fourCC("ESCO"),
Ai_Follow = fourCC("FOLL"),
Ai_Activate = fourCC("ACTI"),
Ai_Combat = fourCC("COMB"),
Ai_Pursue = fourCC("PURS")
};
struct AiPackage
{
virtual ~AiPackage() {}
};
#pragma pack(push, 1)
struct AiWanderData
{
short mDistance;
short mDuration;
unsigned char mTimeOfDay;
unsigned char mIdle[8];
unsigned char mShouldRepeat;
};
struct AiWanderDuration
{
float mRemainingDuration;
int unused;
};
struct AiTravelData
{
float mX, mY, mZ;
};
struct AiEscortData
{
float mX, mY, mZ;
short mDuration;
};
#pragma pack(pop)
struct AiWander : AiPackage
{
AiWanderData mData;
AiWanderDuration mDurationData; // was TimeStamp mStartTime
bool mStoredInitialActorPosition;
Vector3 mInitialActorPosition;
/// \todo add more AiWander state
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
};
struct AiTravel : AiPackage
{
AiTravelData mData;
bool mHidden;
bool mRepeat;
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
};
struct AiEscort : AiPackage
{
AiEscortData mData;
int mTargetActorId;
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2 years ago
ESM::RefId mTargetId;
ESM::RefId mCellId;
float mRemainingDuration;
bool mRepeat;
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
};
struct AiFollow : AiPackage
{
AiEscortData mData;
int mTargetActorId;
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2 years ago
ESM::RefId mTargetId;
ESM::RefId mCellId;
float mRemainingDuration;
bool mAlwaysFollow;
bool mCommanded;
bool mActive;
bool mRepeat;
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
};
struct AiActivate : AiPackage
{
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2 years ago
ESM::RefId mTargetId;
bool mRepeat;
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
};
struct AiCombat : AiPackage
{
int mTargetActorId;
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
};
struct AiPursue : AiPackage
{
int mTargetActorId;
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
};
struct AiPackageContainer
{
int mType;
std::unique_ptr<AiPackage> mPackage;
};
struct AiSequence
{
AiSequence() { mLastAiPackage = -1; }
std::vector<AiPackageContainer> mPackages;
int mLastAiPackage;
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
private:
AiSequence(const AiSequence&);
AiSequence& operator=(const AiSequence&);
};
}
}
#endif