#ifndef TELEOB_H #define TELEOB_H #include "MudObject.h" //! a possibly tele-present object. contains the object itself, its position, and its index. class TeleObject : public common { public: MudObject *what; int nth; MudObject *where; bool operator!() const { return !what; } MudObject *operator->() { return what; } const MudObject *operator->() const { return what; } MudObject *operator*() { return what; } const MudObject *operator*() const { return what; } bool operator==(const TeleObject &ob) const { if (what != ob.what) return 0; if (nth != ob.nth) return 0; if (where != ob.where) return 0; return 1; } bool operator<(const TeleObject &ob) const { if (strcmp(what->id, ob.what->id)<0) return 1; if (nth < ob.nth) return 1; return 0; } operator MudObject *() { return what; } TeleObject(const TeleObject &c) : what(c.what), nth(c.nth), where(c.where) { } TeleObject(MudObject *wh, MudObject *ob, int nn): what(ob), nth(nn), where(wh) { } TeleObject(MudObject *real) { if (!real) { what = where = 0; nth = 0; return; } what = real; if (real) where = real->owner; else where = 0; nth = 0; } TeleObject() { what = 0; where = 0; nth = 0; } virtual ~TeleObject() { } }; #endif