任务单 #47671

A function to calculate effect expected value

开放日期: 2023-03-24 04:10 最后更新: 2023-04-10 18:02

报告人:
属主:
类型:
状态:
关闭
组件:
里程碑:
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
Fixed
文件:
4

Details

A both simpler and more effective alternative for #47598 to be used in upcoming AI patches. Actually, a tiny method that gets a separate patch just for clearness.

任务单历史 (3/14 Histories)

2023-03-24 04:10 Updated by: ihnatus
  • New Ticket "A function to calculate effect expected value" created
2023-03-24 05:41 Updated by: ihnatus
评论

Maybe also add a prototype macro for the callback? Like, we mostly consider all requirements independent, so for different callbacks all that we rewrite is a switch that sets a probability for some kinds of requirements, and outside of it the probabbility is 1. - prob -ed if !preq->present, iteration stops if it's 0., and otherwise the result is multiplied on it... Just I doubt it will be within "better simpler than clever" paradigm, I'd better copypaste in the two cases I need.

2023-03-24 13:04 Updated by: cazfi
评论

- Does not apply to any branch
- Maybe make 'weighter' nonnull -parameter. You already assert runtime that it's not NULL, but it would be good if also static analyzers could catch problems in some cases

2023-03-24 13:08 Updated by: cazfi
  • 组件 Update from AI to General
2023-03-24 18:03 Updated by: ihnatus
评论

Reply To cazfi

- Does not apply to any branch

Yup, I based on #47598

- Maybe make 'weighter' nonnull -parameter. You already assert runtime that it's not NULL, but it would be good if also static analyzers could catch problems in some cases

Sorry, what does it mean, should I write somewhere NULL != weighter?

2023-03-24 18:16 Updated by: cazfi
评论

Reply To ihnatus

Reply To cazfi

- Does not apply to any branch

Yup, I based on #47598

- Maybe make 'weighter' nonnull -parameter. You already assert runtime that it's not NULL, but it would be good if also static analyzers could catch problems in some cases

Sorry, what does it mean, should I write somewhere NULL != weighter?

Give the function nonnull -attribute. See, e.g., terrain_extra_removal_time() on terrain.h for an example (numbers refer to which parameters the attribute applies to). That attribute tells the compiler (and other tools) that the *caller* must never pass NULL there. It gives a compile time warning (-> error with -Werror) if the compiler heuristics see that a call with NULL might happen.

2023-03-25 15:55 Updated by: cazfi
评论

Reply To ihnatus

Reply To cazfi

- Does not apply to any branch

Yup, I based on #47598

I thought that it was left on sidetrack for now. Obviously, either this one needs to be rebased, or #47598 made active to get it in first.

2023-04-08 16:37 Updated by: cazfi
  • 属主 Update from (无) to cazfi
  • 处理结果 Update from to Accepted
评论

Reply To cazfi

this one needs to be rebased

Attached. Applies to S3_1/S3_2/main and I consider this commit candidate for those (will commit to those branches if no objections)

If you still want this to S3_0, you need to backport it.

2023-04-09 03:19 Updated by: ihnatus
评论

Made a patch for 3.0 though don't know will I make a use of it.

We likely talked about using fc__attributes? Inserted them into your patch.

(Edited, 2023-04-09 03:20 Updated by: ihnatus)
2023-04-10 18:02 Updated by: cazfi
  • 状态 Update from 开启 to 关闭
  • 处理结果 Update from Accepted to Fixed

编辑

Please login to add comment to this ticket » 登录名