#3435 closed defect (fixed)
[PATCH] Chat & Developer overlay broken in visual replay
Reported by: | elexis | Owned by: | mimo |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 19 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
If you replay a match from the menu and then type something into the chat or try to open the developers overlay, errors about missing PlayerData will appear.
It would be nice to fix it, since the developers overlay allows to change the perspective.
Chat Error:
WARNING: JavaScript warning: gui/session/messages.js line 403 reference to undefined property msg.player WARNING: JavaScript warning: gui/session/messages.js line 228 reference to undefined property g_Players[player] ERROR: JavaScript error: gui/session/messages.js line 228 TypeError: g_Players[player] is undefined getUsernameAndColor@gui/session/messages.js:228:6 addChatMessage@gui/session/messages.js:403:3 submitChatInput@gui/session/messages.js:374:56 __eventhandler119 (press)@chatInput press:0:1
Developers Overlay error:
ERROR: JavaScript error: gui/session/messages.js line 228 TypeError: g_Players[player] is undefined getUsernameAndColor@gui/session/messages.js:228:6 addChatMessage@gui/session/messages.js:403:3 submitChatDirectly@gui/session/messages.js:346:56 toggleDeveloperOverlay@gui/session/menu.js:692:3 __eventhandler102 (press)@devCommands press:0:1
Thanks ffm for informing me!
Attachments (1)
Change History (8)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Ok guys, here is what happens:
Visual Replay Autostart
The visual-replay-auotstart doesn't provide initData
for init(initData, hotloadData)
defined in session.js
. That's the reason why the default player assignment used in singleplayer (defined in session.js
) is used:
var g_PlayerAssignments = { "local": { "name": translate("You"), "player": 1 } };
That's why the visualreplay started from command line doesn't break chat.
Visual Replay Menu
The replay menu however offers initData
in reallyStartVisualReplay()
, defined in replay_actions.js
and it explicitly states:
playerAssignments": {}
which is why it breaks.
Both cases should be fixed, since the player in autostart-replays isn't player 1, but observer (-1). We switch the active player using in AutostartVisualReplay()
of GameSetup.cpp
after creating the game, but that change doesn't make it into the player assignments. A consequence of that is that if you type chat in autostart-visualreplay, it gets printed in blue (the default color of player 1). It should be white for the spectator. There might be more hidden bugs like that, so we should fix it too.
comment:4 by , 9 years ago
Component: | Core engine → UI & Simulation |
---|---|
Keywords: | patch review added |
Milestone: | Backlog → Alpha 19 |
Summary: | Chat & Developer overlay broken in visual replay started from menu → [patch] Chat & Developer overlay broken in visual replay |
a19 since mimo is interested in commiting this.
comment:7 by , 8 years ago
Summary: | [patch] Chat & Developer overlay broken in visual replay → [PATCH] Chat & Developer overlay broken in visual replay |
---|
The cause of this is the player assignments being wrong.
For visual replay menu, they are
{}
, while in the autostart version they are{"local":{"name":"You","player":1}}
.In a multiplayergame as observer, they are
{"C295F113566BEBFD":{"name":"elexis","player":-1,"status":1}}
.So ideally that should be
{"local":{"name":"You","player":-1}}
in both cases. Not sure right now what the status property meant, maybe online/offline.