2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 ///////////////////////////////////////////////////////////////////////////////
7 // $Header: r:/t2repos/thief2/src/ai/aidbgcmp.cpp,v 1.11 2000/02/19 12:17:29 toml Exp $
12 // #define PROFILE_ON 1
29 #include <dbmem.h> // must be last header!
31 ///////////////////////////////////////////////////////////////////////////////
33 // CLASS: cAIFlowDebugger
36 STDMETHODIMP_(const char *) cAIFlowDebugger::GetName()
38 return "Flow debugging component";
41 ///////////////////////////////////////
43 STDMETHODIMP_(void) cAIFlowDebugger::Init()
45 SetNotifications(kAICN_ActionProgress
| kAICN_GoalProgress
| kAICN_ModeChange
| kAICN_GoalChange
| kAICN_ActionChange
);
48 ///////////////////////////////////////
50 STDMETHODIMP_(void) cAIFlowDebugger::OnActionProgress(IAIAction
* pAction
)
53 // mprintf("***** %d\n", pAction->GetResult());
54 if (AIIsWatched(Flow
, GetID()))
56 if (!pAction
->InProgress())
59 pAction
->Describe(&desc
);
63 (pAction
->GetResult() == kAIR_Success
) ? "completed" : "failed to complete",
64 desc
.operator const char *());
70 ///////////////////////////////////////
72 STDMETHODIMP_(void) cAIFlowDebugger::OnGoalProgress(const cAIGoal
* pGoal
)
75 if (AIIsWatched(Flow
, GetID()))
77 if (!pGoal
->InProgress())
80 pGoal
->Describe(&desc
);
84 (pGoal
->result
== kAIR_Success
) ? "satisfied" : "failed to satisfy",
85 desc
.operator const char *());
91 ///////////////////////////////////////
93 STDMETHODIMP_(void) cAIFlowDebugger::OnModeChange(eAIMode previous
, eAIMode mode
)
97 "changed to mode \"%s\"",
101 ///////////////////////////////////////
103 STDMETHODIMP_(void) cAIFlowDebugger::OnGoalChange(const cAIGoal
* pPrevious
, const cAIGoal
* pGoal
)
105 // @TBD (toml 06-12-98): this whole class has to be ifndef ship
107 if (AIIsWatched(Flow
, GetID()))
110 const char * pszAbilityName
;
113 pGoal
->Describe(&desc
);
114 pszAbilityName
= pGoal
->pOwner
->GetName();
119 pszAbilityName
= "(none)";
122 AIWatch2(Flow
, GetID(),
123 "changed goal to \"%s\", ability \"%s\"", desc
.operator const char *(), pszAbilityName
);
128 ///////////////////////////////////////
130 STDMETHODIMP_(void) cAIFlowDebugger::OnActionChange(IAIAction
* pPrevious
, IAIAction
* pAction
)
133 if (AIIsWatched(Flow
, GetID()))
136 const char * pszAbilityName
;
139 pAction
->Describe(&desc
);
140 pszAbilityName
= pAction
->Access()->pOwner
->GetName();
144 desc
= "(No action)";
145 pszAbilityName
= "(none)";
148 AIWatch2(Flow
, GetID(),
149 "changed action to \"%s\" from ability \"%s\"", desc
.operator const char *(), pszAbilityName
);
154 ///////////////////////////////////////////////////////////////////////////////