From 987753c0f1fcab5829af6611e12b5357f9abec04 Mon Sep 17 00:00:00 2001 From: aNNiMON Date: Sat, 16 Mar 2024 23:37:33 +0200 Subject: [PATCH] Fix resetting characters name color on meet command --- src/view/model/Characters.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/view/model/Characters.ts b/src/view/model/Characters.ts index e47c5f6..d3cd517 100644 --- a/src/view/model/Characters.ts +++ b/src/view/model/Characters.ts @@ -20,7 +20,17 @@ export class Characters { return this.names[shortName]; } - public setName(shortName: string, fullName: string, color: number = Characters.DEFAULT_COLOR): boolean { + public setName(shortName: string, fullName: string): boolean { + if (shortName in this.names) { + const info = this.names[shortName]; + info.name = fullName; + } else { + this.names[shortName] = new NameInfo(fullName, Characters.DEFAULT_COLOR); + } + return shortName in this.names; + } + + public setNameW(shortName: string, fullName: string, color: number = Characters.DEFAULT_COLOR): boolean { if (shortName in this.names) { const info = this.names[shortName]; info.name = fullName;