Open backwardsEric opened 2 days ago
On looking at Sil some more, Sil displays "Bleeding %-2d" for cuts when the value is less than 100 and simply prints "Mortal wound" without a value if the value is greater than 100. So it looks like the change-grade directive in player_timed.txt should have a third parameter specifying the number of digits to use for the value and if that number of digits is not positive, the name is used without a value.
These are some observations from looking at the code. I haven't verified if they impact actual gameplay:
The logic in player_set_timed() to determine which of the change-inc messages to use looks like it could trigger a NULL pointer dereference if the increase is greater than any level set by the change-inc directives for the effect. Instead of the "while (change > inc->max) { inc = inc->next; }" loop currently used, I'd use "while (change > inc->max && inc->next) { inc = inc->next; }".
How effects with change-grade are displayed in the status line seems strange. In player_timed.txt, those effects do not specify any grades, so timed_effects[i].grade will be NULL in ui-display.c's prt_tmd(). Because of that, nothing is ever displayed for the effect and the contents of c_grade for the effect are not used outside of the initialization in parse_player_timed_change_grade(), cleanup in cleanup_player_timed(), and an assertion in player_set_timed(). To match what Sil does, it looks like inner part of the loop over timed effects in prt_tmd() should be: