3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
8 * See LICENSING which should be included
9 * along with this file for more details
15 #include "ivancommon.h"
31 typedef room
* (*roomspawner
)();
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
; }
52 typedef roomprototype prototype
;
55 room() : LastMasterSearchTick(0), MasterID(0), LastWardSearchTick(0), RoomScript(0) {}
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
; }
107 mutable character
* Master
;
108 mutable feuLong LastMasterSearchTick
;
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);
125 #define ROOM_PROTO(name)
128 #define ROOM(name, base)\
130 typedef simplesysbase<name, base, roomprototype> name##sysbase;\
132 class name : public name##sysbase