net.sf.freecol.server.model
Class ServerColony
java.lang.Object
net.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.model.FreeColGameObject
net.sf.freecol.common.model.UnitLocation
net.sf.freecol.common.model.GoodsLocation
net.sf.freecol.common.model.Settlement
net.sf.freecol.common.model.Colony
net.sf.freecol.server.model.ServerColony
- All Implemented Interfaces:
- Location, Nameable, Named, Ownable, ServerModelObject
public class ServerColony
- extends Colony
- implements ServerModelObject
The server version of a colony.
|
Field Summary |
private static java.util.logging.Logger |
logger
|
| Fields inherited from class net.sf.freecol.common.model.Colony |
BUILD_QUEUE_TAG, buildingMap, buildQueue, colonyTiles, displayUnitCount, established, exportData, HAS_PORT, immigration, landLocked, liberty, LIBERTY_PER_REBEL, oldSonsOfLiberty, oldTories, POPULATION_QUEUE_TAG, populationQueue, productionBonus, REARRANGE_WORKERS, SOL_MODIFIER_SOURCE, sonsOfLiberty, stockadeKey, tories, unitCount |
|
Constructor Summary |
ServerColony(Game game,
Player owner,
java.lang.String name,
Tile tile)
Creates a new ServerColony. |
ServerColony(Game game,
java.lang.String id)
Trivial constructor required for all ServerModelObjects. |
|
Method Summary |
private boolean |
csBuildBuilding(BuildQueue<? extends BuildableType> buildQueue,
ChangeSet cs)
Builds a building from a build queue. |
private Unit |
csBuildUnit(BuildQueue<? extends BuildableType> buildQueue,
java.util.Random random,
ChangeSet cs)
Build a unit from a build queue. |
private void |
csCheckMissingInput(Building building,
ProductionInfo pi,
ChangeSet cs)
Check a building to see if it is missing input. |
void |
csEvictUser(Unit enemyUnit,
ChangeSet cs)
Evict the users from a tile used by this colony, due to military
action from another unit. |
void |
csNewTurn(java.util.Random random,
ChangeSet cs)
New turn for this colony. |
private BuildableType |
csNextBuildable(BuildQueue<? extends BuildableType> queue,
java.util.Random random,
ChangeSet cs)
Removes a buildable from a build queue, and updates the queue so that
a valid buildable is now being built if possible. |
java.lang.String |
getServerXMLElementTagName()
Returns the tag name of the root element representing this object. |
private boolean |
neededForBuildableType(GoodsType goodsType)
Is a goods type needed for a buildable that this colony could
be building. |
| Methods inherited from class net.sf.freecol.common.model.Colony |
add, addBuilding, addEquipmentGoods, addGoods, addGoods, addLiberty, addUnit, calculateMembership, canAdd, canBePillaged, canBePlundered, canBombardEnemyShip, canBreed, canBuild, canBuild, canPayToFinishBuilding, canPayToFinishBuilding, canProvideEquipment, canReducePopulation, canTrain, canTrain, changeOwner, checkForGovMgtChangeMessage, contains, dispose, disposeList, disposeScratchColony, findStudent, findTeacher, getAdjustedNetProductionOf, getAllWorkLocations, getAvailableWorkLocations, getBestDefenderType, getBetterExpert, getBuildableUnits, getBuilding, getBuildingFor, getBuildingForConsuming, getBuildingForProducing, getBuildings, getBuildingsForConsuming, getBuildingsForProducing, getBuildingWithAbility, getBuildQueue, getBurnableBuildingList, getColony, getColonyTile, getColonyTiles, getColonyTileTodo, getConsumers, getConsumptionOf, getCorrespondingWorkLocation, getCurrentlyBuilding, getCurrentWorkLocations, getDefendingUnit, getDisplayUnitCount, getEstablished, getExportAmount, getExportData, getFoodProduction, getGoodsCapacity, getGoodsForBuilding, getImageKey, getImmigration, getImportAmount, getLiberty, getLocationName, getLocationNameFor, getLootableGoodsList, getMembers, getModifierSet, getNameFor, getNetProductionOf, getNoBuildReason, getPlunderRange, getPreferredSizeChange, getPriceForBuilding, getPriceForBuilding, getProductionBonus, getProductionInfo, getProductionMap, getProductionModifier, getProductionOf, getScratchColony, getShipList, getSoL, getStockade, getStockadeKey, getTeachers, getTory, getTotalDefencePower, getTrueStockadeKey, getTurnsToComplete, getTurnsToComplete, getUnitCount, getUnitIterator, getUnitList, getVacantColonyTileFor, getVacantWorkLocationFor, getWarehouse, getWarnings, getWorkLocationFor, getXMLElementTagName, governmentChange, hasAbility, hasAbility, hasStockade, incrementImmigration, incrementLiberty, invalidateCache, isAutomaticBuild, isConnected, isLandLocked, isProductive, isTileInUse, isUndead, isUnderSiege, modifySpecialGoods, priceGoodsForBuilding, propagateAlarm, readFromXMLImpl, readFromXMLPartialImpl, remove, removeBuilding, removeGoods, removeGoods, removeGoods, removeUnit, setBuildQueue, setCurrentlyBuilding, setDisplayUnitCount, setEstablished, setExportData, toString, toXMLImpl, toXMLPartialImpl, updatePopulation, updateProductionBonus, updateSoL, writeChildren |
| Methods inherited from class net.sf.freecol.common.model.Settlement |
addTile, canBuildEquipment, canProvideEquipment, getConsumptionOf, getFeatureContainer, getFoodConsumption, getLineOfSight, getName, getNameKey, getOwnedTiles, getOwner, getPlunder, getRadius, getSettlement, getTile, getType, isCapital, placeSettlement, readAttributes, removeTile, setCapital, setFeatureContainer, setName, setOwner, setType, writeAttributes |
| Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
equals, equals, fundamentalDispose, getFreeColGameObject, getFreeColGameObject, getGame, getIntegerID, getSpecification, hashCode, isDisposed, isUninitialized, newLocation, readFromXML, readFromXMLPartialByClass, setDefaultId, setGame, setId, toXML, toXMLImpl, toXMLPartialByClass, updateFreeColGameObject |
| Methods inherited from class net.sf.freecol.common.model.FreeColObject |
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAttribute, hasListeners, readAttributes, readChild, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXMLElement, readFromXMLImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setSpecification, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeChildren |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.freecol.common.model.Location |
getId |
logger
private static final java.util.logging.Logger logger
ServerColony
public ServerColony(Game game,
java.lang.String id)
- Trivial constructor required for all ServerModelObjects.
ServerColony
public ServerColony(Game game,
Player owner,
java.lang.String name,
Tile tile)
- Creates a new ServerColony.
- Parameters:
game - The Game in which this object belongs.owner - The Player owning this Colony.name - The name of the new Colony.tile - The location of the Colony.
neededForBuildableType
private boolean neededForBuildableType(GoodsType goodsType)
- Is a goods type needed for a buildable that this colony could
be building.
- Parameters:
goodsType - The GoodsType to check.
- Returns:
- True if the goods could be used to build something.
csNewTurn
public void csNewTurn(java.util.Random random,
ChangeSet cs)
- New turn for this colony.
Try to find out if the colony is going to survive (last colonist does
not starve) before generating lots of production-related messages.
TODO: use the warehouse to store things?
- Specified by:
csNewTurn in interface ServerModelObject
- Parameters:
random - A Random number source.cs - A ChangeSet to update.
csCheckMissingInput
private void csCheckMissingInput(Building building,
ProductionInfo pi,
ChangeSet cs)
- Check a building to see if it is missing input.
- Parameters:
building - The Building to check.pi - The ProductionInfo for the building.cs - A ChangeSet to update.
csBuildUnit
private Unit csBuildUnit(BuildQueue<? extends BuildableType> buildQueue,
java.util.Random random,
ChangeSet cs)
- Build a unit from a build queue.
- Parameters:
buildQueue - The BuildQueue to find the unit in.random - A pseudo-random number source.cs - A ChangeSet to update.
- Returns:
- The unit that was built.
csBuildBuilding
private boolean csBuildBuilding(BuildQueue<? extends BuildableType> buildQueue,
ChangeSet cs)
- Builds a building from a build queue.
- Parameters:
buildQueue - The BuildQueue to build from.cs - A ChangeSet to update.
- Returns:
- True if the build was successful.
csNextBuildable
private BuildableType csNextBuildable(BuildQueue<? extends BuildableType> queue,
java.util.Random random,
ChangeSet cs)
- Removes a buildable from a build queue, and updates the queue so that
a valid buildable is now being built if possible.
- Parameters:
queue - The BuildQueue to update.random - A pseudo-random number source.cs - A ChangeSet to update.
- Returns:
- The next buildable that can be built, or null if nothing.
csEvictUser
public void csEvictUser(Unit enemyUnit,
ChangeSet cs)
- Evict the users from a tile used by this colony, due to military
action from another unit.
- Parameters:
enemyUnit - The Unit that has moved in.cs - A ChangeSet to update.
getServerXMLElementTagName
public java.lang.String getServerXMLElementTagName()
- Returns the tag name of the root element representing this object.
- Specified by:
getServerXMLElementTagName in interface ServerModelObject
- Returns:
- "serverColony"