diff --git a/RP_L4/RPL4FE.cpp b/RP_L4/RPL4FE.cpp index 8628349..f96ba3c 100644 --- a/RP_L4/RPL4FE.cpp +++ b/RP_L4/RPL4FE.cpp @@ -2051,6 +2051,12 @@ const char * return gLastPilotNamesCsv; } +const char * + RPL4FrontEnd_Callsign() +{ + return gLastPilotName; +} + int RPL4FrontEnd_LastLaunchMode() { diff --git a/RP_L4/RPL4FE.h b/RP_L4/RPL4FE.h index 1ad3643..11c50c1 100644 --- a/RP_L4/RPL4FE.h +++ b/RP_L4/RPL4FE.h @@ -34,6 +34,15 @@ int const char * RPL4FrontEnd_LastPilotNames(); +// +// The callsign the player typed on the setup screen (persisted in +// pilot.cfg). The lobby publishes this as the member name: what somebody +// writes in the box is what the room and the race should call them. +// Empty, or still the untouched default, when they have never set one. +// +const char * + RPL4FrontEnd_Callsign(); + // How the last Run() ended: a plain race, hosting a network race (the // console marshals the other pods), or entering one as a member pod // (the lobby owner's console marshals us; no local egg, no console). diff --git a/RP_L4/RPL4LOBBY.cpp b/RP_L4/RPL4LOBBY.cpp index 549065d..48d5729 100644 --- a/RP_L4/RPL4LOBBY.cpp +++ b/RP_L4/RPL4LOBBY.cpp @@ -165,8 +165,27 @@ namespace sprintf(value, "%d", SteamNetTransport_GetFakeGamePort()); SteamMatchmaking()->SetLobbyMemberData(gLobby, "gp", value); + // + // The name in the room is the CALLSIGN from the setup screen, not + // the Steam persona. Publishing the persona meant the box a player + // types their name into had no effect on anything they could see - + // and because it never came from a file, wiping the install + // directory did not shake it loose either. + // + // The persona is kept as the fallback for somebody who has never + // set a callsign: better to appear as yourself than as "Pilot". + // char name[32]; - SanitizeName(SteamFriends()->GetPersonaName(), name, sizeof(name)); + const char *callsign = RPL4FrontEnd_Callsign(); + if (callsign != NULL && callsign[0] != '\0' && + strcmp(callsign, "Pilot") != 0) + { + SanitizeName(callsign, name, sizeof(name)); + } + else + { + SanitizeName(SteamFriends()->GetPersonaName(), name, sizeof(name)); + } SteamMatchmaking()->SetLobbyMemberData(gLobby, "nm", name); char vehicle[24], color[16], badge[24];