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

Comparing deliantra/server/common/object.C (file contents):
Revision 1.287 by root, Sat Oct 3 20:11:12 2009 UTC vs.
Revision 1.290 by sf-marcmagus, Sun Oct 11 05:43:35 2009 UTC

431 object_freezer freezer; 431 object_freezer freezer;
432 op->write (freezer); 432 op->write (freezer);
433 return freezer.as_string (); 433 return freezer.as_string ();
434} 434}
435 435
436char *
437object::as_string ()
438{
439 return dump_object (this);
440}
441
436/* 442/*
437 * get_nearest_part(multi-object, object 2) returns the part of the 443 * get_nearest_part(multi-object, object 2) returns the part of the
438 * multi-object 1 which is closest to the second object. 444 * multi-object 1 which is closest to the second object.
439 * If it's not a multi-object, it is returned. 445 * If it's not a multi-object, it is returned.
440 */ 446 */
555 update_stats (); 561 update_stats ();
556 562
557 new_draw_info_format (NDI_UNIQUE, 0, this, 563 new_draw_info_format (NDI_UNIQUE, 0, this,
558 "You try to balance all your items at once, " 564 "You try to balance all your items at once, "
559 "but the %s is just too much for your body. " 565 "but the %s is just too much for your body. "
560 "[You need to unapply some items first.]", &ob->name); 566 "[You need to unapply some items first - use the 'body' command to see "
567 "how many items you cna wera on a specific body part.]", &ob->name);
561 return false; 568 return false;
562 } 569 }
563 570
564 //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); 571 //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name);
565 } 572 }
2540 return splay (tmp); 2547 return splay (tmp);
2541 2548
2542 return 0; 2549 return 0;
2543} 2550}
2544 2551
2552void
2553object::force_set_timer (int duration)
2554{
2555 this->duration = 1;
2556 this->speed_left = -1.f;
2557
2558 this->set_speed (duration ? 1.f / duration : 0.f);
2559}
2560
2545object * 2561object *
2546object::force_add (shstr_tmp name, int duration) 2562object::force_add (shstr_tmp name, int duration)
2547{ 2563{
2548 if (object *force = force_find (name)) 2564 if (object *force = force_find (name))
2549 force->destroy (); 2565 force->destroy ();
2550 2566
2551 object *force = get_archetype (FORCE_NAME); 2567 object *force = get_archetype (FORCE_NAME);
2552 2568
2553 force->slaying = name; 2569 force->slaying = name;
2554 force->stats.food = 1;
2555 force->speed_left = -1.f;
2556 2570
2557 force->set_speed (duration ? 1.f / duration : 0.f); 2571 force->force_set_timer (duration);
2558 force->flag [FLAG_IS_USED_UP] = true; 2572
2559 force->flag [FLAG_APPLIED] = true; 2573 force->flag [FLAG_APPLIED] = true;
2560 2574
2561 return insert (force); 2575 return insert (force);
2562} 2576}
2563 2577

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines