コード例 #1
0
ファイル: ColonyWas.java プロジェクト: Thue/FreeCol
 /**
  * Record the state of a colony.
  *
  * @param colony The <code>Colony</code> to remember.
  */
 public ColonyWas(Colony colony) {
   this.colony = colony;
   this.population = colony.getUnitCount();
   this.productionBonus = colony.getProductionBonus();
   this.buildQueue = new ArrayList<BuildableType>(colony.getBuildQueue());
   if (colony.getGoodsContainer() != null) {
     colony.getGoodsContainer().saveState();
   }
 }
コード例 #2
0
ファイル: ColonyWas.java プロジェクト: Thue/FreeCol
 /** Fire any property changes resulting from actions within a colony. */
 public void fireChanges() {
   int newPopulation = colony.getUnitCount();
   if (newPopulation != population) {
     String pc = ColonyChangeEvent.POPULATION_CHANGE.toString();
     colony.firePropertyChange(pc, population, newPopulation);
   }
   int newProductionBonus = colony.getProductionBonus();
   if (newProductionBonus != productionBonus) {
     String pc = ColonyChangeEvent.BONUS_CHANGE.toString();
     colony.firePropertyChange(pc, productionBonus, newProductionBonus);
   }
   List<BuildableType> newBuildQueue = colony.getBuildQueue();
   if (!newBuildQueue.equals(buildQueue)) {
     String pc = ColonyChangeEvent.BUILD_QUEUE_CHANGE.toString();
     colony.firePropertyChange(pc, buildQueue, newBuildQueue);
   }
   if (colony.getGoodsContainer() != null) {
     colony.getGoodsContainer().fireChanges();
   }
 }