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-11-01 13:33:18 +0000
committerStijn Buys <ingar@osirion.org>2008-11-01 13:33:18 +0000
commit83d6c17799c4d448a67ab5cdad02954282fa5c94 (patch)
tree2d76abb9bb501491f78e07822ed52e8302fdd247 /src/core/func.h
parenta6bceed80f1b4315f23656efeceb6fe02cc7641c (diff)
server-side model loading, initial @dock function
Diffstat (limited to 'src/core/func.h')
-rw-r--r--src/core/func.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/core/func.h b/src/core/func.h
index 7c5635f..eacd47e 100644
--- a/src/core/func.h
+++ b/src/core/func.h
@@ -8,6 +8,7 @@
#define __INCLUDED_CORE_FUNC_H__
#include "core/player.h"
+#include "core/entity.h"
#include <sstream>
#include <string>
@@ -22,12 +23,15 @@ typedef void(* FuncPtr)(std::string const &args);
/// fuction pointer for game functions
typedef void(* GameFuncPtr)(Player *player, std::string const &args);
+/// fuction pointer for target functions
+typedef void(* TargetFuncPtr)(Player *player, Entity *entity);
+
/// a function pointer encapsulation class
class Func
{
public:
/// function flags
- enum Flags {Game=1, Shared=2};
+ enum Flags {Game=1, Shared=2, Target=4};
/// create a new function
Func(char const * name, void *ptr, unsigned int flags = 0);
@@ -56,16 +60,22 @@ public:
/// execute the function if the Game flag is set
void exec(Player *player, std::string const &args);
+ /// execute the function if the Target flag is set
+ void exec(Player *player, Entity *entity);
+
/* ---- Static functions for the Func registry -------------------- */
/// type definition
typedef std::map<std::string, Func*> Registry;
/// add a function to the registry
- static Func *add(const char *name, FuncPtr functionptr, unsigned int flags=0);
+ static Func *add(const char *name, FuncPtr functionptr, bool shared=false);
/// add a game function to the registry and set the Game flag
- static Func *add(const char *name, GameFuncPtr functionptr, unsigned int flags=0);
+ static Func *add(const char *name, GameFuncPtr functionptr);
+
+ /// add a target function to the registry and set Game and Target flag
+ static Func *add(const char *name, TargetFuncPtr targetfunctionptr);
/// remove a function from the registry
static void remove(const char *name);