… | |
… | |
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 | op->deactivate_recursive (); |
|
|
243 | op->expand_tail (); |
|
|
244 | |
|
|
245 | if (ob_blocked (op, creator->map, creator->x, creator->y)) |
|
|
246 | op->destroy (); |
|
|
247 | else |
|
|
248 | { |
244 | SET_FLAG (op, FLAG_OBJ_ORIGINAL); |
249 | SET_FLAG (op, FLAG_OBJ_ORIGINAL); |
245 | op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); |
250 | op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); |
|
|
251 | } |
246 | } |
252 | } |
247 | else |
253 | else |
248 | { |
254 | { |
249 | op = creator->insert (op); |
255 | op = creator->insert (op); |
250 | |
256 | |
251 | if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) |
257 | if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) |
252 | monster_check_apply (creator, op); |
258 | monster_check_apply (creator, op); |
253 | |
259 | |
254 | if ((flags & GT_UPDATE_INV) && (tmp = creator->in_player ())) |
260 | if (flags & GT_UPDATE_INV) |
|
|
261 | if (object *tmp = creator->in_player ()) |
255 | esrv_send_item (tmp, op); |
262 | esrv_send_item (tmp, op); |
256 | } |
263 | } |
257 | } |
264 | } |
258 | |
265 | |
259 | /* if there are change_xxx commands in the treasure, we include the changes |
266 | /* if there are change_xxx commands in the treasure, we include the changes |
260 | * in the generated object |
267 | * in the generated object |
… | |
… | |
1566 | if (change->msg) |
1573 | if (change->msg) |
1567 | op->msg = change->msg; |
1574 | op->msg = change->msg; |
1568 | } |
1575 | } |
1569 | |
1576 | |
1570 | static int |
1577 | static int |
1571 | legal_artifact_combination (object *op, artifact * art) |
1578 | legal_artifact_combination (object *op, artifact *art) |
1572 | { |
1579 | { |
1573 | int neg, success = 0; |
1580 | int neg, success = 0; |
1574 | linked_char *tmp; |
1581 | linked_char *tmp; |
1575 | const char *name; |
1582 | const char *name; |
1576 | |
1583 | |
1577 | if (art->allowed == (linked_char *) NULL) |
1584 | if (!art->allowed) |
1578 | return 1; /* Ie, "all" */ |
1585 | return 1; /* Ie, "all" */ |
|
|
1586 | |
1579 | for (tmp = art->allowed; tmp; tmp = tmp->next) |
1587 | for (tmp = art->allowed; tmp; tmp = tmp->next) |
1580 | { |
1588 | { |
1581 | #ifdef TREASURE_VERBOSE |
1589 | #ifdef TREASURE_VERBOSE |
1582 | LOG (llevDebug, "legal_art: %s\n", &tmp->name); |
1590 | LOG (llevDebug, "legal_art: %s\n", &tmp->name); |
1583 | #endif |
1591 | #endif |
… | |
… | |
1594 | * everything is allowed except what we match |
1602 | * everything is allowed except what we match |
1595 | */ |
1603 | */ |
1596 | else if (neg) |
1604 | else if (neg) |
1597 | success = 1; |
1605 | success = 1; |
1598 | } |
1606 | } |
|
|
1607 | |
1599 | return success; |
1608 | return success; |
1600 | } |
1609 | } |
1601 | |
1610 | |
1602 | /* |
1611 | /* |
1603 | * Fixes the given object, giving it the abilities and titles |
1612 | * Fixes the given object, giving it the abilities and titles |