… | |
… | |
32 | |
32 | |
33 | //#define TREASURE_VERBOSE |
33 | //#define TREASURE_VERBOSE |
34 | |
34 | |
35 | #include <global.h> |
35 | #include <global.h> |
36 | #include <treasure.h> |
36 | #include <treasure.h> |
37 | #include <funcpoint.h> |
|
|
38 | #include <loader.h> |
37 | #include <loader.h> |
39 | |
38 | |
40 | extern char *spell_mapping[]; |
39 | extern char *spell_mapping[]; |
41 | |
40 | |
42 | static treasurelist *first_treasurelist; |
41 | static treasurelist *first_treasurelist; |
… | |
… | |
145 | |
144 | |
146 | switch (f.kw) |
145 | switch (f.kw) |
147 | { |
146 | { |
148 | case KW_arch: |
147 | case KW_arch: |
149 | t->item = archetype::find (f.get_str ()); |
148 | t->item = archetype::find (f.get_str ()); |
|
|
149 | |
150 | if (!t->item) |
150 | if (!t->item) |
151 | { |
151 | { |
152 | f.parse_warn ("treasure references unknown archetype"); |
152 | f.parse_warn ("treasure references unknown archetype"); |
153 | goto error; |
153 | t->item = archetype::empty; |
154 | } |
154 | } |
155 | |
155 | |
156 | break; |
156 | break; |
157 | |
157 | |
158 | case KW_list: f.get (t->name); break; |
158 | case KW_list: f.get (t->name); break; |
… | |
… | |
255 | return; |
255 | return; |
256 | } |
256 | } |
257 | |
257 | |
258 | op->expand_tail (); |
258 | op->expand_tail (); |
259 | |
259 | |
260 | if (op->blocked (creator->map, creator->x, creator->y)) |
260 | if (!op->is_on_map () || op->blocked (creator->map, creator->x, creator->y)) |
261 | op->destroy (); |
261 | op->destroy (); |
262 | else |
262 | else |
263 | { |
263 | { |
264 | SET_FLAG (op, FLAG_OBJ_ORIGINAL); |
264 | SET_FLAG (op, FLAG_OBJ_ORIGINAL); |
265 | op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); |
265 | op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); |
… | |
… | |
269 | { |
269 | { |
270 | op = creator->insert (op); |
270 | op = creator->insert (op); |
271 | |
271 | |
272 | if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) |
272 | if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) |
273 | monster_check_apply (creator, op); |
273 | monster_check_apply (creator, op); |
274 | |
|
|
275 | if (flags & GT_UPDATE_INV) |
|
|
276 | if (object *tmp = creator->in_player ()) |
|
|
277 | esrv_send_item (tmp, op); |
|
|
278 | } |
274 | } |
279 | } |
275 | } |
280 | |
276 | |
281 | /* if there are change_xxx commands in the treasure, we include the changes |
277 | /* if there are change_xxx commands in the treasure, we include the changes |
282 | * in the generated object |
278 | * in the generated object |