Change the client to use XID instead of GUID

main
Mari 3 years ago
parent bd714aa1e8
commit 3ad2a0c7b1
  1. 4
      client/src/reducers/ServerReducer.ts
  2. 10
      client/src/state/HexMap.ts
  3. 6
      client/src/ui/debug/ConsoleConnection.tsx

@ -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,

@ -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
}
}

@ -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}
}

Loading…
Cancel
Save