ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/map.h
(Generate patch)

Comparing deliantra/server/include/map.h (file contents):
Revision 1.96 by root, Mon Jul 14 16:42:49 2008 UTC vs.
Revision 1.98 by root, Sun Aug 17 22:46:26 2008 UTC

110 * particular space (was map, floor, floor2, map_ob), 110 * particular space (was map, floor, floor2, map_ob),
111 * have this structure take care of that information. 111 * have this structure take care of that information.
112 * This puts it all in one place, and should also make it easier 112 * This puts it all in one place, and should also make it easier
113 * to extend information about a space. 113 * to extend information about a space.
114 */ 114 */
115INTERFACE_CLASS (mapspace)
115struct mapspace 116struct mapspace
116{ 117{
118 object *ACC (RW, bot);
117 object *bot, *top; /* lowest/highest object on this space */ 119 object *ACC (RW, top); /* lowest/highest object on this space */
118 object *faces_obj[MAP_LAYERS];/* face objects for the 3 layers */ 120 object *ACC (RW, faces_obj[MAP_LAYERS]);/* face objects for the 3 layers */
119 uint8 flags_; /* flags about this space (see the P_ values above) */ 121 uint8 flags_; /* flags about this space (see the P_ values above) */
120 sint8 light; /* How much light this space provides */ 122 sint8 ACC (RW, light); /* How much light this space provides */
121 MoveType move_block; /* What movement types this space blocks */ 123 MoveType ACC (RW, move_block); /* What movement types this space blocks */
122 MoveType move_slow; /* What movement types this space slows */ 124 MoveType ACC (RW, move_slow); /* What movement types this space slows */
123 MoveType move_on; /* What movement types are activated */ 125 MoveType ACC (RW, move_on); /* What movement types are activated */
124 MoveType move_off; /* What movement types are activated */ 126 MoveType ACC (RW, move_off); /* What movement types are activated */
125 127
126 void update_ (); 128 void update_ ();
127 void update () 129 MTH void update ()
128 { 130 {
129 if (!(flags_ & P_UPTODATE)) 131 if (!(flags_ & P_UPTODATE))
130 update_ (); 132 update_ ();
131 } 133 }
132 134
133 uint8 flags () 135 MTH uint8 flags ()
134 { 136 {
135 update (); 137 update ();
136 return flags_; 138 return flags_;
137 } 139 }
138 140
139 // maybe only inline quick flags_ checking?
140 object *player () 141 MTH object *player ()
141 { 142 {
142 // search from the top, because players are usually on top 143 object *op;
143 // make usually == always and this non-amortized O(1) 144
144 // could gte rid of P_PLAYER, too, then
145 if (flags () & P_PLAYER) 145 if (flags () & P_PLAYER)
146 for (object *op = top; op; op = op->below) 146 for (op = top; op->type != PLAYER; op = op->below)
147 if (op->type == PLAYER) 147 ;
148 return op; 148 else
149 op = 0;
149 150
150 return 0; 151 return op;
151 } 152 }
152 153
153 // return the item volume on this mapspace in cm³ 154 // return the item volume on this mapspace in cm³
154 uint64 volume () const; 155 MTH uint64 volume () const;
155 156
156 bool blocks (MoveType mt) const 157 bool blocks (MoveType mt) const
157 { 158 {
158 return move_block && (mt & move_block) == mt; 159 return move_block && (mt & move_block) == mt;
159 } 160 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines