• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Crash bug

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,200
Solutions
2
Reaction score
149
crash fix [20 EUR~]


ideas?

C++:
void Game::checkDecay()
{
    g_scheduler.addEvent(createSchedulerTask(EVENT_DECAYINTERVAL, std::bind(&Game::checkDecay, this)));

    size_t bucket = (lastBucket + 1) % EVENT_DECAY_BUCKETS;

    auto it = decayItems[bucket].begin(), end = decayItems[bucket].end();
    while (it != end) {
        Item* item = *it;
        if (!item->canDecay()) {
            item->setDecaying(DECAYING_FALSE);
            ReleaseItem(item);
            it = decayItems[bucket].erase(it);
            continue;
        }

        int32_t duration = item->getDuration();
        int32_t decreaseTime = std::min<int32_t>(EVENT_DECAYINTERVAL * EVENT_DECAY_BUCKETS, duration);

        duration -= decreaseTime;
        item->decreaseDuration(decreaseTime);

        if (duration <= 0) {
            it = decayItems[bucket].erase(it);
            internalDecayItem(item);
            ReleaseItem(item);
        } else if (duration < EVENT_DECAYINTERVAL * EVENT_DECAY_BUCKETS) {
            it = decayItems[bucket].erase(it);
            size_t newBucket = (bucket + ((duration + EVENT_DECAYINTERVAL / 2) / 1000)) % EVENT_DECAY_BUCKETS;
            if (newBucket == bucket) {
                internalDecayItem(item);
                ReleaseItem(item);
            } else {
                decayItems[newBucket].push_back(item);
            }
        } else {
            ++it;
        }
    }

    lastBucket = bucket;
    cleanup();
}



EDITED. I bought the fix from a friend.
 
Last edited by a moderator:
crash fix [20 EUR~]


ideas?

C++:
void Game::checkDecay()
{
    g_scheduler.addEvent(createSchedulerTask(EVENT_DECAYINTERVAL, std::bind(&Game::checkDecay, this)));

    size_t bucket = (lastBucket + 1) % EVENT_DECAY_BUCKETS;

    auto it = decayItems[bucket].begin(), end = decayItems[bucket].end();
    while (it != end) {
        Item* item = *it;
        if (!item->canDecay()) {
            item->setDecaying(DECAYING_FALSE);
            ReleaseItem(item);
            it = decayItems[bucket].erase(it);
            continue;
        }

        int32_t duration = item->getDuration();
        int32_t decreaseTime = std::min<int32_t>(EVENT_DECAYINTERVAL * EVENT_DECAY_BUCKETS, duration);

        duration -= decreaseTime;
        item->decreaseDuration(decreaseTime);

        if (duration <= 0) {
            it = decayItems[bucket].erase(it);
            internalDecayItem(item);
            ReleaseItem(item);
        } else if (duration < EVENT_DECAYINTERVAL * EVENT_DECAY_BUCKETS) {
            it = decayItems[bucket].erase(it);
            size_t newBucket = (bucket + ((duration + EVENT_DECAYINTERVAL / 2) / 1000)) % EVENT_DECAY_BUCKETS;
            if (newBucket == bucket) {
                internalDecayItem(item);
                ReleaseItem(item);
            } else {
                decayItems[newBucket].push_back(item);
            }
        } else {
            ++it;
        }
    }

    lastBucket = bucket;
    cleanup();
}



EDITED. I bought the fix from a friend.


could you help with the solution?
 
Has anyone figured out what was causing this? It still seems to be in my sources. It has to do with decaying items. Whenever I kill a monster it crashes the server and has Game::checkDecay() written all over it. Specifically when it is checking for the attribute for decay and setting it.

Can pay for solution

1726831904523.webp

1726831871096.webp

Solved. I was just being stupid deleting stuff I shouldn't of in sources.
 
Last edited:

Similar threads

Back
Top