otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.59k stars 1.06k forks source link

Max items per stack #1846

Closed vankk closed 7 years ago

vankk commented 8 years ago

Too much items on stack

  1. Create 2000 pages of items on a stack ground
  2. Up and down the stair
  3. Crash.

    Expected behaviour

Not crash or maybe set a limit for sqm?

Actual behaviour

The step three.

Environment

I don't have any kinda of logs, because I already fixed this problem a few months ago. The system is Ubuntu 14.04.

Fix

Seted the max value per ground in 500.

darkjav commented 8 years ago

@vankk Hello, where you put the max value per ground? Thanks.

Kamenuvol commented 8 years ago

I think you changed expected with actual behaviour not only in this issue. About the issue, I think we should limit it to 256, in order to save bytes of "counter" too

ranisalt commented 8 years ago

Half- and quarter-word value types might be less performant while not saving worthy amounts of memory.

vankk commented 8 years ago

@darkjav The value 0xFFFF on tile.cpp L624 is equal to 65535 items, I did some changes to edit this value on config.lua and I seted it to 500 items.

darkjav commented 8 years ago

@vankk So if i put there, the value: 0x1F4, must work correctly true?

wgrr commented 8 years ago

i've tried many ways to reproduce this, nothing happens even with 65535 items on tiles up/down of stair tile.

Codex-NG commented 8 years ago

Yes @vankk Here is a decimal to hex converter http://www.binaryhexconverter.com/decimal-to-hex-converter If your not up for the math you can always just paste in google "0x1F4 to decimal" and you will get the calculator with the answer 500

andersonfaaria commented 8 years ago

I've tried to reproduce this also but it didn't crash, either way I did the change too.

Kamenuvol commented 8 years ago

An idea for the limit: www.tibia.com/news/?subtopic=newsarchive&id=3667

joseluis2g commented 8 years ago

@Kamenuvol

if (items && items->size() >= 3E8) {
            return RETURNVALUE_NOTPOSSIBLE;
        }
Ezzz-dev commented 8 years ago

OTServ SVN actually has this feature for quite a few years, why hasn't been included here yet? Also, need to know the exact cause for this to happen, given the client only accepts stacks in orders of 1~10.

Codex-NG commented 8 years ago

@TwistedScorpio because not everything gets implemented into the official distro... I've been learning c++ more lately and I doubt anything I have added to the sources will be accepted as part of the official distribution not because the code I am writing is shit lol.. well maybe it is :p but because it isn't "tibia" related, not to say that this issue isn't real or isn't needed to be fixed.

Kamenuvol commented 8 years ago

I tried to reproduce, 420 pages of items created and no crash here.

djarek commented 7 years ago

Closing issue due to old age. If the issue persists please reopen.