From fd7a0735c9aeaa7978190049319e3cdfe48920a4 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 10 Apr 2011 04:15:10 +0300 Subject: new object system --- src/clientobject.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/clientobject.h') diff --git a/src/clientobject.h b/src/clientobject.h index ebdcb948e..50fae67c2 100644 --- a/src/clientobject.h +++ b/src/clientobject.h @@ -35,6 +35,8 @@ Some planning */ +class ClientEnvironment; + class ClientActiveObject : public ActiveObject { public: @@ -51,11 +53,13 @@ public: virtual v3f getPosition(){return v3f(0,0,0);} // Step object in time - virtual void step(float dtime){} + virtual void step(float dtime, ClientEnvironment *env){} // Process a message sent by the server side object virtual void processMessage(const std::string &data){} + virtual std::string infoText() {return "";} + /* This takes the return value of ServerActiveObject::getClientInitializationData @@ -66,9 +70,11 @@ public: static ClientActiveObject* create(u8 type); protected: + // Used for creating objects based on type typedef ClientActiveObject* (*Factory)(); static void registerType(u16 type, Factory f); private: + // Used for creating objects based on type static core::map m_types; }; @@ -112,7 +118,7 @@ public: v3s16 getLightPosition(); void updateNodePos(); - void step(float dtime); + void step(float dtime, ClientEnvironment *env); void processMessage(const std::string &data); @@ -144,7 +150,7 @@ public: v3s16 getLightPosition(); void updateNodePos(); - void step(float dtime); + void step(float dtime, ClientEnvironment *env); void processMessage(const std::string &data); -- cgit v1.2.3