Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fighter launch capacity set to 0 for unknown reasons #3830

Closed
Oberlus opened this issue May 8, 2022 · 4 comments · Fixed by #3834
Closed

Fighter launch capacity set to 0 for unknown reasons #3830

Oberlus opened this issue May 8, 2022 · 4 comments · Fixed by #3834
Labels
category:bug The Issue/PR describes or solves a perceived malfunction within the game. component:internal The Issue/PR deals with any project component that has no explicit `component` label. status:resolved The Issue was resolved, either by answering properly or fixing the underlying bug.
Milestone

Comments

@Oberlus
Copy link
Contributor

Oberlus commented May 8, 2022

Bug Report

Environment

  • FreeOrion Version: 5c9b2de (saves from 9783ded)
  • Operating System: Ubuntu 20.04 (saves from another system using snap)
    • Compiled from source

Description

Fighter launch capacity set to 0 for unknown reasons, despite hangars having some fighters in it.

Steps to reproduce

Load save file 51 from LienRag's report at the forum: https://www.freeorion.org/forum/viewtopic.php?p=111600&sid=c99d79f975129e9d3c7fb704faad38ac#p111600
Check out the ship "Manet" going from Taladas to empty system Rov. It has launch capacity 2 (correct).
Press turn and check out that same ship at Rov: it now has launch capacity 0.

@Oberlus Oberlus added the category:bug The Issue/PR describes or solves a perceived malfunction within the game. label May 8, 2022
@Vezzra Vezzra added the component:internal The Issue/PR deals with any project component that has no explicit `component` label. label May 10, 2022
@MichaelCourtney
Copy link
Contributor

To produce bug, adopt Flanking.

@agrrr3
Copy link
Contributor

agrrr3 commented May 12, 2022

there might be multiple issues with (the FOCS stuff used) in PLC_FLANKING.

one is this issue and while e.g. arc disruptor effect works SetMaxSecondaryStat partname = "SR_ARC_DISRUPTOR" value = Value + NamedReal name = "PLC_FLANKING_ARC_DISRUPTOR_SHOT_BONUS" value = 1.0, the launch bay effect intendended for interceptors in the same effectsgroup does seem to cause the issue:

                SetMaxCapacity partname = "FT_BAY_1" value = Value
                + (  (Statistic If condition = And [ Object id = Target.ID  DesignHasPart low = 1 high = 999 name = "FT_HANGAR_1" ] )
                   * (NamedReal name = "PLC_FLANKING_BAY_LAUNCH_BONUS" value = 2.0 ) )

Also in the same EffectsGroup, SetMaxSecondaryStat is used for hangar capacity of the other fighters and SetMaxDamage for MD,Laser,Plasma and DR. I did not check if those effects work.

also i had the feeling that the effectsgroup gets triggered too often (a ship in flight not eligible for pincer bonus gets its launch bay set to zero).

Also note these bad effects are all regressions

@geoffthemedio is this possible in principle(?): an error occurs when the value ref for SetMaxCapacity is evaluated in SetShipPartMeter::Execute so the whole thing evaluates to zero?

@geoffthemedio
Copy link
Member

If there is an error, some valuerefs will default to returning 0, so perhaps, depending what qualifies as an "error"...

@agrrr3
Copy link
Contributor

agrrr3 commented May 12, 2022

it fails to find the meter? after the following in NewMeterValue m is nullptr and it return {Meter::INVALID_VALUE, m};

if constexpr (std::is_same_v<M, MeterType>) {
    m = target ? target->GetMeter(meter) : nullptr;
}else if constexpr (std::is_same_v<M, Meter*>) {
    m = meter;}

... think i found the bug...

geoffthemedio pushed a commit that referenced this issue May 12, 2022
* Pass ShipPartMeter as pointer, as NewMeterValue uses GetMeter instead of GetPartMeter
* Pass Meter as pointer to NewMeterValue
@geoffthemedio geoffthemedio added the status:resolved The Issue was resolved, either by answering properly or fixing the underlying bug. label May 12, 2022
@Vezzra Vezzra added this to the v0.5 milestone May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:bug The Issue/PR describes or solves a perceived malfunction within the game. component:internal The Issue/PR deals with any project component that has no explicit `component` label. status:resolved The Issue was resolved, either by answering properly or fixing the underlying bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants