Update of /cvsroot/wpdev/wolfpack/ai
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8972/ai
Modified Files:
ai.cpp ai.h ai_monsters.cpp
Log Message:
npc movement.
Index: ai.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai/ai.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** ai.h 9 Oct 2004 14:32:21 -0000 1.18
--- ai.h 10 Oct 2004 17:51:24 -0000 1.19
***************
*** 66,69 ****
--- 66,72 ----
}
+ // is this action passive (wandering, etc.)?
+ virtual bool isPassive() = 0;
+
// executes the action
virtual void execute() = 0;
***************
*** 183,186 ****
--- 186,190 ----
}
public:
+ virtual bool isPassive();
Action_Wander( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ), waitForPathCalculation( 0 )
{
***************
*** 253,257 ****
virtual float preCondition();
virtual float postCondition();
!
virtual const char* name()
{
--- 257,263 ----
virtual float preCondition();
virtual float postCondition();
! virtual bool isPassive() {
! return false;
! }
virtual const char* name()
{
***************
*** 292,295 ****
--- 298,306 ----
nextTry = 0;
}
+
+ virtual bool isPassive() {
+ return false;
+ }
+
virtual void execute();
virtual float preCondition();
***************
*** 309,312 ****
--- 320,327 ----
}
public:
+ virtual bool isPassive() {
+ return false;
+ }
+
Monster_Aggr_Fight( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai )
{
***************
*** 588,591 ****
--- 603,607 ----
{
}
+ virtual bool isPassive();
virtual void execute();
virtual float preCondition();
***************
*** 629,633 ****
{
}
!
static void registerInFactory( const QString& name );
virtual QString name()
--- 645,649 ----
{
}
!
static void registerInFactory( const QString& name );
virtual QString name()
***************
*** 666,669 ****
--- 682,688 ----
virtual float preCondition();
virtual float postCondition();
+ virtual bool isPassive() {
+ return false;
+ }
virtual const char* name()
***************
*** 683,686 ****
--- 702,708 ----
{
}
+ virtual bool isPassive() {
+ return false;
+ }
virtual void execute();
virtual float preCondition();
***************
*** 703,706 ****
--- 725,731 ----
{
}
+ virtual bool isPassive() {
+ return false;
+ }
virtual void execute();
virtual float preCondition();
***************
*** 786,789 ****
--- 811,817 ----
{
}
+ virtual bool isPassive() {
+ return false;
+ }
virtual void execute();
virtual float preCondition();
Index: ai.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai/ai.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** ai.cpp 3 Oct 2004 13:51:40 -0000 1.36
--- ai.cpp 10 Oct 2004 17:51:24 -0000 1.37
***************
*** 425,428 ****
--- 425,442 ----
}
+ bool Action_Wander::isPassive() {
+ if (m_npc->attackTarget()) {
+ return false;
+ }
+
+ enWanderTypes type = m_npc->wanderType();
+
+ if (type == enFreely || type == enWanderSpawnregion || type == enCircle || type == enRectangle) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
float Action_Wander::preCondition()
{
***************
*** 1026,1027 ****
--- 1040,1045 ----
}
}
+
+ bool ScriptAction::isPassive() {
+ return false;
+ }
Index: ai_monsters.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai/ai_monsters.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** ai_monsters.cpp 9 Oct 2004 14:32:21 -0000 1.25
--- ai_monsters.cpp 10 Oct 2004 17:51:25 -0000 1.26
***************
*** 137,142 ****
m_currentVictimSer = INVALID_SERIAL;
m_npc->fight(0);
! }
!
if (nextVictimCheck < Server::instance()->time()) {
--- 137,141 ----
m_currentVictimSer = INVALID_SERIAL;
m_npc->fight(0);
! }
if (nextVictimCheck < Server::instance()->time()) {
***************
*** 296,303 ****
{
// We failed several times to reach the target so we wait
! if (nextTry > Server::instance()->time()) {
return;
}
Monster_Aggressive* pAI = dynamic_cast<Monster_Aggressive*>( m_ai );
if ( !pAI )
--- 295,304 ----
{
// We failed several times to reach the target so we wait
! if (nextTry > Server::instance()->time() || m_npc->nextMoveTime() > Server::instance()->time()) {
return;
}
+ m_npc->setNextMoveTime();
+
Monster_Aggressive* pAI = dynamic_cast<Monster_Aggressive*>( m_ai );
if ( !pAI )
|