Pol  Revision:3cfda13
multi.h
Go to the documentation of this file.
1 
9 #ifndef MULTI_H
10 #define MULTI_H
11 
12 #include "../udatfile.h"
13 
14 // also consider: multimap<unsigned int, unsigned int>
15 // unsigned int is (x << 16) | y
16 // unsigned int is z << 16 | objtype
17 // hell, even multimap<unsigned short,unsigned int>
18 // unsigned short is (x<<8)|y
19 // (relative signed x/y, -128 to +127
20 // unsigned int is z << 16 | objtype
21 
22 #ifndef ITEM_H
23 #include "../item/item.h"
24 #endif
25 
26 namespace Pol
27 {
28 namespace Bscript
29 {
30 class BObjectImp;
31 class BStruct;
32 }
33 namespace Plib
34 {
35 class MapShapeList;
36 }
37 namespace Realms
38 {
39 class Realm;
40 }
41 namespace Multi
42 {
43 class MultiDef;
44 
45 const int CRMULTI_IGNORE_MULTIS = 0x0001;
46 const int CRMULTI_IGNORE_OBJECTS = 0x0002;
47 const int CRMULTI_IGNORE_FLATNESS = 0x0004;
48 const int CRMULTI_FACING_NORTH = 0x0000;
49 const int CRMULTI_FACING_EAST = 0x0100;
50 const int CRMULTI_FACING_SOUTH = 0x0200;
51 const int CRMULTI_FACING_WEST = 0x0300;
52 const int CRMULTI_FACING_MASK = 0x0300;
53 const int CRMULTI_FACING_SHIFT = 8;
54 
55 class UMulti : public Items::Item
56 {
57  typedef Items::Item base;
58 
59 public:
61 
62  static UMulti* create( const Items::ItemDesc& descriptor, u32 serial = 0 );
63 
64  static Bscript::BObjectImp* scripted_create( const Items::ItemDesc& descriptor, u16 x, u16 y,
65  s8 z, Realms::Realm* realm, int flags );
66 
67  virtual void double_click( Network::Client* client ) POL_OVERRIDE;
68  virtual void register_object( UObject* obj );
69  virtual void unregister_object( UObject* obj );
70  virtual bool script_isa( unsigned isatype ) const POL_OVERRIDE;
71 
72  const MultiDef& multidef() const;
73  virtual class UBoat* as_boat();
74  virtual class UHouse* as_house();
75  virtual Bscript::BObjectImp* make_ref() POL_OVERRIDE;
76  virtual Bscript::BObjectImp* get_script_member( const char* membername ) const POL_OVERRIDE;
77  virtual Bscript::BObjectImp* get_script_member_id( const int id ) const POL_OVERRIDE;
78 
79  Bscript::BStruct* footprint() const;
80  virtual bool readshapes( Plib::MapShapeList& vec, s16 rx, s16 ry, s16 zbase );
81  virtual bool readobjects( Core::StaticList& vec, s16 rx, s16 ry, s16 zbase );
82 
83  virtual ~UMulti();
84  virtual size_t estimatedSize() const POL_OVERRIDE;
85 
86 protected:
87  explicit UMulti( const Items::ItemDesc& itemdesc );
88 
89  virtual const char* classname() const POL_OVERRIDE;
90  friend class ref_ptr<UMulti>;
91 
92 private:
93  // virtual void destroy(void);
94 };
95 
96 /* Default implementations */
97 inline bool UMulti::readshapes( Plib::MapShapeList& /*vec*/, s16 /*rx*/, s16 /*ry*/, s16 /*zbase*/ )
98 {
99  return false;
100 };
101 inline bool UMulti::readobjects( Core::StaticList& /*vec*/, s16 /*rx*/, s16 /*ry*/, s16 /*zbase*/ )
102 {
103  return false;
104 };
105 }
106 namespace Core
107 {
108 void send_multi( Network::Client* client, const Multi::UMulti* multi );
109 void send_multi_to_inrange( const Multi::UMulti* multi );
110 }
111 }
112 #endif
#define POL_OVERRIDE
void send_multi(Network::Client *client, const Multi::UMulti *multi)
Definition: ufunc.cpp:1652
const int CRMULTI_IGNORE_OBJECTS
Definition: multi.h:46
std::vector< StaticRec > StaticList
Definition: udatfile.h:38
const int CRMULTI_FACING_EAST
Definition: multi.h:49
const int CRMULTI_FACING_MASK
Definition: multi.h:52
const int CRMULTI_IGNORE_MULTIS
Definition: multi.h:45
void send_multi_to_inrange(const Multi::UMulti *multi)
Definition: ufunc.cpp:1659
const int CRMULTI_FACING_WEST
Definition: multi.h:51
const int CRMULTI_FACING_SOUTH
Definition: multi.h:50
unsigned short u16
Definition: rawtypes.h:26
unsigned int u32
Definition: rawtypes.h:27
signed short s16
Definition: rawtypes.h:30
Definition: refptr.h:64
const int CRMULTI_IGNORE_FLATNESS
Definition: multi.h:47
signed char s8
Definition: rawtypes.h:29
const int CRMULTI_FACING_SHIFT
Definition: multi.h:53
Items::Item base
Definition: multi.h:57
const int CRMULTI_FACING_NORTH
Definition: multi.h:48
Definition: berror.cpp:12