typos
[k8-i-v-a-n.git] / src / game / room.h
blobaeb88562156584ae622933c62885ade35e725a6f
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __ROOM_H__
13 #define __ROOM_H__
15 #include "ivancommon.h"
17 #include "v2.h"
20 class room;
21 class item;
22 class olterrain;
23 class lsquare;
24 class festring;
25 class outputfile;
26 class inputfile;
27 class character;
28 class roomscript;
31 typedef room* (*roomspawner)();
33 class roomprototype
35 public:
36 roomprototype(roomspawner, cchar*);
37 virtual ~roomprototype () {}
39 room* Spawn() const { return Spawner(); }
40 room* SpawnAndLoad(inputfile&) const;
41 cchar* GetClassID() const { return ClassID; }
42 int GetIndex() const { return Index; }
43 private:
44 int Index;
45 roomspawner Spawner;
46 cchar* ClassID;
49 class room
51 public:
52 typedef roomprototype prototype;
54 public:
55 room() : LastMasterSearchTick(0), MasterID(0), LastWardSearchTick(0), RoomScript(0) {}
56 virtual ~room() {}
58 virtual void Save(outputfile&) const;
59 virtual void Load(inputfile&);
60 virtual void Enter(character*) { }
61 v2 GetPos() const { return Pos; }
62 void SetPos(v2 What) { Pos = What; }
63 v2 GetSize() const { return Size; }
64 void SetSize(v2 What) { Size = What; }
65 void SetIndex(int What) { Index = What; }
66 int GetIndex() const { return Index; }
67 character* GetMaster() const;
68 void SetMasterID(feuLong What) { MasterID = What; }
69 virtual truth PickupItem(character*, item*, int) { return true; }
70 virtual truth DropItem(character*, item*, int) { return true; }
71 int GetDivineMaster() const { return DivineMaster; }
72 void SetDivineMaster(int What) { DivineMaster = What; }
73 virtual void KickSquare(character*, lsquare*) { }
74 virtual truth ConsumeItem(character*, item*, int) { return true; }
75 virtual truth AllowDropGifts() const { return true; }
76 virtual truth Drink(character*) const { return true; }
77 virtual truth HasDrinkHandler() const { return false; }
78 virtual truth Dip(character*) const { return true; }
79 virtual truth HasDipHandler() const { return false; }
80 virtual void TeleportSquare(character*, lsquare*) { }
81 virtual const prototype* GetProtoType() const = 0;
82 int GetType() const { return GetProtoType()->GetIndex(); }
83 virtual void DestroyTerrain(character*);
84 virtual truth AllowSpoil(citem*) const { return true; }
85 virtual truth CheckDestroyTerrain(character*);
86 virtual int GetGodRelationAdjustment() const { return -50; }
87 virtual truth AllowKick(ccharacter*, const lsquare*) const { return true; }
88 truth MasterIsActive() const;
89 truth CheckKickSquare(ccharacter*, const lsquare*) const;
90 virtual void HostileAction(character*) const { }
91 virtual truth AllowAltarPolymorph() const { return true; }
92 virtual truth AllowFoodSearch() const { return true; }
93 virtual void ReceiveVomit(character*) { }
94 virtual truth IsOKToDestroyWalls(ccharacter*) const;
95 virtual void AddItemEffect(item*) { };
96 void FinalProcessForBone();
97 void SetFlags(feuLong What) { Flags = What; }
98 truth DontGenerateMonsters() const { return Flags & NO_MONSTER_GENERATION; }
99 olterrain* GetWard() const;
100 truth WardIsActive() const;
101 virtual truth IsOKToTeleportInto() const;
103 inline const roomscript *GetScript () const { return RoomScript; }
104 inline void SetScript (const roomscript *s) { RoomScript = s; }
106 protected:
107 mutable character* Master;
108 mutable feuLong LastMasterSearchTick;
109 v2 Pos;
110 v2 Size;
111 feuLong MasterID;
112 int Index;
113 int DivineMaster;
114 feuLong Flags;
115 mutable olterrain* Ward;
116 mutable feuLong LastWardSearchTick;
117 const roomscript *RoomScript;
120 #ifdef __FILE_OF_STATIC_ROOM_PROTOTYPE_DEFINITIONS__
121 #define ROOM_PROTO(name)\
122 template<> const roomprototype\
123 name##sysbase::ProtoType((roomspawner)(&name##sysbase::Spawn), #name);
124 #else
125 #define ROOM_PROTO(name)
126 #endif
128 #define ROOM(name, base)\
129 class name;\
130 typedef simplesysbase<name, base, roomprototype> name##sysbase;\
131 ROOM_PROTO(name)\
132 class name : public name##sysbase
134 #endif