/* * Copyright (c) 2002, Stefan Farfeleder * $Id: object_s.h,v 1.3 2002/09/19 10:42:02 stefan Exp $ */ #ifndef JFK_OBJECT_S_H #define JFK_OBJECT_S_H #include #include "object.h" namespace JFK { namespace server { class bullet; class explosion; class item; class obstacle; class person; class weapon; class object : public virtual JFK::object { public: object(); object(const object&); /* create a new object with the same content */ virtual object* clone() const = 0; /* copy the content of 'o' in this object */ virtual void assign(const object* o) = 0; /* only write those attributes to a string that differ from 'oldobj's * ones */ virtual std::string diffstring(const object* oldobj) const = 0; /* give the object an possibility to create another object */ virtual object* action(double t) = 0; /* call the right collide_with_* method on obj */ virtual void delegate_collision(object* obj) const = 0; /* Per default nothing is done. Each class can override some of these * functions. */ virtual void collide_with_bullet(const bullet*) {}; virtual void collide_with_explosion(const explosion*) {}; virtual void collide_with_item(const item*) {}; virtual void collide_with_obstacle(const obstacle*) {}; virtual void collide_with_person(const person*) {}; virtual void collide_with_weapon(const weapon*) {}; bool update; /* if true clients need to be informed about changes on this object */ bool suicide; /* this object wants to be destroyed */ int refcnt; /* number of pointers to this object */ int reappear; /* time to reappear after death (if > 0) */ }; } } #endif