From 3ad2a0c7b1d54279a36c2013f74a27ce0627ea0d Mon Sep 17 00:00:00 2001 From: Mari Date: Thu, 8 Jul 2021 22:22:33 -0400 Subject: [PATCH] Change the client to use XID instead of GUID --- client/src/reducers/ServerReducer.ts | 4 ++-- client/src/state/HexMap.ts | 10 +++++----- client/src/ui/debug/ConsoleConnection.tsx | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client/src/reducers/ServerReducer.ts b/client/src/reducers/ServerReducer.ts index 9cd3d62..637cde5 100644 --- a/client/src/reducers/ServerReducer.ts +++ b/client/src/reducers/ServerReducer.ts @@ -71,7 +71,7 @@ function serverHelloReducer(oldState: AppState, action: ServerHelloAction): AppS unsentActions: oldState.network.pendingActions }) // TODO: The connection state should be AWAITING_HELLO and the special message should be our Hello - // TODO: Destroy all pending actions if the server's map has a different GUID from ours. + // TODO: Destroy all pending actions if the server's map has a different XID from ours. return { ...oldState, localState: newLocalState, @@ -98,7 +98,7 @@ function serverRefreshReducer(oldState: AppState, action: ServerRefreshAction): unsentActions: oldState.network.pendingActions }) // TODO: The connection state should be AWAITING_REFRESH and the special message should be our Refresh - // TODO: Destroy all pending actions if the server's map has a different GUID from ours. + // TODO: Destroy all pending actions if the server's map has a different XID from ours. return { ...oldState, localState: newLocalState, diff --git a/client/src/state/HexMap.ts b/client/src/state/HexMap.ts index 0792f66..c2e38d9 100644 --- a/client/src/state/HexMap.ts +++ b/client/src/state/HexMap.ts @@ -65,13 +65,13 @@ export interface HexMap { */ readonly lineCells: readonly HexLine[] /** - * A unique identifier for this map. Lets the client know when it is connecting to a different map with the same - * name as this one, and its old map has been destroyed. + * A unique identifier in https://github.com/rs/xid format for this map. Lets the client know when it is connecting + * to a different map with the same name as this one, and its old map has been destroyed. */ - readonly guid: string + readonly xid: string } -export function initializeMap({lines, cells_per_line, displayMode, guid}: {lines: number, cells_per_line: number, displayMode: HexMapRepresentation, guid: string}): HexMap { +export function initializeMap({lines, cells_per_line, displayMode, xid}: {lines: number, cells_per_line: number, displayMode: HexMapRepresentation, xid: string}): HexMap { const lineCells: HexLine[] = []; const emptyLine: HexCell[] = []; for (let cell = 0; cell < cells_per_line; cell += 1) { @@ -85,7 +85,7 @@ export function initializeMap({lines, cells_per_line, displayMode, guid}: {lines cells_per_line, displayMode, lineCells, - guid + xid } } diff --git a/client/src/ui/debug/ConsoleConnection.tsx b/client/src/ui/debug/ConsoleConnection.tsx index b877c3c..5e99f39 100644 --- a/client/src/ui/debug/ConsoleConnection.tsx +++ b/client/src/ui/debug/ConsoleConnection.tsx @@ -75,10 +75,10 @@ export class ConsoleConnection { }) } - public sendHello({color = "#0000FF", displayMode = "ROWS", guid = "TotallyCoolGUID", lines = 10, cells = 10}: { + public sendHello({color = "#0000FF", displayMode = "ROWS", xid = "TotallyCoolXID", lines = 10, cells = 10}: { color?: string, displayMode?: string, - guid?: string, + xid?: string, lines?: number, cells?: number } = {}): void { @@ -90,7 +90,7 @@ export class ConsoleConnection { lines, cells_per_line: cells, displayMode: orientationFromString(displayMode), - guid + xid }), user: {activeColor: color} }