File: fo_typing.py

package info (click to toggle)
freeorion 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 194,940 kB
  • sloc: cpp: 186,508; python: 40,969; ansic: 1,164; xml: 719; makefile: 32; sh: 7
file content (30 lines) | stat: -rw-r--r-- 883 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
This module contains FreeOrion types.

Since a lot of object are operated by their ID
it is hard to distinguish one int from the another.
"""

from typing import NewType

_UniverseObjectId = NewType("UniverseObjectId", int)
ObjectId = NewType("ObjectId", _UniverseObjectId)
PlanetId = NewType("PlanetId", _UniverseObjectId)
FleetId = NewType("FleetId", _UniverseObjectId)
SystemId = NewType("SystemId", _UniverseObjectId)
ShipId = NewType("ShipId", _UniverseObjectId)
BuildingId = NewType("BuildingId", _UniverseObjectId)


EmpireId = NewType("EmpireId", int)
PlayerId = NewType("PlayerId", int)

BuildingName = NewType("BuildingName", str)
SpeciesName = NewType("SpeciesName", str)
SpecialName = NewType("SpecialName", str)
PartName = NewType("PartName", str)

Turn = NewType("Turn", int)

AttackDamage = NewType("AttackDamage", float)
AttackCount = NewType("AttackCount", int)