Ticket #41781

Improve dai_wants_defender_against

Eröffnet am: 2021-03-14 06:58 Letztes Update: 2024-10-11 09:22

Auswertung:
Verantwortlicher:
Typ:
Status:
Offen [Owner assigned]
Komponente:
Meilenstein:
(Keine)
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Keine
Datei:
3

Details

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.

Ticket-Verlauf (3/38 Historien)

2021-03-14 06:58 Aktualisiert von: ihnatus
  • New Ticket "Improve dai_wants_defender_against" created
2021-03-14 07:38 Aktualisiert von: ihnatus
  • File 2.6-fortify-in-def-wants.patch (File ID: 6262) is attached
2021-03-14 07:39 Aktualisiert von: ihnatus
Kommentar

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.

2021-03-14 17:16 Aktualisiert von: cazfi
Kommentar

Wrong patch?

2021-03-14 21:11 Aktualisiert von: ihnatus
  • File 2.6-fortify-in-def-wants.patch (File ID: 6262) is deleted
2021-03-14 21:12 Aktualisiert von: ihnatus
Kommentar

Oh sorry, put the right one.

2021-03-15 01:11 Aktualisiert von: cazfi
Kommentar

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()

2021-03-15 04:11 Aktualisiert von: ihnatus
Kommentar

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.

2021-03-15 04:21 Aktualisiert von: cazfi
Kommentar

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)

2021-03-31 12:35 Aktualisiert von: cazfi
2021-04-03 14:28 Aktualisiert von: cazfi
Kommentar

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.

2021-06-02 23:13 Aktualisiert von: cazfi
2021-09-26 11:36 Aktualisiert von: cazfi
Kommentar

Any progress on this?

2021-10-07 08:18 Aktualisiert von: ihnatus
Kommentar

Was diatracted, currently no progress. Maybe a virtual unit must be built here to get all the effects?..

2021-12-10 08:05 Aktualisiert von: cazfi
2022-02-03 13:02 Aktualisiert von: cazfi
2022-04-13 20:29 Aktualisiert von: cazfi
Kommentar

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.

2022-04-13 20:29 Aktualisiert von: cazfi
2022-06-11 21:49 Aktualisiert von: cazfi
2022-08-05 08:54 Aktualisiert von: cazfi
2022-09-23 16:10 Aktualisiert von: cazfi
2022-11-08 04:58 Aktualisiert von: ihnatus
Kommentar

A master patch, based on #46046.

2022-12-04 17:17 Aktualisiert von: cazfi
2022-12-05 16:19 Aktualisiert von: cazfi
Kommentar

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]

if (mav) {

../../../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]

*mav += shake_efvs_rec(efvs, n_efvs, reqs, rs, n_rs, TRUE);
2023-01-05 10:44 Aktualisiert von: cazfi
  • Verantwortlicher Update from (Keine) to ihnatus
2023-02-02 06:30 Aktualisiert von: cazfi
2023-02-20 03:18 Aktualisiert von: cazfi
  • Typ Update from Fehler to Patches
2023-03-19 05:25 Aktualisiert von: ihnatus
Kommentar

Splitting the inner part to #47598. Likely, all dependencies go there.

2023-04-04 03:06 Aktualisiert von: cazfi
2023-04-04 06:32 Aktualisiert von: ihnatus
Kommentar

Not tested but something like this goes over #47671.

2023-06-30 21:06 Aktualisiert von: cazfi
2023-11-10 15:39 Aktualisiert von: cazfi
2024-02-09 15:45 Aktualisiert von: cazfi
2024-08-17 09:51 Aktualisiert von: cazfi
2024-10-11 09:22 Aktualisiert von: cazfi

Bearbeiten

Please login to add comment to this ticket » Anmelden