Pol  Revision:cb584c9
armor.h
Go to the documentation of this file.
1 
7 #ifndef ARMOR_H
8 #define ARMOR_H
9 
10 #include <iosfwd>
11 #include <set>
12 #include <string>
13 
14 #include "../../bscript/bobject.h"
15 #include "../../clib/compilerspecifics.h"
16 #include "../../clib/rawtypes.h"
17 #include "../dynproperties.h"
18 #include "../scrdef.h"
19 #include "equipmnt.h"
20 
21 namespace Pol
22 {
23 namespace Bscript
24 {
25 class String;
26 class BStruct;
27 }
28 namespace Clib
29 {
30 class StreamWriter;
31 class ConfigElem;
32 }
33 namespace Plib
34 {
35 class Package;
36 }
37 }
38 #define ARMOR_TMPL ( static_cast<const ArmorDesc*>( tmpl ) )
39 
40 namespace Pol
41 {
42 namespace Items
43 {
44 class ArmorDesc;
45 class Item;
46 
47 class UArmor : public Equipment
48 {
49  typedef Equipment base;
50 
51 public:
52  virtual ~UArmor(){};
53  virtual unsigned short ar() const;
54  virtual unsigned short ar_base() const;
55  virtual bool covers( unsigned short zlayer ) const;
56  virtual Item* clone() const POL_OVERRIDE;
57  virtual size_t estimatedSize() const POL_OVERRIDE;
58 
59  void set_onhitscript( const std::string& scriptname );
60  std::set<unsigned short> tmplzones();
61 
62  DYN_PROPERTY( ar_mod, s16, Core::PROP_AR_MOD, 0 );
63 
64 protected:
65  virtual void printProperties( Clib::StreamWriter& sw ) const POL_OVERRIDE;
66  virtual void readProperties( Clib::ConfigElem& elem ) POL_OVERRIDE;
67  virtual Bscript::BObjectImp* get_script_member( const char* membername ) const POL_OVERRIDE;
68  virtual Bscript::BObjectImp* get_script_member_id( const int id ) const POL_OVERRIDE;
69 
70  virtual Bscript::BObjectImp* set_script_member( const char* membername,
71  const std::string& value ) POL_OVERRIDE;
72  virtual Bscript::BObjectImp* set_script_member( const char* membername, int value ) POL_OVERRIDE;
73  virtual Bscript::BObjectImp* set_script_member_id( const int id, const std::string& value )
74  POL_OVERRIDE; // id test
75  virtual Bscript::BObjectImp* set_script_member_id( const int id,
76  int value ) POL_OVERRIDE; // id test
77  virtual bool script_isa( unsigned isatype ) const POL_OVERRIDE;
78 
79  UArmor( const ArmorDesc& descriptor, const ArmorDesc* permanent_descriptor );
80  friend class Item;
81  // friend void load_data();
82  friend void load_weapon_templates();
83  friend UArmor* create_intrinsic_shield( const char* name, Clib::ConfigElem& elem,
84  const Plib::Package* pkg );
85 
86  const ArmorDesc& descriptor() const;
87  const Core::ScriptDef& onhitscript() const;
88 
89 private:
91 };
92 
95 
98  const Plib::Package* pkg );
99 }
100 }
101 #endif
UArmor * create_intrinsic_shield(const char *name, Clib::ConfigElem &elem, const Plib::Package *pkg)
Creates a new intrinsic shield and returns it.
Definition: armor.cpp:219
#define POL_OVERRIDE
void load_armor_templates()
signed short s16
Definition: rawtypes.h:30
UArmor * create_intrinsic_shield_from_npctemplate(Clib::ConfigElem &elem, const Plib::Package *pkg)
Creates a new intrinic shield for an NPC template and returns it.
Definition: armor.cpp:237
Core::ScriptDef onhitscript_
Definition: armor.h:90
#define DYN_PROPERTY(name, type, id, defaultvalue)
Definition: dynproperties.h:62
std::string name
Definition: osmod.cpp:943
void unload_armor_templates()
virtual ~UArmor()
Definition: armor.h:52
Equipment base
Definition: armor.h:49
Definition: berror.cpp:12
void validate_intrinsic_shield_template()
Must be called at startup, validates the intrinsic shield element.
Definition: armor.cpp:202