File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -524,11 +524,18 @@ void CraftEquipmentState::moveRightByValue(int change)
524524 {
525525 // And now let's see if we can add the total number of vehicles.
526526 RuleItem *ammo = _game->getMod ()->getItem (item->getCompatibleAmmo ()->front ());
527- int ammoPerVehicle = ammo-> getClipSize () ;
528- if (ammoPerVehicle > 0 && item->getClipSize () > 0 )
527+ int ammoPerVehicle, clipSize ;
528+ if (ammo-> getClipSize () > 0 && item->getClipSize () > 0 )
529529 {
530- ammoPerVehicle = item->getClipSize () / ammo->getClipSize ();
530+ clipSize = item->getClipSize ();
531+ ammoPerVehicle = clipSize / ammo->getClipSize ();
531532 }
533+ else
534+ {
535+ clipSize = ammo->getClipSize ();
536+ ammoPerVehicle = clipSize;
537+ }
538+
532539 int baseQty = _base->getStorageItems ()->getItem (ammo->getType ()) / ammoPerVehicle;
533540 if (_game->getSavedGame ()->getMonthsPassed () == -1 )
534541 baseQty = 1 ;
@@ -542,7 +549,7 @@ void CraftEquipmentState::moveRightByValue(int change)
542549 _base->getStorageItems ()->removeItem (ammo->getType (), ammoPerVehicle);
543550 _base->getStorageItems ()->removeItem (_items[_sel]);
544551 }
545- c->getVehicles ()->push_back (new Vehicle (item, ammoPerVehicle , size));
552+ c->getVehicles ()->push_back (new Vehicle (item, clipSize , size));
546553 }
547554 }
548555 else
You can’t perform that action at this time.
0 commit comments