Ticket #45577

sdl2: Happiness dialog crash in a ruleset without EFT_CONTENT buildings

오픈 날짜: 2022-09-05 13:49 마지막 업데이트: 2022-09-18 17:32

Reporter:
소유자:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
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
댓글 올리기

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
  • 소유자 Update from (None) to cazfi
  • Resolution Update from None to Accepted
  • Milestone Update from (None) to 3.0.4 (closed)
댓글 올리기

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
  • Status Update from Open to Closed
  • Resolution Update from Accepted to Fixed

Edit

Please login to add comment to this ticket » Login