Feature #391 AiPackage classes

actorid
marcin 12 years ago
commit 850606cc30

@ -0,0 +1,56 @@
#include "aiescort.hpp"
MWMechanics::AiEscort::AiEscort(std::string ActorID,int Duration, float X, float Y, float Z, bool Reset)
{
mActorID = ActorID;
mDuration = Duration;
mX = X;
mY = Y;
mZ = Z;
mReset = Reset;
}
MWMechanics::AiEscort *MWMechanics::AiEscort::clone() const
{
AiEscort * temp = new AiEscort(*this);
return temp;
}
bool MWMechanics::AiEscort::execute (const MWWorld::Ptr& actor)
{
std::cout << "AiEscort complted. \n";
return true;
}
int MWMechanics::AiEscort::getTypeId() const
{
return 2;
}
float MWMechanics::AiEscort::getX()
{
return mX;
}
float MWMechanics::AiEscort::getY()
{
return mY;
}
float MWMechanics::AiEscort::getZ()
{
return mZ;
}
bool MWMechanics::AiEscort::getReset()
{
return mReset;
}
std::string MWMechanics::AiEscort::getActorID()
{
return mActorID;
}
int MWMechanics::AiEscort::getDuration()
{
return mDuration;
}

@ -0,0 +1,41 @@
#ifndef AIESCORT_H
#define AIESCORT_H
#include "aipackage.hpp"
#include <iostream>
#include <vector>
namespace MWWorld
{
class Ptr;
}
namespace MWMechanics
{
class AiEscort : public AiPackage
{
public:
AiEscort(std::string ActorID,int Duration, float X, float Y, float Z, bool Reset = false);
virtual AiEscort *clone() const;
virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed?
virtual int getTypeId() const;
float getX();
float getY();
float getZ();
bool getReset();
std::string getActorID();
int getDuration();
private:
std::string mActorID;
float mX;
float mY;
float mZ;
int mDuration;
bool mReset;
};
}
#endif // AIESCORT_H

@ -0,0 +1,27 @@
#include "aifallow.hpp"
MWMechanics::AiFallow::AiFallow(std::string ActorID,float duration, float X, float Y, float Z, bool Reset)
{
mActorID = ActorID;
mDuration = duration;
mX = X;
mY = Y;
mZ = Z;
mReset = Reset;
}
MWMechanics::AiFallow *MWMechanics::AiFallow::clone() const
{
AiFallow * temp = new AiFallow(*this);
return temp;
}
bool MWMechanics::AiFallow::execute (const MWWorld::Ptr& actor)
{
std::cout << "AiFallow complited. \n";
return true;
}
int MWMechanics::AiFallow::getTypeId() const
{
return 3;
}

@ -0,0 +1,36 @@
#ifndef AIFALLOW_H
#define AIFALLOW_H
#include "aipackage.hpp"
#include <string>
#include <iostream>
namespace MWWorld
{
class Ptr;
}
namespace MWMechanics
{
class AiFallow : AiPackage
{
public:
AiFallow(std::string ActorID,float duration, float X, float Y, float Z, bool Reset = false);
virtual AiFallow *clone() const;
virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed?
virtual int getTypeId() const;
///< 0: Wanter, 1 Travel, 2 Escort, 3 Follo
private:
float mDuration;
float mX;
float mY;
float mZ;
bool mReset;
std::string mActorID;
};
}
#endif // AIFALLOW_H

@ -0,0 +1,44 @@
#include "aitravel.hpp"
MWMechanics::AiTravel::AiTravel(float x, float y, float z, bool reset)
{
mX = x;
mY = y;
mZ = z;
mReset = reset;
}
MWMechanics::AiTravel * MWMechanics::AiTravel::clone() const
{
AiTravel * temp = new AiTravel(*this);
return temp;
}
bool MWMechanics::AiTravel::execute (const MWWorld::Ptr& actor)
{
std::cout << "AiTravel complited. \n";
return true;
}
int MWMechanics::AiTravel::getTypeId() const
{
return 1;
}
float MWMechanics::AiTravel::getX()
{
return mX;
}
float MWMechanics::AiTravel::getY()
{
return mY;
}
float MWMechanics::AiTravel::getZ()
{
return mZ;
}
bool MWMechanics::AiTravel::getReset()
{
return mReset;
}

@ -0,0 +1,37 @@
#ifndef AITRAVEL_HPP_INCLUDED
#define AITRAVEL_HPP_INCLUDED
#include "aipackage.hpp"
#include <iostream>
namespace MWWorld
{
class Ptr;
}
namespace MWMechanics
{
class AiTravel : public AiPackage
{
public:
AiTravel(float x, float y, float z, bool reset = false);
virtual AiTravel *clone() const;
virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed?
virtual int getTypeId() const;
float getX();
float getY();
float getZ();
bool getReset();
private:
float mX;
float mY;
float mZ;
bool mReset;
};
}
#endif // AITRAVEL_HPP_INCLUDED

@ -0,0 +1,55 @@
#include "aiwander.hpp"
MWMechanics::AiWander::AiWander(int distance, int duration, int timeOfDay,std::vector<int> Idle,bool reset)
{
mDistance = distance;
mDuration = duration;
mTimeOfDay = timeOfDay;
mIdle = Idle;
mReset = reset;
}
int MWMechanics::AiWander::getDistance() const
{
return mDistance;
}
int MWMechanics::AiWander::getDuration() const
{
return mDuration;
}
int MWMechanics::AiWander::getTimeOfDay() const
{
return mTimeOfDay;
}
bool MWMechanics::AiWander::getReset() const
{
return mReset;
}
MWMechanics::AiPackage * MWMechanics::AiWander::clone() const
{
return new AiWander(*this);
}
bool MWMechanics::AiWander::execute (const MWWorld::Ptr& actor)
{
std::cout << "AiWadner complited. \n";
return true;
}
int MWMechanics::AiWander::getTypeId() const
{
return 0;
}
int MWMechanics::AiWander::getIdle(int index) const
{
if(index < 0 || (uint)index > mIdle.size())
return -1;
int temp;
temp = mIdle.at(index);
return temp;
}

@ -0,0 +1,42 @@
#ifndef AIWANDER_H
#define AIWANDER_H
#include "aipackage.hpp"
#include <iostream>
#include <vector>
namespace MWWorld
{
class Ptr;
}
namespace MWMechanics
{
class AiWander : public AiPackage
{
public:
AiWander(int distance, int duration, int timeOfDay,std::vector<int> Idle,bool reset=false);
virtual AiPackage *clone() const;
virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed?
virtual int getTypeId() const;
///< 0: Wander
int getDistance() const;
int getDuration()const;
int getTimeOfDay()const;
bool getReset()const;
int getIdle(int index) const;
private:
int mDistance;
int mDuration;
int mTimeOfDay;
std::vector<int> mIdle;
bool mReset;
};
}
#endif // AIWANDER_H
Loading…
Cancel
Save