@@ -389,3 +389,89 @@ func TileSetByID(ID uint16) *TileSet {
389389 }
390390 return & TileSet {UnknownEnum (ID ), ID }
391391}
392+
393+ // PlayerOwner describes a player owner.
394+ type PlayerOwner struct {
395+ Enum
396+
397+ // ID as it appears in replays
398+ ID uint8
399+ }
400+
401+ // PlayerOwners is an enumeration of the possible player owners
402+ var PlayerOwners = []* PlayerOwner {
403+ {Enum {"Inactive" }, 0x00 },
404+ {Enum {"Computer (game)" }, 0x01 },
405+ {Enum {"Occupied by Human Player" }, 0x02 },
406+ {Enum {"Rescue Passive" }, 0x03 },
407+ {Enum {"Unused" }, 0x04 },
408+ {Enum {"Computer" }, 0x05 },
409+ {Enum {"Human (Open Slot)" }, 0x06 },
410+ {Enum {"Neutral" }, 0x07 },
411+ {Enum {"Closed slot" }, 0x08 },
412+ }
413+
414+ // Named player owners
415+ var (
416+ PlayerOwnerInactive = PlayerOwners [0 ]
417+ PlayerOwnerComputerGame = PlayerOwners [1 ]
418+ PlayerOwnerOccupiedByHumanPlayer = PlayerOwners [2 ]
419+ PlayerOwnerRescuePassive = PlayerOwners [3 ]
420+ PlayerOwnerUnused = PlayerOwners [4 ]
421+ PlayerOwnerComputer = PlayerOwners [5 ]
422+ PlayerOwnerHumanOpenSlot = PlayerOwners [6 ]
423+ PlayerOwnerNeutral = PlayerOwners [7 ]
424+ PlayerOwnerClosedSlot = PlayerOwners [8 ]
425+ )
426+
427+ // PlayerOwnerByID returns the PlayerOwner for a given ID.
428+ // A new PlayerOwner with Unknown name is returned if one is not found
429+ // for the given ID (preserving the unknown ID).
430+ func PlayerOwnerByID (ID uint8 ) * PlayerOwner {
431+ if int (ID ) < len (PlayerOwners ) {
432+ return PlayerOwners [ID ]
433+ }
434+ return & PlayerOwner {UnknownEnum (ID ), ID }
435+ }
436+
437+ // PlayerSide describes a player side (race).
438+ type PlayerSide struct {
439+ Enum
440+
441+ // ID as it appears in replays
442+ ID uint8
443+ }
444+
445+ // PlayerSides is an enumeration of the possible player sides
446+ var PlayerSides = []* PlayerSide {
447+ {Enum {"Zerg" }, 0x00 },
448+ {Enum {"Terran" }, 0x01 },
449+ {Enum {"Protoss" }, 0x02 },
450+ {Enum {"Invalid (Independent)" }, 0x03 },
451+ {Enum {"Invalid (Neutral)" }, 0x04 },
452+ {Enum {"User Selectable" }, 0x05 },
453+ {Enum {"Random (Forced)" }, 0x06 }, // Acts as a selected race
454+ {Enum {"Inactive" }, 0x07 },
455+ }
456+
457+ // Named player sides
458+ var (
459+ PlayerSideZerg = PlayerSides [0 ]
460+ PlayerSideTerran = PlayerSides [1 ]
461+ PlayerSideProtoss = PlayerSides [2 ]
462+ PlayerSideInvalidIndependent = PlayerSides [3 ]
463+ PlayerSideInvalidNeutral = PlayerSides [4 ]
464+ PlayerSideUserSelectable = PlayerSides [5 ]
465+ PlayerSideRandomForced = PlayerSides [6 ]
466+ PlayerSideInactive = PlayerSides [7 ]
467+ )
468+
469+ // PlayerSideByID returns the PlayerSide for a given ID.
470+ // A new PlayerSide with Unknown name is returned if one is not found
471+ // for the given ID (preserving the unknown ID).
472+ func PlayerSideByID (ID uint8 ) * PlayerSide {
473+ if int (ID ) < len (PlayerSides ) {
474+ return PlayerSides [ID ]
475+ }
476+ return & PlayerSide {UnknownEnum (ID ), ID }
477+ }
0 commit comments