Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-18 17:52:15 +0000
committerStijn Buys <ingar@osirion.org>2008-02-18 17:52:15 +0000
commit0b8582a9aa825024edbd0a21c6287bfcccec28de (patch)
tree2d9a46c60b028300b1b9133b84764b6c39964c33 /src/core/gameinterface.h
parent982562fa19bb87a3dab352e562f386f61c171b7b (diff)
core redesign, part II
Diffstat (limited to 'src/core/gameinterface.h')
-rw-r--r--src/core/gameinterface.h52
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__