ui/phase-17: ship-class CRUD without calc
Phase 17 lights up the ship-class table and designer active views, extends the order-draft pipeline with createShipClass and removeShipClass commands, and projects pending Save/Delete actions through applyOrderOverlay so the table reflects the player's intent before auto-sync lands. The plan is corrected in the same patch: per game/rules.txt, ship classes are designed once and cannot be edited — the engine has no Update command, so the UI exposes only Create + Delete. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,8 @@ import {
|
||||
CommandPlanetRename,
|
||||
CommandPlanetRouteRemove,
|
||||
CommandPlanetRouteSet,
|
||||
CommandShipClassCreate,
|
||||
CommandShipClassRemove,
|
||||
PlanetProduction,
|
||||
PlanetRouteLoadType,
|
||||
UserGamesOrder,
|
||||
@@ -65,11 +67,28 @@ export interface RemoveCargoRouteResultFixture
|
||||
loadType: "COL" | "CAP" | "MAT" | "EMP";
|
||||
}
|
||||
|
||||
export interface CreateShipClassResultFixture extends CommandResultFixtureBase {
|
||||
kind: "createShipClass";
|
||||
name: string;
|
||||
drive: number;
|
||||
armament: number;
|
||||
weapons: number;
|
||||
shields: number;
|
||||
cargo: number;
|
||||
}
|
||||
|
||||
export interface RemoveShipClassResultFixture extends CommandResultFixtureBase {
|
||||
kind: "removeShipClass";
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type CommandResultFixture =
|
||||
| PlanetRenameResultFixture
|
||||
| SetProductionTypeResultFixture
|
||||
| SetCargoRouteResultFixture
|
||||
| RemoveCargoRouteResultFixture;
|
||||
| RemoveCargoRouteResultFixture
|
||||
| CreateShipClassResultFixture
|
||||
| RemoveShipClassResultFixture;
|
||||
|
||||
export function buildOrderResponsePayload(
|
||||
gameId: string,
|
||||
@@ -173,6 +192,29 @@ function encodeItem(builder: Builder, c: CommandResultFixture): number {
|
||||
payloadType = CommandPayload.CommandPlanetRouteRemove;
|
||||
break;
|
||||
}
|
||||
case "createShipClass": {
|
||||
const nameOffset = builder.createString(c.name);
|
||||
inner = CommandShipClassCreate.createCommandShipClassCreate(
|
||||
builder,
|
||||
nameOffset,
|
||||
c.drive,
|
||||
BigInt(c.armament),
|
||||
c.weapons,
|
||||
c.shields,
|
||||
c.cargo,
|
||||
);
|
||||
payloadType = CommandPayload.CommandShipClassCreate;
|
||||
break;
|
||||
}
|
||||
case "removeShipClass": {
|
||||
const nameOffset = builder.createString(c.name);
|
||||
inner = CommandShipClassRemove.createCommandShipClassRemove(
|
||||
builder,
|
||||
nameOffset,
|
||||
);
|
||||
payloadType = CommandPayload.CommandShipClassRemove;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CommandItem.startCommandItem(builder);
|
||||
CommandItem.addCmdId(builder, cmdIdOffset);
|
||||
|
||||
Reference in New Issue
Block a user