… | |
… | |
230 | * start with equipment, but only their abilities). |
230 | * start with equipment, but only their abilities). |
231 | */ |
231 | */ |
232 | static void |
232 | static void |
233 | put_treasure (object *op, object *creator, int flags) |
233 | put_treasure (object *op, object *creator, int flags) |
234 | { |
234 | { |
235 | object *tmp; |
|
|
236 | |
|
|
237 | /* Bit of a hack - spells should never be put onto the map. The entire |
235 | /* Bit of a hack - spells should never be put onto the map. The entire |
238 | * treasure stuff is a problem - there is no clear idea of knowing |
236 | * treasure stuff is a problem - there is no clear idea of knowing |
239 | * this is the original object, or if this is an object that should be created |
237 | * this is the original object, or if this is an object that should be created |
240 | * by another object. |
238 | * by another object. |
241 | */ |
239 | */ |
242 | if (flags & GT_ENVIRONMENT && op->type != SPELL) |
240 | if (flags & GT_ENVIRONMENT && op->type != SPELL) |
243 | { |
241 | { |
|
|
242 | if (ob_blocked (op, creator->map, creator->x, creator->y)) |
|
|
243 | op->destroy (); |
|
|
244 | else |
|
|
245 | { |
244 | SET_FLAG (op, FLAG_OBJ_ORIGINAL); |
246 | SET_FLAG (op, FLAG_OBJ_ORIGINAL); |
245 | op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); |
247 | op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); |
|
|
248 | } |
246 | } |
249 | } |
247 | else |
250 | else |
248 | { |
251 | { |
249 | op = creator->insert (op); |
252 | op = creator->insert (op); |
250 | |
253 | |
251 | if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) |
254 | if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) |
252 | monster_check_apply (creator, op); |
255 | monster_check_apply (creator, op); |
253 | |
256 | |
254 | if ((flags & GT_UPDATE_INV) && (tmp = creator->in_player ())) |
257 | if (flags & GT_UPDATE_INV) |
|
|
258 | if (object *tmp = creator->in_player ()) |
255 | esrv_send_item (tmp, op); |
259 | esrv_send_item (tmp, op); |
256 | } |
260 | } |
257 | } |
261 | } |
258 | |
262 | |
259 | /* if there are change_xxx commands in the treasure, we include the changes |
263 | /* if there are change_xxx commands in the treasure, we include the changes |
260 | * in the generated object |
264 | * in the generated object |