Why no answers this? (If a magazine capacity exceeds 255, ammo disappear when changing weapons)

  • Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

duk6046

Member
Jul 15, 2009
136
5
18

Is it impossible to fix?

Category: Code

Reproducibility: Always

Summary: If a magazine capacity exceeds 255, ammo disappear when changing weapons (swap).

Description: I seems the magazine capacity code is recently changed from byte to int, but there a problem with inventory or other code. Please fix it for custom server
 
Last edited:

Yoshiro

In Soviet Russia, Yoshiro is a cake
Staff member
Oct 10, 2005
13,252
4,035
113
This is a case where it is likely the custom mod/mutator should be changed to fix this issue as there doesn't appear to be an issue in the stock code here.
 

duk6046

Member
Jul 15, 2009
136
5
18
This is a case where it is likely the custom mod/mutator should be changed to fix this issue as there doesn't appear to be an issue in the stock code here.
I found a suspicious code in KFInventoryManager.
'local byte MagAmmoCount;' of 'simulated function final BuyAmmo( float AmountPurchased, EItemType ItemType, optional byte ItemIndex, optional bool bSecondaryAmmo )' and
'byte ClientAmmoCount' of 'reliable server final private function ServerBuyAmmo(int AmountPurchased, byte ClientAmmoCount, byte ItemIndex, bool bSecondaryAmmo)' lines
are these not relevant?
 

Humam2104

Active member
Jul 1, 2020
480
93
28
ok but i can't understand why that value is byte
It's a developer's preference.. takes less RAM.
But with the current sizes of RAM I don't really get how it matters.
The number of waves possible in the game is also a byte.. which means after wave 254 you win!
 

duk6046

Member
Jul 15, 2009
136
5
18
It's a developer's preference.. takes less RAM.
But with the current sizes of RAM I don't really get how it matters.
The number of waves possible in the game is also a byte.. which means after wave 254 you win!
I know, Magazine and SpareAmmo are already int variable. the important thing is title and contents of top.