Incidencia #47671

A function to calculate effect expected value

Abrir Fecha: 2023-03-24 04:10 Última actualización: 2023-04-10 18:02

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
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.

Ticket History (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
Comentario

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
Comentario

- 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
  • Componente Update from AI to General
2023-03-24 18:03 Updated by: ihnatus
Comentario

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
Comentario

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
Comentario

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
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
Comentario

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
Comentario

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
  • Estado Update from Open to Cerrado
  • Resolución Update from Accepted to Fixed

Editar

Please login to add comment to this ticket » Entrar