Improve dai_wants_defender_against
The obvious patch filed. I did not mention much reduction in fleet, but fighters fall dramatically. Probably it's good since there were few really worthy targets for them, Mech Infs are much better.
Wrong patch?
Oh sorry, put the right one.
That should do for S2_6 & S3_0. You will need to implement a different one for S3_1 & master where fortify is action enablers controlled.
Maybe (you need to check) utype_can_do_action_result(utype, ACTRES_FORTIFY) can do the trick like in get_fortified_defense_power()
Reply To cazfi
That should do for S2_6 & S3_0. You will need to implement a different one for S3_1 & master where fortify is action enablers controlled. Maybe (you need to check) utype_can_do_action_result(utype, ACTRES_FORTIFY) can do the trick like in get_fortified_defense_power()
It should be done over the scramble patch. Or before it maybe.
Reply To ihnatus
Reply To cazfi
Maybe (you need to check) utype_can_do_action_result(utype, ACTRES_FORTIFY) can do the trick like in get_fortified_defense_power()
It should be done over the scramble patch. Or before it maybe.
If you can update the scramble patch soon, it could go forward already, while this patch targeted to stable branches needs anyway to wait that branches are again opened for normal bug fixes (after upcoming 3.0.0-beta1 and 2.6.4 releases)
Reply To cazfi
this patch targeted to stable branches needs anyway to wait that branches are again opened for normal bug fixes (after upcoming 3.0.0-beta1 and 2.6.4 releases)
Both of those have now been released.
Any progress on this?
Was diatracted, currently no progress. Maybe a virtual unit must be built here to get all the effects?..
Reply To ihnatus
Maybe a virtual unit must be built here to get all the effects?..
Haven't checked the code, but that's likely.
A master patch, based on #46046.
On a tree with this applied, clang analyzer gives (from shake_efvs() added by this patch):
../../../src/common/effects.c:1003:7: warning: Address of stack memory associated with local variable 'rn' is still referred to by the stack variable 'shaken' upon returning to the caller. This will be a dangling reference [core.StackAddressEscape]
../../../src/common/effects.c:1004:10: warning: Address of stack memory associated with local variable 'rn' is still referred to by the stack variable 'shaken' upon returning to the caller. This will be a dangling reference [core.StackAddressEscape]
Splitting the inner part to #47598. Likely, all dependencies go there.
Not tested but something like this goes over #47671.
Even with those simple fortification rules we have in 2.6, the function in aitech.c does not look at if the unit considered for defense gets 1.5x bonus in the city.
Also, maybe we should look also at "Veteran_Build" effect and make some cumulation between wants of a building and a unit it empowers, but it is assessed at least at some part elsewhere.