Skip to content

Commit

Permalink
[AI] Rename building type base class and use it for annotation (#4014)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grummel7 committed Jul 29, 2022
1 parent fa1ce57 commit dfc2d2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions default/python/AI/ProductionAI.py
Expand Up @@ -24,7 +24,7 @@
import PriorityAI
from AIDependencies import INVALID_ID, Tags
from aistate_interface import get_aistate
from buildings import BuildingType, Shipyard, get_empire_drydocks
from buildings import BuildingType, BuildingTypeBase, Shipyard, get_empire_drydocks
from character.character_module import Aggression
from colonization import rate_planetary_piloting
from colonization.rate_pilots import GREAT_PILOT_RATING
Expand Down Expand Up @@ -1443,7 +1443,7 @@ def _location_rating(planet: fo.planet) -> float:


def _try_enqueue(
building_type: BuildingType,
building_type: BuildingTypeBase,
candidates: Union[PlanetId, Iterable[PlanetId]],
*,
at_front: bool = False,
Expand Down Expand Up @@ -1486,7 +1486,7 @@ def _try_enqueue(
return 0.0


def _may_enqueue_for_stability(building_type: BuildingType, new_turn_cost: float) -> float:
def _may_enqueue_for_stability(building_type: BuildingTypeBase, new_turn_cost: float) -> float:
"""
Build building if it seems worth doing so to increase stability.
Only builds of locations.planets_enqueued is empty and new_turn_cost is 0.0,
Expand Down
6 changes: 3 additions & 3 deletions default/python/AI/buildings.py
Expand Up @@ -44,7 +44,7 @@ def get_empire_drydocks() -> Mapping[SystemId, Tuple[PlanetId]]:
return ReadOnlyDict({k: tuple(v) for k, v in drydocks.items()})


class _BuildingOperations:
class BuildingTypeBase:
"""
Mixin class for building enums.
Expand Down Expand Up @@ -151,7 +151,7 @@ def prerequisite(self): # not yet. -> Optional[BuildingType]:
return _prerequisites.get(self, None)


class BuildingType(_BuildingOperations, Enum):
class BuildingType(BuildingTypeBase, Enum):
"""
Represent basic buildings.
Expand Down Expand Up @@ -190,7 +190,7 @@ class BuildingType(_BuildingOperations, Enum):
XENORESURRECTION_LAB = "BLD_XENORESURRECTION_LAB"


class Shipyard(_BuildingOperations, Enum):
class Shipyard(BuildingTypeBase, Enum):
"""
Represent buildings required to build ships.
"""
Expand Down

0 comments on commit dfc2d2c

Please sign in to comment.