Forgottenserver: SkullTicks overflow

Created on 5 Sep 2017  路  2Comments  路  Source: otland/forgottenserver

Before creating an issue, please ensure:

  • [ +] This is a bug in the software that resides in this repository, and not a
    support matter (use https://otland.net/forums/support.16/ for support)
  • [+] This issue is reproducible without changes to the code in this repository

Steps to reproduce (include any configuration/script required to reproduce)

  1. Add over 30 frags

In player.cpp and player.h:

void Player::checkSkullTicks(int32_t ticks)
{
    int32_t newTicks = skullTicks - ticks;

It should be replaced with

void Player::checkSkullTicks(int64_t ticks)
{
    int64_t newTicks = skullTicks - ticks;

It is because of variable ranges. If every frag is 1 day (86400 * 1000), then 30 frags will cross that range.

bug

Most helpful comment

i wonder why a millisecond precision on this

All 2 comments

i wonder why a millisecond precision on this

Me too. Even minute precision might be enough. We could use std::chrono durations for ease of manipulation and better representation width.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zeeb92 picture zeeb92  路  4Comments

irenicus30 picture irenicus30  路  5Comments

TwistedScorpio picture TwistedScorpio  路  5Comments

EPuncker picture EPuncker  路  3Comments

Zbizu picture Zbizu  路  5Comments