Fix incorrect format specifier usage in obj_examine_func() - #187
Conversation
obj_examine_func():408-424 has a redundant format specifier. v66 provides a "%s %s" format specifier for objects v63 && hpMessageListItem, however v63 already provides a format specifier in the form of "GENDER looks: %s" for use by hpMessageListItem. Technically the most correct fix is to use v63 to create a secondary format specifier like how src/game/protinst.cc:314 does it, However it is my belief that this will cause a regression if the target is not crippled because MSG_ID 521 is "%s %s." which will append a secondary period onto the end of the string. Modifed obj_examine_func() comments for added clarity
| // 522: He looks: %s. | ||
| // 523: She looks: %s. | ||
| // 524: It looks: %s. | ||
| v63.num = 522 + stat_level(target, STAT_GENDER); |
There was a problem hiding this comment.
you can add a check here for critter_body_type(target) != BODY_TYPE_BIPED and then set num to 524 - "It looks: %s." See example above at line 280 of unmodified file.
| snprintf(formattedText, sizeof(formattedText), v66.text, hpMessageListItem.text); | ||
| } else { | ||
| // %s %s | ||
| v66.num = 521 + v12; |
There was a problem hiding this comment.
I've found no correct way to use messages 521 - %s %s. and 519 - %s %s .
Seems like the first %s is for He/She/It looks: and the second %s is for examine text hpMessageListItem, but the messages file doesn't have separate messages for the first one - only with format parameter and a dot.
So, I think, without changing messages file it is not possible to correctly format the text taking into account if the critter is crippled or not.
The version of Fallout that is delivered through Xbox app has the same functionality as your fix.
Fixes #162
obj_examine_func():408-424 has a redundant format specifier. v66 provides a "%s %s" format specifier for objects v63 && hpMessageListItem, however v63 already provides a format specifier in the form of "GENDER looks: %s" for use by hpMessageListItem. Technically the most correct fix is to use v63 to create a secondary format specifier like how src/game/protinst.cc:314 does it, However it is my belief that this will cause a regression if the target is not crippled because MSG_ID 521 is "%s %s." which will append a secondary period onto the end of the string.
Modifed obj_examine_func() comments for added clarity