moved almost all hardcoded constants to "define.dat"
[k8-i-v-a-n.git] / src / game / lock.h
blobe542c0de8b358862f42fff93bccfb6ee53a612b0
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 __LOCK_H__
13 #define __LOCK_H__
15 #include "ivancommon.h"
18 template <class base, class lockbase>
19 class lockable : public base, public lockbase
21 public:
22 typedef typename lockbase::prototype prototype;
24 virtual ~lockable () {}
26 virtual void Save(outputfile&) const;
27 virtual void Load(inputfile&);
28 virtual truth IsOpenable(ccharacter*) const { return true; }
29 virtual truth HasLock(ccharacter*) const { return true; }
30 virtual truth IsLocked() const { return lockbase::Locked; }
31 virtual void SetIsLocked(truth What) { lockbase::Locked = What; }
32 virtual void Lock() { lockbase::Locked = true; }
33 virtual int GetVirtualConfig() const { return base::GetConfig(); }
34 virtual void SetVirtualConfig(int What, int F = 0) { base::SetConfig(What, F); }
35 virtual const prototype* GetVirtualProtoType() const { return base::GetProtoType(); }
36 virtual festring GetVirtualDescription(int Case) const { return base::GetDescription(Case); }
37 virtual truth TryKey(item* K, character* C) { return lockbase::TryKey(K, C); }
38 protected:
39 virtual void PostConstruct();
42 template <class base, class lockbase>
43 inline void lockable<base, lockbase>::Save(outputfile& SaveFile) const
45 base::Save(SaveFile);
46 lockbase::Save(SaveFile);
49 template <class base, class lockbase>
50 inline void lockable<base, lockbase>::Load(inputfile& SaveFile)
52 base::Load(SaveFile);
53 lockbase::Load(SaveFile);
56 template <class base, class lockbase>
57 inline void lockable<base, lockbase>::PostConstruct()
59 lockbase::PostConstruct();
60 base::PostConstruct();
63 #endif