Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Unify name suffix and profession

Open ShnitzelX2 opened this issue 1 year ago • 0 comments

Summary

Interface "Unify name suffix and profession"

Purpose of change

Closes #72138

Currently for NPCs, we append "name_suffix" directly onto Character::name immediately upon reading it, which isn't great; that means the name of the refugee merchant is "Smokes, merchant". Only NPCs with "name_suffix" work like this, as opposed to randomly generated NPCs.

Describe the solution

  1. Separate name functions into three different functions:
  • get_name() remains the same, getting only a character's name or nickname
  • disp_name() returns a character's name with a suffix appended. That suffix is: npc_class if exists, or a (custom) profession.
  • disp_profession() returns the a character's suffix.
  1. Adds a "temp_suffix" field to npc_class that fills Character::custom_profession. Upon recruiting an NPC, custom_profession is cleared. I didn't feel a need to add a new effect that does this, since follow is a built-in effect already.

  2. Capitalize the refugee suffixes, move "beggar" to "temp_suffix" (do the same for mi-go prisoners), give the refugee beggars custom "name_suffix" accurate to their backgrounds.

Describe alternatives you've considered

Either suffixes should display for all NPCs, or for none of them. I opted for all because I think it makes NPCs more interesting and easier to identify, but it would be trivial to disable suffixes in any context.

Testing

Passed all tests locally.

Additional context

Profession display still works image

Suffixes still look normal image image

Upon recruit, beggar suffix changes image

Doing an activity image

ShnitzelX2 avatar Oct 18 '24 17:10 ShnitzelX2