diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-13 18:29:55 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-13 18:29:55 +0000 |
commit | ee891311ccc79bbc7837caac8546aac5b9bdf80f (patch) | |
tree | 4279b0bec63d2152669b19d1f11199c56ae57b7b /src/core/func.h | |
parent | a65427370dfe27dfa74efb0bddd44d7ffb9552ac (diff) |
camera Overview as spectator only, join works
Diffstat (limited to 'src/core/func.h')
-rw-r--r-- | src/core/func.h | 34 |
1 files changed, 31 insertions, 3 deletions
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 <sstream> #include <string> @@ -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); |