1
0
forked from mirrors/0ad

Never change the names in the "Player Name" column

The intent of this branch was to not change the names when a saved game
is loaded. So that one can see who was where in the saved game.
It was implemented wrong: The names didn't change when no savegame was
loaded and changed when a saved game was loaded.

This commit make the soved game case and no saved game case consistent.

Defect introduced in b90280855f.
This commit is contained in:
phosit
2024-12-29 11:04:22 +01:00
committed by phosit
parent 5c860c3121
commit fb9b02a9ba
@@ -8,6 +8,7 @@ PlayerSettingControls.PlayerName = class PlayerName extends GameSettingControl
this.playerName = Engine.GetGUIObjectByName("playerName[" + this.playerIndex + "]");
g_GameSettings.playerCount.watch(() => this.render(), ["nbPlayers"]);
g_GameSettings.playerName.watch(this.render.bind(this), ["values"]);
this.guid = undefined;
this.render();
@@ -29,15 +30,14 @@ PlayerSettingControls.PlayerName = class PlayerName extends GameSettingControl
render()
{
let name = this.guid && this.isSavedGame ?
g_PlayerAssignments[this.guid].name : g_GameSettings.playerName.values[this.playerIndex];
let name = g_GameSettings.playerName.values[this.playerIndex];
if (g_IsNetworked)
{
let status = this.guid ? g_PlayerAssignments[this.guid].status : this.ReadyTags.length - 1;
name = setStringTags(name, this.ReadyTags[status]);
}
else if (name && !this.guid)
else if (name)
{
name = translate(name);
}