Skip to content

Commit

Permalink
refactor decayTimeMax if/else
Browse files Browse the repository at this point in the history
  • Loading branch information
MillhioreBT committed Mar 14, 2024
1 parent 09ae36d commit 0e7e7c5
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,7 @@ void Item::setID(uint16_t newid)
id = newid;

const ItemType& it = Item::items[newid];
uint32_t newDuration;
if (it.decayTimeMin != 0 && it.decayTimeMax != 0) {
newDuration = normal_random(it.decayTimeMin, it.decayTimeMax) * 1000;
} else {
newDuration = it.decayTimeMin * 1000;
}
uint32_t newDuration = normal_random(it.decayTimeMin, it.decayTimeMax) * 1000;

if (newDuration == 0 && !it.stopTime && it.decayTo < 0) {
removeAttribute(ITEM_ATTRIBUTE_DECAYSTATE);
Expand Down

0 comments on commit 0e7e7c5

Please sign in to comment.