MantisBT - Zandronum
View Issue Details
0002386Zandronum[All Projects] Bugpublic2015-08-09 16:262018-09-30 22:19
Ivan 
Edward-san 
normalmajoralways
closedfixed 
2.1 
2.13.0 
0002386: Item amounts sent in 2 bytes instead of 4
From a conversation with Dusk on irc (link:'http://hastebin.com/loweniture.xml [^]')

An image to demonstrate the problem:'http://i.imgur.com/VxmHIfU.png [^]'

The credit actor has a inventory.maxamount property of 0x7FFFFFFF and right after the 5th digit, there is an overflow. Which makes sense as signed short max is 32767 and it has 5 digits.
No tags attached.
Issue History
2015-08-09 16:26IvanNew Issue
2015-08-09 17:02IvanNote Added: 0013162
2015-08-09 17:42Edward-sanNote Added: 0013164
2015-08-09 17:43Edward-sanAssigned To => Edward-san
2015-08-09 17:43Edward-sanStatusnew => feedback
2015-08-09 17:43IvanNote Added: 0013165
2015-08-09 17:43IvanStatusfeedback => assigned
2015-08-09 17:44Edward-sanStatusassigned => feedback
2015-08-09 17:44IvanNote Deleted: 0013165
2015-08-09 17:45IvanNote Edited: 0013162bug_revision_view_page.php?bugnote_id=13162#r7850
2015-08-09 17:49WaTaKiDNote Added: 0013166
2015-08-09 17:49WaTaKiDNote Edited: 0013166bug_revision_view_page.php?bugnote_id=13166#r7852
2015-08-09 18:17IvanNote Added: 0013167
2015-08-09 18:17IvanStatusfeedback => assigned
2015-08-09 19:07Edward-sanStatusassigned => needs review
2015-08-09 20:13Torr SamahoNote Added: 0013175
2015-08-09 21:42Edward-sanNote Added: 0013177
2015-08-09 21:42Edward-sanProduct Version3.0-beta => 2.1
2015-08-19 19:06Torr SamahoNote Added: 0013236
2015-08-19 19:06Torr SamahoStatusneeds review => needs testing
2015-08-19 19:07cobaltTarget Version => 2.1
2015-08-19 19:07cobaltDescription Updatedbug_revision_view_page.php?rev_id=7924#r7924
2015-08-19 19:07cobaltNote Added: 0013237
2015-09-12 23:57Ru5tK1ngNote Added: 0013503
2015-09-14 23:20DuskStatusneeds testing => resolved
2015-09-14 23:20DuskFixed in Version => 3.0
2015-09-14 23:20DuskResolutionopen => fixed
2018-09-30 22:19Blzut3Statusresolved => closed

Notes
(0013162)
Ivan   
2015-08-09 17:02   
(edited on: 2015-08-09 17:45)
Additional Info:'https://www.dropbox.com/s/hoqqfibtfyd3xj7/bytetest.pk3?dl=0 [^]' | Download this example file. I've managed to isolate the problem. Follow these steps:

1) Try to give yourself "creditgiver" in console, you'll see it'll give the item properly and there will be no overflow.

2) Summon "zombieman2", kill it, it gives 32760 credit. Summon another, kill it, overflow.

3) Additionally, there's also a problem with taking inventories online. Simply change the A_GiveToTarget to A_TakeFromTarget, and try again.

(0013164)
Edward-san   
2015-08-09 17:42   
'https://bitbucket.org/crimsondusk/zandronum-sandbox-stable/commits/fcd5e521635df68450de09b75cd4bf8a62f083a5 [^]' should fix the issue, with both inventory giving and taking.
(0013166)
WaTaKiD   
2015-08-09 17:49   
'https://www.dropbox.com/s/sq8k1j8ezobhoep/zandronum-2.2-r150809-1741-fcd5e52-windows.zip?dl=0 [^]' contains the above commit, please test

(0013167)
Ivan   
2015-08-09 18:17   
Works properly.
(0013175)
Torr Samaho   
2015-08-09 20:13   
Since the fix is for the stable branch, can I assume this is not a 3.0 only issue?
(0013177)
Edward-san   
2015-08-09 21:42   
Uh yeah. Fixed the version.
(0013236)
Torr Samaho   
2015-08-19 19:06   
I added your patch.
(0013237)
cobalt   
2015-08-19 19:07   
Issue addressed by commit ccd429c7c8fd: - Fixed: the server did not handle item givings and takings with amounts greater than 32767 (addresses 2386).
Committed by Edoardo Prezioso [edward-san] on Sunday 09 August 2015 19:41:10

Changes in files:

 docs/zandronum-history.txt | 1 +
 src/cl_main.cpp | 4 ++--
 src/sv_commands.cpp | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

(0013503)
Ru5tK1ng   
2015-09-12 23:57   
I followed the steps as indicated by Ivan and I was able to reach over 1 million credits without issue by simply killing zombies. I tested out a_takefromtarget and my credits went down properly and didn't go past zero or bug out. All is good it seems.

Tested online with 3.0-alpha-150819-235.