Skip to content

There can be multiple families alive with the same last name #292

Description

@TanyaPegasus

It shouldn't be possible for someone to give themself an Eve name that already exists in the server. An example showing this is possible is the recent Eve River who was alive 2 days later than one who had a 30 day long lineage:

Image

I suspect the issue stems from the following section of code:

OneLife/server/server.cpp

Lines 11421 to 11450 in f6d196e

char *getUniqueCursableName( char *inPlayerName, char *outSuffixAdded,
char inIsEve ) {
char dup = isNameDuplicateForCurses( inPlayerName );
if( ! dup ) {
*outSuffixAdded = false;
if( inIsEve ) {
// make sure Eve doesn't have same last name as any living person
char firstName[99];
char lastName[99];
sscanf( inPlayerName, "%s %s", firstName, lastName );
for( int i=0; i<players.size(); i++ ) {
LiveObject *o = players.getElement( i );
if( ! o->error && o->familyName != NULL &&
strcmp( o->familyName, lastName ) == 0 ) {
dup = true;
break;
}
}
}
return inPlayerName;
}

If there is still a player alive with the exact first and last name (eg Eve River), then this section gets skipped, but if the family has been alive long enough, it will test if there are other people in the server with the same family name. The return statement runs no matter what the result of that check is, so even if dup is set to true, the return statement is still executed. The code doesn't get the chance continue past that point and find a new unique name.

I suggest that replacing the return statement with the following code may resolve the issue:

if( ! dup ) {
  return inPlayerName;
}

Then it would check if dup is still false, after running the check, and only be executed if it hasn't been changed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions