… | |
… | |
83 | /* These are used in the MapLook flags element. They are not used in |
83 | /* These are used in the MapLook flags element. They are not used in |
84 | * in the object flags structure. |
84 | * in the object flags structure. |
85 | */ |
85 | */ |
86 | #define P_BLOCKSVIEW 0x01 |
86 | #define P_BLOCKSVIEW 0x01 |
87 | #define P_NO_MAGIC 0x02 /* Spells (some) can't pass this object */ |
87 | #define P_NO_MAGIC 0x02 /* Spells (some) can't pass this object */ |
88 | //#define P_PLAYER 0x04 /* a player (or something seeing these objects) is on this mapspace */ |
88 | #define P_PLAYER 0x04 /* a player (or something seeing these objects) is on this mapspace */ |
89 | #define P_SAFE 0x08 /* If this is set the map tile is a safe space, |
89 | #define P_SAFE 0x08 /* If this is set the map tile is a safe space, |
90 | * that means, nothing harmful can be done, |
90 | * that means, nothing harmful can be done, |
91 | * such as: bombs, potion usage, alchemy, spells |
91 | * such as: bombs, potion usage, alchemy, spells |
92 | * this was introduced to make shops safer |
92 | * this was introduced to make shops safer |
93 | * but is useful in other situations */ |
93 | * but is useful in other situations */ |
… | |
… | |
138 | return flags_; |
138 | return flags_; |
139 | } |
139 | } |
140 | |
140 | |
141 | MTH object *player () |
141 | MTH object *player () |
142 | { |
142 | { |
143 | // this assumes that players are always on top |
143 | object *op; |
144 | return top && top->type == PLAYER ? top : 0; |
144 | |
|
|
145 | if (flags () & P_PLAYER) |
|
|
146 | for (op = top; op->type != PLAYER; op = op->below) |
|
|
147 | ; |
|
|
148 | else |
|
|
149 | op = 0; |
|
|
150 | |
|
|
151 | return op; |
145 | } |
152 | } |
146 | |
153 | |
147 | // return the item volume on this mapspace in cm³ |
154 | // return the item volume on this mapspace in cm³ |
148 | MTH uint64 volume () const; |
155 | MTH uint64 volume () const; |
149 | |
156 | |