some code cleanup
started to move game-specific stuff into own class
This commit is contained in:
parent
e4b4e92e10
commit
fa64fe2ea7
12 changed files with 131 additions and 85 deletions
|
|
@ -1062,6 +1062,7 @@ public:
|
|||
float m_spawnTime; // time this bot spawned
|
||||
float m_timeTeamOrder; // time of last radio command
|
||||
float m_timePeriodicUpdate; // time to per-second think
|
||||
float m_timeRepotingInDelay; // time to delay report-in
|
||||
|
||||
bool m_isVIP; // bot is vip?
|
||||
|
||||
|
|
@ -1502,6 +1503,7 @@ public:
|
|||
};
|
||||
|
||||
#include <engine.h>
|
||||
#include <gamestate.h>
|
||||
|
||||
// expose bot super-globals
|
||||
extern NetworkMsg netmsg;
|
||||
|
|
@ -1509,6 +1511,7 @@ extern Localizer locale;
|
|||
extern Waypoint waypoints;
|
||||
extern BotManager bots;
|
||||
extern Engine engine;
|
||||
extern Game game;
|
||||
|
||||
// prototypes of bot functions...
|
||||
extern int GetWeaponReturn (bool isString, const char *weaponAlias, int weaponIndex = -1);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Yet Another POD-Bot, based on PODBot by Markus Klinge ("CountFloyd").
|
||||
// Copyright (c) YaPB Development Team.
|
||||
//
|
||||
|
|
|
|||
42
include/gamestate.h
Normal file
42
include/gamestate.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// Yet Another POD-Bot, based on PODBot by Markus Klinge ("CountFloyd").
|
||||
// Copyright (c) YaPB Development Team.
|
||||
//
|
||||
// This software is licensed under the BSD-style license.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// http://yapb.jeefo.net/license
|
||||
//
|
||||
// Purpose: Represents Counter-Strike Game.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
//
|
||||
class IGameEvents
|
||||
{
|
||||
public:
|
||||
|
||||
// called when new round occurs
|
||||
virtual void OnNewRound (void) = 0;
|
||||
};
|
||||
|
||||
class Game
|
||||
{
|
||||
private:
|
||||
IGameEvents *m_listener;
|
||||
|
||||
public:
|
||||
Game (void) : m_listener (NULL) { }
|
||||
~Game (void) { }
|
||||
|
||||
public:
|
||||
|
||||
// we have only one listener, so register it here
|
||||
void RegisterEventListener (IGameEvents *listener) { m_listener = listener; }
|
||||
|
||||
// get events interface
|
||||
IGameEvents *GetGameEventListener (void) { return m_listener; }
|
||||
};
|
||||
|
||||
// helper macros
|
||||
#define events game.GetGameEventListener ()
|
||||
Loading…
Add table
Add a link
Reference in a new issue