Author Topic: Possible bug in bonus object  (Read 668 times)

Offline Lash

  • Acquaintance
  • *
  • Posts: 42
    • View Profile
Possible bug in bonus object
« on: December 12, 2014, 07:21:11 PM »
In my experience the bonuses conferred by potions were being added to the player character but not removed after the "Duration" timer had timed out as specified in the /lib/bonus.c file. The bonus object was not being destructed as it should have been.

I believe the following piece of code starting at line 30 is the culprit in bonus.c:

Code: [Select]
void heart_beat(){
    if(Duration) Duration--;
    else eventDestruct();
}

When changed to the following:

Code: [Select]
void heart_beat(){
    if(Duration > 0 ) Duration--;
    else this_object()->eventDestruct();
}

the bonus object was destructed and the bonuses to the player were removed.