Incidencia #45577

sdl2: Happiness dialog crash in a ruleset without EFT_CONTENT buildings

Abrir Fecha: 2022-09-05 13:49 Última actualización: 2022-09-18 17:32

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
2

Details

Looking at clang analyzer warning.

sdl2-client redraw_happiness_city_dialog() has "surf = NULL;" until it finds a building providing EFT_MAKE_CONTENT effect. If there's no such a building, surf will still be NULL at: "dest.x = city_window->size.x + adj_size(187) - surf->w - adj_size(2);"

Ticket History (3/6 Histories)

2022-09-05 13:49 Updated by: cazfi
  • New Ticket "sdl2: Happiness dialog crash in a ruleset without EFT_CONTENT buildings" created
2022-09-05 23:12 Updated by: cazfi
Comentario

That code is broken in general.

First it gets a list of effects of certain type (e.g. "Make Content") active on the city. So far all good. But then when it iterates over that list, it looks for the effect type of each. That's of course always the very type that was the criteria for constructing the list. Then it looks what would be the first building in the ruleset, not necessarily even present in the city, to provide such an effect. End result is that if ruleset has buildigs a, b, c, and d providing "Make Content" effect and the city has built b, c, and d, the code would draw three times icon of a.

2022-09-05 23:50 Updated by: cazfi
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
  • Hito Update from (Ninguno) to 3.0.4 (cerrado)
Comentario

Will push S3_0 version to S2_6 too. It didn't apply to sdl-client, and porting seemed too much work for a deprecated client of an officially EOL branch.

2022-09-18 17:32 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