diff --git a/server/data.db b/server/data.db index f8d7fee..67ec2da 100644 Binary files a/server/data.db and b/server/data.db differ diff --git a/server/data.db-shm b/server/data.db-shm index 7f47916..09a33a3 100644 Binary files a/server/data.db-shm and b/server/data.db-shm differ diff --git a/server/data.db-wal b/server/data.db-wal index db10613..8a23795 100644 Binary files a/server/data.db-wal and b/server/data.db-wal differ diff --git a/server/db.js b/server/db.js index a142670..bbe3357 100644 --- a/server/db.js +++ b/server/db.js @@ -150,6 +150,10 @@ try { if (!lossNames.includes('helicopters')) db.exec('ALTER TABLE combat_losses ADD COLUMN helicopters INTEGER NOT NULL DEFAULT 0') if (!lossNames.includes('submarines')) db.exec('ALTER TABLE combat_losses ADD COLUMN submarines INTEGER NOT NULL DEFAULT 0') if (!lossNames.includes('tanks')) db.exec('ALTER TABLE combat_losses ADD COLUMN tanks INTEGER NOT NULL DEFAULT 0') + if (!lossNames.includes('carriers')) { + db.exec('ALTER TABLE combat_losses ADD COLUMN carriers INTEGER NOT NULL DEFAULT 0') + db.exec('UPDATE combat_losses SET carriers = tanks') + } if (!lossNames.includes('civilian_ships')) db.exec('ALTER TABLE combat_losses ADD COLUMN civilian_ships INTEGER NOT NULL DEFAULT 0') if (!lossNames.includes('airport_port')) db.exec('ALTER TABLE combat_losses ADD COLUMN airport_port INTEGER NOT NULL DEFAULT 0') } catch (_) {} diff --git a/server/seed.js b/server/seed.js index 8fdecbf..e3b4a1c 100644 --- a/server/seed.js +++ b/server/seed.js @@ -149,9 +149,9 @@ function seed() { try { db.exec(` - INSERT OR REPLACE INTO combat_losses (side, bases_destroyed, bases_damaged, personnel_killed, personnel_wounded, civilian_killed, civilian_wounded, aircraft, warships, armor, vehicles, drones, missiles, helicopters, submarines, tanks, civilian_ships, airport_port) VALUES - ('us', 0, 27, 127, 384, 18, 52, 2, 0, 0, 8, 4, 12, 1, 0, 0, 0, 0), - ('iran', 3, 8, 2847, 5620, 412, 1203, 24, 12, 18, 42, 28, 156, 8, 2, 0, 0, 0); + INSERT OR REPLACE INTO combat_losses (side, bases_destroyed, bases_damaged, personnel_killed, personnel_wounded, civilian_killed, civilian_wounded, aircraft, warships, armor, vehicles, drones, missiles, helicopters, submarines, tanks, carriers, civilian_ships, airport_port) VALUES + ('us', 0, 27, 127, 384, 18, 52, 2, 0, 0, 8, 4, 12, 1, 0, 0, 0, 0, 0), + ('iran', 3, 8, 2847, 5620, 412, 1203, 24, 12, 18, 42, 28, 156, 8, 2, 0, 0, 0, 0); `) } catch (_) { db.exec(` diff --git a/server/situationData.js b/server/situationData.js index e1d502d..92b1b5f 100644 --- a/server/situationData.js +++ b/server/situationData.js @@ -24,7 +24,7 @@ function toLosses(row) { missiles: row.missiles ?? 0, helicopters: row.helicopters ?? 0, submarines: row.submarines ?? 0, - tanks: row.tanks ?? 0, + carriers: row.carriers ?? row.tanks ?? 0, civilianShips: row.civilian_ships ?? 0, airportPort: row.airport_port ?? 0, } @@ -42,7 +42,7 @@ const defaultLosses = { missiles: 0, helicopters: 0, submarines: 0, - tanks: 0, + carriers: 0, civilianShips: 0, airportPort: 0, } diff --git a/src/components/CombatLossesOtherPanel.tsx b/src/components/CombatLossesOtherPanel.tsx index 1d9e852..54341b4 100644 --- a/src/components/CombatLossesOtherPanel.tsx +++ b/src/components/CombatLossesOtherPanel.tsx @@ -28,7 +28,7 @@ export function CombatLossesOtherPanel({ usLosses, iranLosses, className = '' }: { label: '战舰', icon: Ship, iconColor: 'text-blue-500', us: usLosses.warships, ir: iranLosses.warships }, { label: '装甲', icon: Shield, iconColor: 'text-emerald-500', us: usLosses.armor, ir: iranLosses.armor }, { label: '车辆', icon: Car, iconColor: 'text-slate-400', us: usLosses.vehicles, ir: iranLosses.vehicles }, - { label: '坦克', icon: Layers, iconColor: 'text-amber-600', us: usLosses.tanks ?? 0, ir: iranLosses.tanks ?? 0 }, + { label: '航母', icon: Layers, iconColor: 'text-amber-600', us: usLosses.carriers ?? 0, ir: iranLosses.carriers ?? 0 }, { label: '民船', icon: Sailboat, iconColor: 'text-cyan-400', us: usLosses.civilianShips ?? 0, ir: iranLosses.civilianShips ?? 0 }, { label: '机/港', icon: Warehouse, iconColor: 'text-orange-400', us: usLosses.airportPort ?? 0, ir: iranLosses.airportPort ?? 0 }, { label: '无人机', icon: Drone, iconColor: 'text-violet-400', us: usLosses.drones ?? 0, ir: iranLosses.drones ?? 0 }, diff --git a/src/data/mockData.ts b/src/data/mockData.ts index e7bc974..85545d5 100644 --- a/src/data/mockData.ts +++ b/src/data/mockData.ts @@ -42,8 +42,8 @@ export interface CombatLosses { missiles?: number helicopters?: number submarines?: number - /** 坦克 */ - tanks?: number + /** 航母 */ + carriers?: number /** 民船 */ civilianShips?: number /** 机/港(机场/港口) */ @@ -167,7 +167,7 @@ export const INITIAL_MOCK_DATA: MilitarySituation = { missiles: 12, helicopters: 1, submarines: 0, - tanks: 0, + carriers: 0, civilianShips: 0, airportPort: 0, }, @@ -224,7 +224,7 @@ export const INITIAL_MOCK_DATA: MilitarySituation = { missiles: 156, helicopters: 8, submarines: 2, - tanks: 0, + carriers: 0, civilianShips: 0, airportPort: 0, }, diff --git a/src/hooks/useReplaySituation.ts b/src/hooks/useReplaySituation.ts index 6ac9bea..8db045e 100644 --- a/src/hooks/useReplaySituation.ts +++ b/src/hooks/useReplaySituation.ts @@ -80,7 +80,7 @@ export function useReplaySituation(): MilitarySituation { missiles: lerp(0, usLoss.missiles ?? 0), helicopters: lerp(0, usLoss.helicopters ?? 0), submarines: lerp(0, usLoss.submarines ?? 0), - tanks: lerp(0, usLoss.tanks ?? 0), + carriers: lerp(0, usLoss.carriers ?? 0), civilianShips: lerp(0, usLoss.civilianShips ?? 0), airportPort: lerp(0, usLoss.airportPort ?? 0), } @@ -102,7 +102,7 @@ export function useReplaySituation(): MilitarySituation { missiles: lerp(0, irLoss.missiles ?? 0), helicopters: lerp(0, irLoss.helicopters ?? 0), submarines: lerp(0, irLoss.submarines ?? 0), - tanks: lerp(0, irLoss.tanks ?? 0), + carriers: lerp(0, irLoss.carriers ?? 0), civilianShips: lerp(0, irLoss.civilianShips ?? 0), airportPort: lerp(0, irLoss.airportPort ?? 0), }