待辦事項 #41781

Improve dai_wants_defender_against

啟用日期: 2021-03-14 06:58 最後更新: 2024-10-11 09:22

回報者:
負責人:
類型:
狀態:
開啟 [Owner assigned]
元件:
里程碑:
(無)
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
檔案:
3

細節

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 History (3/38 Histories)

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

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 Updated by: cazfi
評語

Wrong patch?

2021-03-14 21:11 Updated by: ihnatus
  • File 2.6-fortify-in-def-wants.patch (File ID: 6262) is deleted
2021-03-14 21:12 Updated by: ihnatus
評語

Oh sorry, put the right one.

2021-03-15 01:11 Updated by: 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()

2021-03-15 04:11 Updated by: ihnatus
評語

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 Updated by: cazfi
評語

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 Updated by: cazfi
2021-04-03 14:28 Updated by: cazfi
評語

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 Updated by: cazfi
2021-09-26 11:36 Updated by: cazfi
評語

Any progress on this?

2021-10-07 08:18 Updated by: ihnatus
評語

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

2021-12-10 08:05 Updated by: cazfi
2022-02-03 13:02 Updated by: cazfi
2022-04-13 20:29 Updated by: cazfi
評語

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 Updated by: cazfi
2022-06-11 21:49 Updated by: cazfi
2022-08-05 08:54 Updated by: cazfi
2022-09-23 16:10 Updated by: cazfi
2022-11-08 04:58 Updated by: ihnatus
評語

A master patch, based on #46046.

2022-12-04 17:17 Updated by: cazfi
2022-12-05 16:19 Updated by: cazfi
評語

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 Updated by: cazfi
  • 負責人 Update from (無) to ihnatus
2023-02-02 06:30 Updated by: cazfi
2023-02-20 03:18 Updated by: cazfi
  • 類型 Update from 問題回報 to 修補檔案
2023-03-19 05:25 Updated by: ihnatus
評語

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

2023-04-04 03:06 Updated by: cazfi
2023-04-04 06:32 Updated by: ihnatus
評語

Not tested but something like this goes over #47671.

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

編輯

Please login to add comment to this ticket » 登入