diff options
Diffstat (limited to 'src/core/gameinterface.h')
-rw-r--r-- | src/core/gameinterface.h | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/src/core/gameinterface.h b/src/core/gameinterface.h index 9eb6880..5e1f9be 100644 --- a/src/core/gameinterface.h +++ b/src/core/gameinterface.h @@ -12,55 +12,41 @@ namespace core { -/// broadcast a network message to all players -void message_broadcast(std::string const & message, int ignoreplayer=-1); - -/// send a message to a player -void message_send(Player &player, std::string const & message); - /// abstract interface from the core to the game-specific code class GameInterface { public: /// create a new game - GameInterface(const char *gamename = 0); + GameInterface(); + /// destroy the game virtual ~GameInterface(); - - /// a pointer to the current game instance - static GameInterface * instance(); - - /// true if the game is ready and running - bool connected; - - /// run one frame of the game - /// @param sec time since the previous frame, in seconds - virtual void frame(float seconds) = 0; - /// initialize the game - virtual bool init() = 0; +/*----- inspectors ---------------------------------------------- */ - /// shutdown the game - virtual void shutdown() = 0; + /// return the local player + inline Player *localplayer() { return &local_player; } + +/*----- virtual inspectors --------------------------------------- */ - /// is called when a player connects - virtual void player_connect(Player *player) = 0; + /// returns true if the game server can run a time frime + virtual bool running() = 0; - /// is called when a player disconnects - virtual void player_disconnect(Player *player) = 0; +/*----- mutators ------------------------------------------------- */ - static GameInterface *gameinterface_instance; + /// clear all game variables, game functions and entities + void clear(); - /// the name of the game - std::string const & name(); +/*----- virtual mutators ------------------------------------------ */ + + /// run one game time frame + /// @param sec time since the previous frame, in seconds + virtual void frame(float seconds) = 0; -private: - std::string game_name; +protected: + Player local_player; }; -/// pointer to the current GameInterface -GameInterface *game(); - } #endif // __INCLUDED_CORE_GAMEINTERFACE_H__ |