From ee891311ccc79bbc7837caac8546aac5b9bdf80f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 13 Feb 2008 18:29:55 +0000 Subject: camera Overview as spectator only, join works --- src/core/func.h | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/core/func.h') diff --git a/src/core/func.h b/src/core/func.h index ae158b5..d98e954 100644 --- a/src/core/func.h +++ b/src/core/func.h @@ -8,6 +8,7 @@ #define __INCLUDED_CORE_FUNC_H__ #include "sys/sys.h" +#include "core/player.h" #include #include @@ -16,14 +17,41 @@ namespace core { -/// function pointer type -typedef void(* Func)(std::stringstream &args); +class Func_t +{ +public: + /// pointer to the function + void *ptr; + /// name of the function + std::string name; + /// flags + unsigned int flags; +}; + +/// function type +typedef Func_t *Func; + +/// function pointer type for local functions +typedef void(* FuncPtr)(std::stringstream &args); + +/// fuction pointer for game functions +typedef void(* GameFuncPtr)(Player &player, std::stringstream &args); /// the function registry namespace func { + +/// function flags +enum Flags {Game=1}; + /// add a function to the registry -void add(const char *functionname, Func functionptr); +void add(const char *functionname, FuncPtr functionptr, unsigned int flags=0); + +/** + * @brief add a game function to the registry + * the flag core::func::Game will automaticly be set + */ +void add(const char *functionname, GameFuncPtr gamefunctionptr, unsigned int flags=0); /// remove a function from the registry void remove(const char *functionname); -- cgit v1.2.3