1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 08:37:12 +00:00

Feature #391 Dummy AI package classes

This commit is contained in:
marcin 2012-11-15 22:15:20 +01:00
parent e6c8e1f0d7
commit 4b939c7521
9 changed files with 34 additions and 142 deletions

View File

@ -63,7 +63,7 @@ add_openmw_dir (mwclass
add_openmw_dir (mwmechanics add_openmw_dir (mwmechanics
mechanicsmanagerimp stat creaturestats magiceffects movement actors drawstate spells mechanicsmanagerimp stat creaturestats magiceffects movement actors drawstate spells
activespells npcstats aipackage aisequence alchemy aiwander aitravel aifallow aiescort activespells npcstats aipackage aisequence alchemy aiwander aitravel aifollow aiescort aiactivate
) )
add_openmw_dir (mwbase add_openmw_dir (mwbase

View File

@ -1,25 +1,18 @@
#include "aiescort.hpp" #include "aiescort.hpp"
#include <iostream>
MWMechanics::AiEscort::AiEscort(const std::string &ActorID,int Duration, float X, float Y, float Z):
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)
{ {
mActorID = ActorID;
mDuration = Duration;
mX = X;
mY = Y;
mZ = Z;
mReset = Reset;
} }
MWMechanics::AiEscort *MWMechanics::AiEscort::clone() const MWMechanics::AiEscort *MWMechanics::AiEscort::clone() const
{ {
AiEscort * temp = new AiEscort(*this); return new AiEscort(*this);
return temp;
} }
bool MWMechanics::AiEscort::execute (const MWWorld::Ptr& actor) bool MWMechanics::AiEscort::execute (const MWWorld::Ptr& actor)
{ {
std::cout << "AiEscort complted. \n"; std::cout << "AiEscort completed. \n";
return true; return true;
} }
@ -40,10 +33,6 @@ float MWMechanics::AiEscort::getZ()
{ {
return mZ; return mZ;
} }
bool MWMechanics::AiEscort::getReset()
{
return mReset;
}
std::string MWMechanics::AiEscort::getActorID() std::string MWMechanics::AiEscort::getActorID()
{ {

View File

@ -1,21 +1,15 @@
#ifndef AIESCORT_H #ifndef GAME_MWMECHANICS_AIESCORT_H
#define AIESCORT_H #define GAME_MWMECHANICS_AIESCORT_H
#include "aipackage.hpp" #include "aipackage.hpp"
#include <iostream> #include <string>
#include <vector>
namespace MWWorld
{
class Ptr;
}
namespace MWMechanics namespace MWMechanics
{ {
class AiEscort : public AiPackage class AiEscort : public AiPackage
{ {
public: public:
AiEscort(std::string ActorID,int Duration, float X, float Y, float Z, bool Reset = false); AiEscort(const std::string &ActorID,int Duration, float X, float Y, float Z);
virtual AiEscort *clone() const; virtual AiEscort *clone() const;
virtual bool execute (const MWWorld::Ptr& actor); virtual bool execute (const MWWorld::Ptr& actor);
@ -25,7 +19,6 @@ class AiEscort : public AiPackage
float getX(); float getX();
float getY(); float getY();
float getZ(); float getZ();
bool getReset();
std::string getActorID(); std::string getActorID();
int getDuration(); int getDuration();
@ -35,7 +28,7 @@ class AiEscort : public AiPackage
float mY; float mY;
float mZ; float mZ;
int mDuration; int mDuration;
bool mReset;
}; };
} }
#endif // AIESCORT_H #endif

View File

@ -1,27 +0,0 @@
#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;
}

View File

@ -1,36 +0,0 @@
#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

View File

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

View File

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

View File

@ -1,12 +1,9 @@
#include "aiwander.hpp" #include "aiwander.hpp"
#include <iostream>
MWMechanics::AiWander::AiWander(int distance, int duration, int timeOfDay,std::vector<int> Idle,bool reset) MWMechanics::AiWander::AiWander(int distance, int duration, int timeOfDay,std::vector<int> Idle):
mDistance(distance), mDuration(duration), mTimeOfDay(timeOfDay), mIdle(Idle)
{ {
mDistance = distance;
mDuration = duration;
mTimeOfDay = timeOfDay;
mIdle = Idle;
mReset = reset;
} }
int MWMechanics::AiWander::getDistance() const int MWMechanics::AiWander::getDistance() const
@ -24,11 +21,6 @@ int MWMechanics::AiWander::getTimeOfDay() const
return mTimeOfDay; return mTimeOfDay;
} }
bool MWMechanics::AiWander::getReset() const
{
return mReset;
}
MWMechanics::AiPackage * MWMechanics::AiWander::clone() const MWMechanics::AiPackage * MWMechanics::AiWander::clone() const
{ {
return new AiWander(*this); return new AiWander(*this);
@ -36,7 +28,7 @@ MWMechanics::AiPackage * MWMechanics::AiWander::clone() const
bool MWMechanics::AiWander::execute (const MWWorld::Ptr& actor) bool MWMechanics::AiWander::execute (const MWWorld::Ptr& actor)
{ {
std::cout << "AiWadner complited. \n"; std::cout << "AiWadner completed.\n";
return true; return true;
} }

View File

@ -1,15 +1,9 @@
#ifndef AIWANDER_H #ifndef GAME_MWMECHANICS_AIWANDER_H
#define AIWANDER_H #define GAME_MWMECHANICS_AIWANDER_H
#include "aipackage.hpp" #include "aipackage.hpp"
#include <iostream>
#include <vector> #include <vector>
namespace MWWorld
{
class Ptr;
}
namespace MWMechanics namespace MWMechanics
{ {
@ -17,7 +11,7 @@ class AiWander : public AiPackage
{ {
public: public:
AiWander(int distance, int duration, int timeOfDay,std::vector<int> Idle,bool reset=false); AiWander(int distance, int duration, int timeOfDay,std::vector<int> Idle);
virtual AiPackage *clone() const; virtual AiPackage *clone() const;
virtual bool execute (const MWWorld::Ptr& actor); virtual bool execute (const MWWorld::Ptr& actor);
///< \return Package completed? ///< \return Package completed?
@ -27,7 +21,6 @@ public:
int getDistance() const; int getDistance() const;
int getDuration()const; int getDuration()const;
int getTimeOfDay()const; int getTimeOfDay()const;
bool getReset()const;
int getIdle(int index) const; int getIdle(int index) const;
private: private:
@ -35,7 +28,6 @@ private:
int mDuration; int mDuration;
int mTimeOfDay; int mTimeOfDay;
std::vector<int> mIdle; std::vector<int> mIdle;
bool mReset;
}; };
} }