Class CityEngine


  • @Component
    @Lazy
    @DependentInitialisation(ch.sahits.game.openpatrician.model.initialisation.MapInitializedBean.class)
    public class CityEngine
    extends AbstractEngine
    The CityEngine drives/generates the events that are based in the city. Mainly these are:
    • Consume of wares
    • Production of wares from workshops owned by the city
    Author:
    Andi Hotz, (c) Sahits GmbH, 2011 Created on Nov 28, 2011
    • Constructor Detail

      • CityEngine

        public CityEngine()
    • Method Detail

      • initialize

        @PostConstruct
        public void initialize()
      • handleClockTickIntervallChange

        public void handleClockTickIntervallChange​(ch.sahits.game.event.data.ClockTickIntervalChange event)
      • handleClockTicked

        public void handleClockTicked​(ch.sahits.game.event.data.ClockTick event)
      • start

        public void start​(ch.sahits.game.openpatrician.model.IGame game)
        Start the engine. This should be called after all cities were added.
        Parameters:
        game - that is started
      • getChildren

        public java.util.List<AbstractEngine> getChildren()
        Description copied from class: AbstractEngine
        Any engine may hold various child engines. This is the way to retrieve them. If there are no child engines, return an empty list. Subclasses have to implement this in the proper way.
        Specified by:
        getChildren in class AbstractEngine
        Returns:
        list of child engines.
      • findTavernEngine

        public TavernEngine findTavernEngine()
        Find the tafern engine for the matching city.
        Returns:
        TavernEngine for this CityEngine.
      • handleCityAdd

        public void handleCityAdd​(ch.sahits.game.openpatrician.model.event.FoundingCityBecomesAccessible event)
        Handle the event where a new city is added to the map.
        Parameters:
        event - founded city becomes available for trading
      • handleShipArrival

        public void handleShipArrival​(ch.sahits.game.openpatrician.event.data.ShipEntersPortEvent event)
      • handleShipDeparture

        public void handleShipDeparture​(ch.sahits.game.openpatrician.event.data.ShipLeavingPort event)
      • handleDailyUpdate

        public void handleDailyUpdate​(ch.sahits.game.event.data.PeriodicalDailyUpdate event)