-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect format specifier usage in obj_examine_func() #187
base: main
Are you sure you want to change the base?
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
MessageListItem v63; | ||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -406,21 +418,17 @@ int obj_examine_func(Object* critter, Object* target, void (*fn)(char* string)) | |||
|
|||
snprintf(formattedText, sizeof(formattedText), v66.text, hpMessageListItem.text); | |||
} else { | |||
// %s %s | |||
v66.num = 521 + v12; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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