#638 Can't refill some missile slots


Last SVN rev 13399, when Torpedo's slot goes empty i'm not able to buy another one directly. It behaves as the slot was full, but there are 0 missiles remaining. The only way seems to be buying another kind of missiles and then replace them with a torpedo. This doesn't happen with other missiles like for es. dumbfire, by now i can't say if torpedos are the only ones. Issue present already in stable (0.5.1 r1) version.


  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2012-08-01
    Last edit: Anonymous 2014-03-20
  • maze

    maze - 2012-11-25

    I discuss this bug in the following forum topic:

    Here's my proposed fix for the time being:

    Index: src/cmd/unit_generic.cpp

    --- src/cmd/unit_generic.cpp (revision 13449)
    +++ src/cmd/unit_generic.cpp (working copy)
    @@ -6366,7 +6366,7 @@
    //only look at this mount if it can fit in the rack
    if ( (unsigned int) (up->mounts[i].type->size) == (up->mounts[i].type->size&mounts[jmod].size) ) {
    if (up->mounts[i].type->weapon_name != mounts[jmod].type->weapon_name || mounts[jmod].status
    - == Mount::DESTROYED || mounts[jmod].status == Mount::UNCHOSEN) {
    + == Mount::DESTROYED || mounts[jmod].status == Mount::UNCHOSEN || mounts[jmod].ammo == 0) {
    //If missile, can upgrade directly, if other type of ammo, needs actual gun to be present.
    if (isammo && !ismissiletype) {
    cancompletefully = false;

  • maze

    maze - 2012-11-26

    I've been thinking about it a little bit more and it might be that my proposed batch in section II.A from my long section above is problematic. In any case there's probably a better way to fix the issue. I'll come back soon with another proposal, I just need to find where in the code a ship's mount gets attributed a volume.

  • maze

    maze - 2012-11-26

    This bug looks like it's very similar to an older, closed one which is 1812870.

  • Klauss++

    Klauss++ - 2012-12-31

    Thanks for the patch maze. Check the review board, a few fixes and we might get this in (I have to test it against GG though, GG is quite sensitive to ammo stuff).

  • Turbo Beholder

    Turbo Beholder - 2013-07-21

    It's better to use the existing capabilities as intended rather than to use more convoluted conditions. In this case, IsEmpty() is supposed to handle such things. Thus, simply making a missile mount UNCHOSEN when the last missile is shot in Mount::Fire solves everything and makes more sense in that there's no need to indicate it as having 0 ammo - the weapon is truly absent just as if it was uninstalled.
    See [patches:#62]



    Patches: #62

    Last edit: Turbo Beholder 2013-07-21
  • Klauss++

    Klauss++ - 2013-07-27
    • status: open --> closed-fixed
  • Klauss++

    Klauss++ - 2013-07-27

    Alright, I can't reproduce it, but I'll take both your words for it. The patch for making them unchosen seems clean enough.



Cancel  Add attachments