[Titles] Cleanup titles, title suffix, and last name methods. (#2174)

* [Titles] Cleanup titles, title suffix, and last name methods.
- Use strings instead of const chars*.
- Add optional parameter to SetAATitle in Lua so you can save to the database similar to Perl.
- Cleanup #lastname command.
- Cleanup #title command.
- Cleanup #titlesuffix command.

* Update npc.cpp
This commit is contained in:
Kinglykrab
2022-05-19 20:15:44 -04:00
committed by GitHub
parent 6398381c44
commit 0e96099b3d
19 changed files with 129 additions and 109 deletions
+4 -6
View File
@@ -1625,15 +1625,13 @@ XS(XS_NPC_RemoveDefensiveProc) {
XS(XS_NPC_ChangeLastName); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_ChangeLastName) {
dXSARGS;
if (items < 1 || items > 2)
Perl_croak(aTHX_ "Usage: NPC::ChangeLastName(THIS, string name)"); // @categories Script Utility
if (items != 2)
Perl_croak(aTHX_ "Usage: NPC::ChangeLastName(THIS, string last_name)"); // @categories Script Utility
{
NPC *THIS;
char *name = nullptr;
std::string last_name = (std::string) SvPV_nolen(ST(1));
VALIDATE_THIS_IS_NPC;
if (items > 1) { name = (char *) SvPV_nolen(ST(1)); }
THIS->ChangeLastName(name);
THIS->ChangeLastName(last_name);
}
XSRETURN_EMPTY;
}