任务单 #41781

Improve dai_wants_defender_against

开放日期: 2021-03-14 06:58 最后更新: 2024-02-09 15:45

报告人:
属主:
类型:
状态:
开启 [Owner assigned]
组件:
里程碑:
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
文件:
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.

任务单历史 (3/36 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 Bugs to Patches
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

编辑

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » 登录名