1 /* 2 This file is part of "Avanor, the Land of Mystery" roguelike game 3 Home page: http://www.avanor.com/ 4 Copyright (C) 2000-2003 Vadim Gaidukevich 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21 #ifndef __XMAPOBJECT_H 22 #define __XMAPOBJECT_H 23 24 #include "xobject.h" 25 #include "location.h" 26 27 class XCreature; 28 class XLocation; 29 30 class XMapObject : public XObject 31 { 32 public: 33 XPtr<XLocation> l; 34 char name[50]; 35 36 DECLARE_CREATOR(XMapObject, XObject); 37 XMapObject(); 38 XMapObject(XMapObject * copy); MakeCopy()39 virtual XObject * MakeCopy() { return new XMapObject(this); } 40 virtual void Invalidate(); 41 42 int x, y; //co-ordinates of any object 43 int nx, ny; //used for new turn; 44 45 char view; //char-represent view of object 46 int color; 47 48 49 virtual int Compare(XObject * o); 50 51 52 virtual void Store(XFile * f); 53 virtual void Restore(XFile * f); toString(char * buf)54 virtual void toString(char * buf){}; 55 56 bool SetLocation(XLocation * new_l); 57 isVisible()58 virtual bool isVisible() { return l->map->GetVisible(x, y); } onOuterUse(XCreature * user)59 virtual int onOuterUse(XCreature * user) { return 0; } 60 GetName(XCreature * viewer)61 virtual const char * GetName(XCreature * viewer) { return name; } 62 isInVisibleArea()63 int isInVisibleArea() { return l->map->GetVisible(x, y); } //check if object is in visible are to write Someone hits your etc. isVisibleArea(int x,int y)64 int isVisibleArea(int x, int y) { return l->map->GetVisible(x, y); } //cheks, if this area is visible 65 Pick(XCreature * picker)66 virtual XObject * Pick(XCreature * picker) { return NULL; } //some objects (eg. Herbs) can be picked up. 67 68 }; 69 #endif 70