Added 2 else if's in npctalk.cpp to check for blindness, and if blind… #56917
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Bugfixes "Player no longer able to look_at or size_up when is_blind returns true."
Purpose of change
Fixes #55803, to prevent the player from viewing npcs once blinded, whether blindfolds were used or otherwise. Originally, if the player interacted with an npc and looked at them while wearing a blindfold, they get the relevant statistics, which shouldn't happen without sight.
Describe the solution
Added a blindness check for the 2 else ifs in "npctalk.cpp" to display info, and added another 2 else ifs below them to return text if the player was blind, notifying them of that status. So, if the player looks at an npc when blindfolded, they get "You cannot look at characters when blinded" instead.
Describe alternatives you've considered
Once I found the is_blind() method, I knew I just needed to put that check where and npc was inspected. I considered adding the check to faction_camp.cpp, and npctalk_funcs, as they both have a place where npcs are looked at, but frankly I didn't know how to test for faction_camp in-game, and npctalk_funcs's uses are not familiar to me, as adding the check there did nothing to the standard interaction with an npc.
Testing
I ran the unit tests, first off. Then I tried looking at npcs without a blindfold, could see stats. I tried again after wearing a blindfold, got the message I put it instead. Took off the blindfold, and I could see stats again. I suggest trying it in other situations where the player can inspect an npc, I am not completely familiar with all the possible interactions yet. I also ran the file "npctalk.cpp" through astyle in the cmd as requested, using the options available in CODE_STYLE.md
Additional context