ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/treasure.C
(Generate patch)

Comparing deliantra/server/common/treasure.C (file contents):
Revision 1.25 by root, Tue Dec 12 22:37:05 2006 UTC vs.
Revision 1.29 by root, Tue Dec 26 20:04:09 2006 UTC

258 shstr_cmp name_ (name); 258 shstr_cmp name_ (name);
259 259
260 if (!name_) 260 if (!name_)
261 return 0; 261 return 0;
262 262
263 for (treasurelist * tl = first_treasurelist; tl != 0; tl = tl->next) 263 for (treasurelist *tl = first_treasurelist; tl != 0; tl = tl->next)
264 if (name_ == tl->name) 264 if (name_ == tl->name)
265 return tl; 265 return tl;
266 266
267 if (first_treasurelist) 267 if (first_treasurelist)
268 LOG (llevError, "Couldn't find treasurelist %s\n", name); 268 LOG (llevError, "Couldn't find treasurelist %s\n", name);
280 * being generated. 280 * being generated.
281 * If flag is GT_INVISIBLE, only invisible objects are generated (ie, only 281 * If flag is GT_INVISIBLE, only invisible objects are generated (ie, only
282 * abilities. This is used by summon spells, thus no summoned monsters 282 * abilities. This is used by summon spells, thus no summoned monsters
283 * start with equipment, but only their abilities). 283 * start with equipment, but only their abilities).
284 */ 284 */
285
286
287static void 285static void
288put_treasure (object *op, object *creator, int flags) 286put_treasure (object *op, object *creator, int flags)
289{ 287{
290 object *tmp; 288 object *tmp;
291 289
294 * this is the original object, or if this is an object that should be created 292 * this is the original object, or if this is an object that should be created
295 * by another object. 293 * by another object.
296 */ 294 */
297 if (flags & GT_ENVIRONMENT && op->type != SPELL) 295 if (flags & GT_ENVIRONMENT && op->type != SPELL)
298 { 296 {
299 op->x = creator->x;
300 op->y = creator->y;
301 SET_FLAG (op, FLAG_OBJ_ORIGINAL); 297 SET_FLAG (op, FLAG_OBJ_ORIGINAL);
302 insert_ob_in_map (op, creator->map, op, INS_NO_MERGE | INS_NO_WALK_ON); 298 op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON);
303 } 299 }
304 else 300 else
305 { 301 {
306 op = insert_ob_in_ob (op, creator); 302 op = creator->insert (op);
303
307 if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) 304 if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER))
308 monster_check_apply (creator, op); 305 monster_check_apply (creator, op);
306
309 if ((flags & GT_UPDATE_INV) && (tmp = is_player_inv (creator)) != NULL) 307 if ((flags & GT_UPDATE_INV) && (tmp = creator->in_player ()))
310 esrv_send_item (tmp, op); 308 esrv_send_item (tmp, op);
311 } 309 }
312} 310}
313 311
314/* if there are change_xxx commands in the treasure, we include the changes 312/* if there are change_xxx commands in the treasure, we include the changes
339 if ((int) t->chance >= 100 || (RANDOM () % 100 + 1) < (int) t->chance) 337 if ((int) t->chance >= 100 || (RANDOM () % 100 + 1) < (int) t->chance)
340 { 338 {
341 if (t->name) 339 if (t->name)
342 { 340 {
343 if (strcmp (t->name, "NONE") && difficulty >= t->magic) 341 if (strcmp (t->name, "NONE") && difficulty >= t->magic)
342 {
343 treasurelist *tl = find_treasurelist (t->name);
344 if (tl)
344 create_treasure (find_treasurelist (t->name), op, flag, difficulty, tries); 345 create_treasure (tl, op, flag, difficulty, tries);
346 }
345 } 347 }
346 else 348 else
347 { 349 {
348 if (t->item->clone.invisible != 0 || !(flag & GT_INVISIBLE)) 350 if (t->item->clone.invisible != 0 || !(flag & GT_INVISIBLE))
349 { 351 {
397 { 399 {
398 if (!strcmp (t->name, "NONE")) 400 if (!strcmp (t->name, "NONE"))
399 return; 401 return;
400 402
401 if (difficulty >= t->magic) 403 if (difficulty >= t->magic)
404 {
405 treasurelist *tl = find_treasurelist (t->name);
406 if (tl)
402 create_treasure (find_treasurelist (t->name), op, flag, difficulty, tries); 407 create_treasure (tl, op, flag, difficulty, tries);
408 }
403 else if (t->nrof) 409 else if (t->nrof)
404 create_one_treasure (tl, op, flag, difficulty, tries); 410 create_one_treasure (tl, op, flag, difficulty, tries);
405 411
406 return; 412 return;
407 } 413 }
1264 { 1270 {
1265 for (i = 0; i < depth; i++) 1271 for (i = 0; i < depth; i++)
1266 fprintf (logfile, " "); 1272 fprintf (logfile, " ");
1267 fprintf (logfile, "{ (list: %s)\n", &t->name); 1273 fprintf (logfile, "{ (list: %s)\n", &t->name);
1268 tl = find_treasurelist (t->name); 1274 tl = find_treasurelist (t->name);
1275 if (tl)
1269 dump_monster_treasure_rec (name, tl->items, depth + 2); 1276 dump_monster_treasure_rec (name, tl->items, depth + 2);
1270 for (i = 0; i < depth; i++) 1277 for (i = 0; i < depth; i++)
1271 fprintf (logfile, " "); 1278 fprintf (logfile, " ");
1272 fprintf (logfile, "} (end of list: %s)\n", &t->name); 1279 fprintf (logfile, "} (end of list: %s)\n", &t->name);
1273 } 1280 }
1274 else 1281 else
1490 CLEAR_FLAG (op, FLAG_ANIMATE); 1497 CLEAR_FLAG (op, FLAG_ANIMATE);
1491 /* so artifacts will join */ 1498 /* so artifacts will join */
1492 if (!QUERY_FLAG (op, FLAG_ALIVE)) 1499 if (!QUERY_FLAG (op, FLAG_ALIVE))
1493 op->speed = 0.0; 1500 op->speed = 0.0;
1494 1501
1495 update_ob_speed (op); 1502 op->set_speed (op->speed);
1496 } 1503 }
1497 1504
1498 if (change->nrof) 1505 if (change->nrof)
1499 op->nrof = RANDOM () % ((int) change->nrof) + 1; 1506 op->nrof = RANDOM () % ((int) change->nrof) + 1;
1500 1507

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines