diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-10-18 22:51:20 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2024-10-18 22:51:20 +0300 |
| commit | 2728972d3428d82b73c49be8b600e0334c42775b (patch) | |
| tree | 8764101e5c168da49f7b68d88f5dd9573b907ede /backend/parser/parser.go | |
| parent | backend: fix prop crushers map name (diff) | |
| download | lphub-2728972d3428d82b73c49be8b600e0334c42775b.tar.gz lphub-2728972d3428d82b73c49be8b600e0334c42775b.tar.bz2 lphub-2728972d3428d82b73c49be8b600e0334c42775b.zip | |
backend: optimize create record
Diffstat (limited to 'backend/parser/parser.go')
| -rw-r--r-- | backend/parser/parser.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/backend/parser/parser.go b/backend/parser/parser.go index bf25caa..aa19592 100644 --- a/backend/parser/parser.go +++ b/backend/parser/parser.go | |||
| @@ -38,16 +38,16 @@ func ProcessDemo(filePath string) (Result, error) { | |||
| 38 | mapName := reader.TryReadStringLength(260) | 38 | mapName := reader.TryReadStringLength(260) |
| 39 | reader.SkipBytes(276) | 39 | reader.SkipBytes(276) |
| 40 | if demoFileStamp != "HL2DEMO" { | 40 | if demoFileStamp != "HL2DEMO" { |
| 41 | return Result{}, errors.New("invalid demo file stamp") | 41 | return Result{}, errors.New("Invalid demo file stamp.") |
| 42 | } | 42 | } |
| 43 | if demoProtocol != 4 { | 43 | if demoProtocol != 4 { |
| 44 | return Result{}, errors.New("this parser only supports demos from new engine") | 44 | return Result{}, errors.New("Invalid demo protocol.") |
| 45 | } | 45 | } |
| 46 | if networkProtocol != 2001 { | 46 | if networkProtocol != 2001 { |
| 47 | return Result{}, errors.New("this parser only supports demos from portal 2") | 47 | return Result{}, errors.New("Invalid network protocol.") |
| 48 | } | 48 | } |
| 49 | if mapDict[mapName] == 0 { | 49 | if mapDict[mapName] == 0 { |
| 50 | return Result{}, errors.New("demo recorded on an invalid map") | 50 | return Result{}, errors.New("Invalid map.") |
| 51 | } | 51 | } |
| 52 | result.MapID = mapDict[mapName] | 52 | result.MapID = mapDict[mapName] |
| 53 | for { | 53 | for { |
| @@ -419,7 +419,7 @@ var mapDict = map[string]int{ | |||
| 419 | "sp_a4_finale4": 60, | 419 | "sp_a4_finale4": 60, |
| 420 | 420 | ||
| 421 | "mp_coop_start": 61, | 421 | "mp_coop_start": 61, |
| 422 | "mp_coop_lobby_2": 62, | 422 | "mp_coop_lobby_3": 62, |
| 423 | 423 | ||
| 424 | "mp_coop_doors": 63, | 424 | "mp_coop_doors": 63, |
| 425 | "mp_coop_race_2": 64, | 425 | "mp_coop_race_2": 64, |
| @@ -465,7 +465,7 @@ var mapDict = map[string]int{ | |||
| 465 | "mp_coop_paint_speed_catch": 100, | 465 | "mp_coop_paint_speed_catch": 100, |
| 466 | "mp_coop_paint_longjump_intro": 101, | 466 | "mp_coop_paint_longjump_intro": 101, |
| 467 | 467 | ||
| 468 | "mp_coop_seperation_1": 102, | 468 | "mp_coop_separation_1": 102, |
| 469 | "mp_coop_tripleaxis": 103, | 469 | "mp_coop_tripleaxis": 103, |
| 470 | "mp_coop_catapult_catch": 104, | 470 | "mp_coop_catapult_catch": 104, |
| 471 | "mp_coop_2paints_1bridge": 105, | 471 | "mp_coop_2paints_1bridge": 105, |