MantisBT - Zandronum
View Issue Details
0001868Zandronum[All Projects] Bugpublic2014-07-02 15:192018-09-30 21:40
Ivan 
Torr Samaho 
normalminoralways
closedfixed 
MicrosoftWindowsXP/Vista/7
1.2 
2.22.2 
0001868: SetAmmoCapacity is not recognized after map is finished
Take this wad, summon a backpack. See that your ammo capacities have changed. Now, exit the map. Notice your ammo capacity is back to the old values.

'https://www.dropbox.com/s/22ayuy1a0hu1xma/ammoc.wad [^]'
No tags attached.
related to 0001914new  MaxHealthBonus/MaxArmorBonus are not recognized properly 
related to 0001972closed  SetAmmoCapacity() not executed in ENTER script 
png Screenshot_Doom_20140810_193017.png (119,839) 2014-08-10 16:34
/tracker/file_download.php?file_id=1281&type=bug
png

? ammoc.wad (1,465) 2015-08-11 23:33
/tracker/file_download.php?file_id=1622&type=bug
Issue History
2014-07-02 15:19IvanNew Issue
2014-07-02 17:01DuskAssigned To => Dusk
2014-07-02 17:01DuskStatusnew => confirmed
2014-08-10 16:01DuskRelationship addedrelated to 0001914
2014-08-10 16:01DuskStatusconfirmed => assigned
2014-08-10 16:34DuskFile Added: Screenshot_Doom_20140810_193017.png
2014-08-10 16:35DuskNote Added: 0010165
2014-08-10 17:32DuskNote Added: 0010168
2014-10-25 17:46BorgNote Added: 0010687
2014-10-25 20:32BorgNote Added: 0010689
2014-10-25 20:44BorgNote Deleted: 0010689
2014-10-25 20:44BorgNote Deleted: 0010687
2014-10-26 09:10DuskRelationship addedrelated to 0001972
2015-01-03 19:29Torr SamahoNote Added: 0011247
2015-01-03 19:32Torr SamahoNote Edited: 0011247bug_revision_view_page.php?bugnote_id=11247#r6295
2015-08-10 12:01IvanNote Added: 0013189
2015-08-10 16:19Edward-sanNote Added: 0013203
2015-08-10 16:20Edward-sanNote Edited: 0013203bug_revision_view_page.php?bugnote_id=13203#r7893
2015-08-11 23:33DuskFile Added: ammoc.wad
2015-11-18 19:14Torr SamahoNote Added: 0013845
2015-11-18 19:14Torr SamahoAssigned ToDusk => Torr Samaho
2015-11-18 19:14Torr SamahoStatusassigned => needs testing
2015-11-18 19:27cobaltTarget Version => 2.2
2015-11-18 19:27cobaltDescription Updatedbug_revision_view_page.php?rev_id=8246#r8246
2015-11-18 19:27cobaltNote Added: 0013846
2015-12-07 01:16Ru5tK1ngNote Added: 0013946
2015-12-07 01:17Ru5tK1ngStatusneeds testing => resolved
2015-12-07 01:17Ru5tK1ngResolutionopen => fixed
2015-12-07 01:17Ru5tK1ngFixed in Version => 2.2
2015-12-07 01:17Ru5tK1ngDescription Updatedbug_revision_view_page.php?rev_id=8295#r8295
2018-09-30 21:40Blzut3Statusresolved => closed

Notes
(0010165)
Dusk   
2014-08-10 16:35   
It's a desync, the client is left in the dark about the ammo capacity after the map change.
(0010168)
Dusk   
2014-08-10 17:32   
I'm baffled as to why this happens. I cannot find the reason the client resets the variable.. I cannot use 'watch' in gdb without an instance of the variable and I also cannot use 'break' because MaxAmount is a public member and not a function like it should be.

How do I go about figuring out why this happens? ZDoom is a horrible tangled mess and I am most definitely not going to try find the solution by examining all of the code...
(0011247)
Torr Samaho   
2015-01-03 19:29   
(edited on: 2015-01-03 19:32)
Quote from Dusk
How do I go about figuring out why this happens?

I'd start with a full text search (Match case + whole words only) for MaxAmount to identify the places where the value is potentially changed. If you are lucky, you can get away using "MaxAmount = " as string. Otherwise use some RegEx to allow arbitrary types and amount of white space before and after the equality sign.
Quote from Dusk
ZDoom is a horrible tangled mess and I am most definitely not going to try find the solution by examining all of the code...

If you are not willing to venture through large parts of the code, you most likely won't be able to fix this bug or many others. I can't even count how often I had to do something like this over the years. 0001588 is just a very recent example.

(0013189)
Ivan   
2015-08-10 12:01   
What are the chances of this being fixed? I've tried many hacks and workarounds but none of them seem to be working at all. I've even tried to force the ammo capacity changes through clientside scripts, but something is just overriding it.
(0013203)
Edward-san   
2015-08-10 16:19   
(edited on: 2015-08-10 16:20)
I believe the issue is partially caused by SERVER_ResetInventory , as the players are asked to destroy their inventory, then they receive it without the updated MaxAmount.

I say partially, because I tried to fix it by changing SERVERCOMMANDS_GiveInventory and SERVERCOMMANDS_GiveInventoryNotOverwritingAmount by taking MaxAmount into account, but it partially fixed the issue. Some ammo capabilities are still reset, no idea why.

(0013845)
Torr Samaho   
2015-11-18 19:14   
Should be fixed now in 2.2. Please test.
(0013846)
cobalt   
2015-11-18 19:27   
Issue addressed by commit e1b83805b006: Fixed: Clients were not properly informed about the effects of SetAmmoCapacity after a changemap map change (fixes 1868).
Committed by Benjamin Berkels [Torr Samaho] on Wednesday 18 November 2015 20:11:45

Changes in files:

 docs/zandronum-history.txt | 1 +
 src/sv_main.cpp | 5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

(0013946)
Ru5tK1ng   
2015-12-07 01:16   
Using:'https://www.dropbox.com/s/obffhny5vh06g6e/zandronum-3.0-r150809-0703-83ceae7-windows.zip?dl=0 [^]'

I didn't see any desyncs when moving to a new map. Ammo capacities were correct.