Fixed the reloading-logic to avoid an "ammo-loss" bug.
This commit is contained in:
parent
cdec0d9e79
commit
86e40f90c3
1 changed files with 7 additions and 5 deletions
|
@ -170,13 +170,15 @@ BaseGun_Reload
|
||||||
*/
|
*/
|
||||||
float BaseGun_Reload( void ) {
|
float BaseGun_Reload( void ) {
|
||||||
static void BaseGun_FinishReload( void ) {
|
static void BaseGun_FinishReload( void ) {
|
||||||
// What if we've got less in our caliberfield than we need
|
int iNeed = wptTable[ self.weapon ].iMagSize - self.(wptTable[ self.weapon ].iMagfld);
|
||||||
if ( self.(wptTable[ self.weapon ].iCaliberfld) < wptTable[ self.weapon ].iMagSize ) {
|
int iHave = self.(wptTable[ self.weapon ].iCaliberfld);
|
||||||
self.(wptTable[ self.weapon ].iMagfld) = self.(wptTable[ self.weapon ].iCaliberfld);
|
|
||||||
|
if ( iNeed > iHave ) {
|
||||||
|
self.(wptTable[ self.weapon ].iMagfld) += iHave;
|
||||||
self.(wptTable[ self.weapon ].iCaliberfld) = 0;
|
self.(wptTable[ self.weapon ].iCaliberfld) = 0;
|
||||||
} else {
|
} else {
|
||||||
self.(wptTable[ self.weapon ].iCaliberfld) -= ( wptTable[ self.weapon ].iMagSize - self.(wptTable[ self.weapon ].iMagfld) );
|
self.(wptTable[ self.weapon ].iMagfld) += iNeed;
|
||||||
self.(wptTable[ self.weapon ].iMagfld) = wptTable[ self.weapon ].iMagSize;
|
self.(wptTable[ self.weapon ].iCaliberfld) -= iNeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
Weapon_UpdateCurrents();
|
Weapon_UpdateCurrents();
|
||||||
|
|
Loading…
Reference in a new issue