Browse Source

Clean gamestate part

hlzbot-dirty
mittorn 8 years ago
parent
commit
70af6c8e9e
  1. 3
      dlls/bot/cs_bot_update.cpp
  2. 9
      dlls/bot/cs_gamestate.cpp
  3. 8
      dlls/bot/cs_gamestate.h

3
dlls/bot/cs_bot_update.cpp

@ -604,8 +604,7 @@ void CCSBot::Update()
&& GetProfile()->GetTeamwork() > minAutoFollowTeamwork && GetProfile()->GetTeamwork() > minAutoFollowTeamwork
&& CanAutoFollow() && CanAutoFollow()
&& !IsBusy() && !IsBusy()
&& !IsFollowing() && !IsFollowing())
&& !GetGameState()->IsAtPlantedBombsite())
{ {
// chance of following is proportional to teamwork attribute // chance of following is proportional to teamwork attribute
if (GetProfile()->GetTeamwork() > RANDOM_FLOAT(0.0f, 1.0f)) if (GetProfile()->GetTeamwork() > RANDOM_FLOAT(0.0f, 1.0f))

9
dlls/bot/cs_gamestate.cpp

@ -5,9 +5,10 @@ CSGameState::CSGameState(CCSBot *owner)
m_owner = owner; m_owner = owner;
m_isRoundOver = false; m_isRoundOver = false;
// m_bombState = MOVING; // m_bombState = MOVING;
#if 0
m_lastSawBomber.Invalidate(); m_lastSawBomber.Invalidate();
m_lastSawLooseBomb.Invalidate(); m_lastSawLooseBomb.Invalidate();
#endif
m_validateInterval.Invalidate(); m_validateInterval.Invalidate();
// m_isPlantedBombPosKnown = false; // m_isPlantedBombPosKnown = false;
// m_plantedBombsite = UNKNOWN; // m_plantedBombsite = UNKNOWN;
@ -36,12 +37,11 @@ void CSGameState::Reset()
CCSBotManager *ctrl = TheCSBots(); CCSBotManager *ctrl = TheCSBots();
m_isRoundOver = false; m_isRoundOver = false;
#if 0
// bomb // bomb
m_bombState = MOVING; m_bombState = MOVING;
m_lastSawBomber.Invalidate(); m_lastSawBomber.Invalidate();
m_lastSawLooseBomb.Invalidate(); m_lastSawLooseBomb.Invalidate();
#if 0
m_bombsiteCount = ctrl->GetZoneCount(); m_bombsiteCount = ctrl->GetZoneCount();
m_isPlantedBombPosKnown = false; m_isPlantedBombPosKnown = false;
@ -110,7 +110,7 @@ bool CSGameState::IsRoundOver() const
{ {
return m_isRoundOver; return m_isRoundOver;
} }
#if 0
void CSGameState::SetBombState(BombState state) void CSGameState::SetBombState(BombState state)
{ {
// if state changed, reset "last seen" timestamps // if state changed, reset "last seen" timestamps
@ -309,6 +309,7 @@ bool CSGameState::IsBombsiteClear(int zoneIndex) const
#endif #endif
return false; return false;
} }
#endif
#if 0 #if 0
void CSGameState::InitializeHostageInfo() void CSGameState::InitializeHostageInfo()
{ {

8
dlls/bot/cs_gamestate.h

@ -44,7 +44,7 @@ public:
void Reset(); void Reset();
void OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other); // Event handling void OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other); // Event handling
bool IsRoundOver() const; // true if round has been won or lost (but not yet reset) bool IsRoundOver() const; // true if round has been won or lost (but not yet reset)
#if 0
// bomb defuse scenario // bomb defuse scenario
enum BombState enum BombState
{ {
@ -81,14 +81,14 @@ public:
void ClearBombsite(int zoneIndex); // mark bombsite as clear void ClearBombsite(int zoneIndex); // mark bombsite as clear
const Vector *GetBombPosition() const; // return where we think the bomb is, or NULL if we don't know const Vector *GetBombPosition() const; // return where we think the bomb is, or NULL if we don't know
#endif
// hostage rescue scenario // hostage rescue scenario
//enum ValidateStatusType:unsigned char //C++11 feature //enum ValidateStatusType:unsigned char //C++11 feature
private: private:
CCSBot *m_owner; // who owns this gamestate CCSBot *m_owner; // who owns this gamestate
bool m_isRoundOver; // true if round is over, but no yet reset bool m_isRoundOver; // true if round is over, but no yet reset
#if 0
// bomb defuse scenario // bomb defuse scenario
void SetBombState(BombState state); void SetBombState(BombState state);
BombState GetBombState() { return m_bombState; } BombState GetBombState() { return m_bombState; }
@ -100,7 +100,7 @@ private:
IntervalTimer m_lastSawLooseBomb; IntervalTimer m_lastSawLooseBomb;
Vector m_looseBombPos; Vector m_looseBombPos;
#endif
CountdownTimer m_validateInterval; CountdownTimer m_validateInterval;
}; };

Loading…
Cancel
Save