Skip to content

Camera position starts at the wrong spot when player has a non ASCII character in their display name #2874

Description

@MrS-ibra

Prerequisites

  • I have searched for similar issues and confirmed this is not a duplicate

Game Version

  • Command & Conquer Generals
  • Command & Conquer Generals: Zero Hour
  • Other (please specify below)

Bug Description

If a non host player has a non ASCII character in their display name, their camera position will be pointed at the wrong spot upon game start.
This happens because when a match starts, the game needs to figure out which slot belongs to the local player so it can point the starting camera at their base. It does this in a fragile way by:

  1. Taking the local players display name
  2. Converting it to ASCII
  3. Searching all slots for a name that matches the converted result (which possibly means this can cause issues if two players have the same name, and if this is done the same way in other places like the actual start position of a CC, but I have not tested)
			AsciiString slotNameAscii;
			slotNameAscii.translate(slot->getName());
			if (slot->isHuman() && game->getSlotNum(slotNameAscii) == game->getLocalSlotNum()) {
				localSlot = i;
			}

localSlot never gets updated, and stays at 0 which would be whoever is on slot 0 (the host) when the game needs to decide where to start:

GameSlot* slot = game->getSlot(localSlot);
Int startPos = slot->getStartPos();
startingCamName.format("Player_%d_Start", startPos + 1);

Reproduction Steps

  1. Start the game with the non host client having a non-ascii character in the name
  2. Camera start position will be pointed at the host's base

Additional Context

  • This is a retail bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething is not working right, typically is user facing⚠️ TriageIssues requiring initial review and prioritization

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions