A function to calculate effect expected value
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.
- 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
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?
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.
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.
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.
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.