Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3942
Modified Files:
ChangeLog npc.cpp timing.cpp
Log Message:
AI Checks
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.104
retrieving revision 1.105
diff -C2 -d -r1.104 -r1.105
*** ChangeLog 10 Oct 2004 17:51:24 -0000 1.104
--- ChangeLog 11 Oct 2004 19:03:41 -0000 1.105
***************
*** 42,45 ****
--- 42,46 ----
- Improved NPC movement and allowed custom speeds per npc.
- Reduced network latency.
+ - Made AI checks occur more often if the npc moves faster.
Wolfpack 12.9.11 Beta (26. September 2004)
Index: timing.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/timing.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** timing.cpp 7 Oct 2004 23:02:26 -0000 1.17
--- timing.cpp 11 Oct 2004 19:03:42 -0000 1.18
***************
*** 453,468 ****
startProfiling(PF_AICHECK);
npc->ai()->check();
-
- // Check the current action
- Monster_Aggr_MoveToTarget *a1 = dynamic_cast<Monster_Aggr_MoveToTarget*>(npc->ai()->currentAction());
- Human_Guard_MoveToTarget *a2 = dynamic_cast<Human_Guard_MoveToTarget*>(npc->ai()->currentAction());
-
- if (a1 || a2) {
- npc->setAICheckTime( time + 100 );
- } else {
- unsigned int delay = RandomNum(250, 700);
- npc->setAICheckTime( time + delay );
- }
-
stopProfiling(PF_AICHECK);
}
--- 453,456 ----
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.121
retrieving revision 1.122
diff -C2 -d -r1.121 -r1.122
*** npc.cpp 10 Oct 2004 17:51:24 -0000 1.121
--- npc.cpp 11 Oct 2004 19:03:41 -0000 1.122
***************
*** 298,308 ****
}
// This creature is not player or monster controlled. Thus slower.
if (isTamed()) {
! // Creatures following their owner are a lot faster than usual
! if (wanderFollowTarget() == owner() && ai_ && dynamic_cast<Action_Wander*>(ai_->currentAction()) != 0) {
! interval >>= 1; // Half the time
! }
!
interval -= 75; // A little faster
} else if (!summoned()) {
--- 298,308 ----
}
+ if (owner() && wanderFollowTarget() == owner() && ai_ && dynamic_cast<Action_Wander*>(ai_->currentAction()) != 0) {
+ interval >>= 1; // Half the time
+ }
+
// This creature is not player or monster controlled. Thus slower.
if (isTamed()) {
! // Creatures following their owner are a lot faster than usual
interval -= 75; // A little faster
} else if (!summoned()) {
***************
*** 317,320 ****
--- 317,324 ----
setNextMoveTime(Server::instance()->time() + interval);
+
+ if (nextMoveTime() < aiCheckTime()) {
+ setAICheckTime(nextMoveTime());
+ }
}
|