2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 ///////////////////////////////////////////////////////////////////////////////
7 // $Header: r:/t2repos/thief2/src/ai/ainet.cpp,v 1.5 2000/02/19 12:48:44 toml Exp $
9 // This module serves as the primary interface between AIs and networking.
23 #include <dbmem.h> // must be last header!
25 ///////////////////////////////////////////////////////////////////////////////
30 STDMETHODIMP_(const char *) cAINetwork::GetName()
32 return "Networking component";
35 ///////////////////////////////////////
37 STDMETHODIMP_(void) cAINetwork::Init()
39 SetNotifications(kAICN_ModeChange
);
40 SetNotifications(kAICN_SimStart
);
43 ///////////////////////////////////////
45 // When the AI changes modes, update its heartbeat rate appropriately.
46 // At the moment, the rates are hardcoded; this should probably be
47 // stored in some more flexible fashion in the long run...
50 // @TBD: These rates are chosen out of a hat, and should be tuned:
51 #define EFFICIENT_RATE 10000
52 STDMETHODIMP_(void) cAINetwork::OnModeChange(eAIMode previous
, eAIMode mode
)
54 AutoAppIPtr(NetManager
);
58 case kAIM_SuperEfficient
:
60 if (previous
> kAIM_Efficient
)
61 PhysNetSetSleep(GetID(), TRUE
);
65 ObjSetHeartbeat(GetID(), mode
==kAIM_Normal
? NORMAL_RATE
: COMBAT_RATE
);
66 if (previous
< kAIM_Normal
)
67 PhysNetSetSleep(GetID(), FALSE
, TRUE
);
70 Warning(("cAINetwork Mode Change: Unknown mode %d\n", mode
));
75 ///////////////////////////////////////////////////////////////////////////////
77 STDMETHODIMP_(void) cAINetwork::OnSimStart()
79 // This is now done in aiman::AllNetPlayersJoined() instead, due
80 // to timing constraints:
81 //eAIMode mode = m_pAIState->GetMode();
82 //AutoAppIPtr(NetManager);
83 //PhysNetSetSleep(GetID(), mode <= kAIM_Efficient);
84 //ObjSetHeartbeat(GetID(), mode==kAIM_Combat ? COMBAT_RATE : NORMAL_RATE);
87 ///////////////////////////////////////////////////////////////////////////////