Pol  Revision:f37d500
equipmnt.h
Go to the documentation of this file.
1 
7 #ifndef EQUIPMNT_H
8 #define EQUIPMNT_H
9 
10 #include <iosfwd>
11 #include <string>
12 
13 #include "../../bscript/bobject.h"
14 #include "../../clib/compilerspecifics.h"
15 #include "../../clib/rawtypes.h"
16 #include "../baseobject.h"
17 
18 namespace Pol
19 {
20 namespace Clib
21 {
22 class StreamWriter;
23 } // namespace Clib
24 namespace Items
25 {
26 class ItemDesc;
27 } // namespace Items
28 } // namespace Pol
29 
30 #ifndef ITEM_H
31 #include "item.h"
32 #endif
33 
34 namespace Pol
35 {
36 namespace Bscript
37 {
38 class BObjectImp;
39 }
40 namespace Clib
41 {
42 class ConfigElem;
43 }
44 namespace Core
45 {
46 class EquipDesc;
47 }
48 namespace Items
49 {
50 class Equipment : public Item
51 {
52  typedef Item base;
53 
54 public:
55  virtual ~Equipment();
56  void reduce_hp_from_hit();
57  bool is_intrinsic() const;
58 
59  virtual double getQuality() const POL_OVERRIDE;
60  virtual void setQuality( double value ) POL_OVERRIDE;
61 
62 protected:
63  Equipment( const ItemDesc& itemdesc, Core::UOBJ_CLASS uobj_class,
64  const Core::EquipDesc* permanent_descriptor );
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  // virtual Bscript::BObjectImp* set_script_member( const char *membername, const std::string&
70  // value );
71  virtual Bscript::BObjectImp* set_script_member( const char* membername, int value ) POL_OVERRIDE;
72  virtual Bscript::BObjectImp* set_script_member_double( const char* membername,
73  double value ) POL_OVERRIDE;
74  virtual Bscript::BObjectImp* set_script_member_id( const int id,
75  int value ) POL_OVERRIDE; // id test
76  virtual Bscript::BObjectImp* set_script_member_id_double( const int id,
77  double value ) POL_OVERRIDE; // id test
78 
79  virtual bool script_isa( unsigned isatype ) const POL_OVERRIDE;
80  virtual Item* clone() const POL_OVERRIDE;
81 
82  virtual size_t estimatedSize() const POL_OVERRIDE;
83 
84  const Core::EquipDesc* tmpl;
85 
86 private:
87  double _quality;
88 };
89 
90 Equipment* find_intrinsic_equipment( const std::string& name, u8 type );
91 void register_intrinsic_equipment( const std::string& name, Equipment* equip );
92 void insert_intrinsic_equipment( const std::string& name, Equipment* equip );
95 }
96 }
97 #endif
unsigned char u8
Definition: rawtypes.h:25
#define POL_OVERRIDE
void register_intrinsic_equipment(const std::string &name, Equipment *equip)
Must be called when a new intrinsic equipment is created.
Definition: equipmnt.cpp:137
STL namespace.
void load_npc_intrinsic_equip()
Recreates intrinsic equipment for defined NPCs must be called at startup.
Definition: equipmnt.cpp:181
void insert_intrinsic_equipment(const std::string &name, Equipment *equip)
Adds a new intrisinc equipment to the map of known ones.
Definition: equipmnt.cpp:154
void allocate_intrinsic_equipment_serials()
Deferred allocator for serials during startup, see comments in register_intrinsic_equipment() ...
Definition: equipmnt.cpp:167
std::string name
Definition: osmod.cpp:943
Definition: berror.cpp:12
Equipment * find_intrinsic_equipment(const std::string &name, u8 layer)
Looks up for an existing intrinsic equipment and return it or NULL if not found.
Definition: equipmnt.cpp:128