From: Stefan F. (web.de) <ste...@we...> - 2010-05-18 22:24:03
|
Again some more results from working on Rails during train rides: I added the RevenueManager and the RevenueStaticModifier in Rails. By those 18Kaas is fully supported and in 1856 Bonus the bonus tokens are implemented (1856 still misses the support to allow run through the Gooderich tile). Some details: -> RevenueManager A new component similar to the ones like TrainManager, CompanyManager. This is the only permanent object related to the revenue calculation and stores the revenue modifiers. -> RevenueStaticModifier This is a (simple) Interface, that requires the implementation of one method: public void modifyCalculator(RevenueAdapter revenueAdapter) This method allows to manipulate all elements for the revenue calculation via the public methods defined for the revenue adapater. This allows to create e.g. new vertices, change values of vertices, define additional RevenueBonuses or vertex sets. Current company and phase are also available. The method is called each time a revenue adapter was created and populated from Rails object, but before the revenue calculation occurs. For this it has to register itself to the RevenueManager via its addStaticModifier() method. Both the RevenueManager and game specific RevenueModifiers can be defined in Game.xml. Example Definition in Game.xml for 18Kaas: <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> <StaticModifier class="rails.game.specific._18Kaas.RuhrRevenueModifier" /> </Component> Modifiers defined in that fashion are already registered, thus they do not need to call addStaticModifier(). -> Bonus implements RevenueStaticModifier The Rails class Bonus, which represents an actual Bonus on a hex (exactly what was neeeded!), implements the modifier above and converts the Rails Bonus into a RevenueBonus in the calculator. An issue here: Due to a typo in LocatedBonus and SellBonusToken prevented the call to finishConfiguration (GameManagerI gameManager) and thus the location variable in Bonus was never parsed. An side effect of that fix that in the OR window of 1856 the bonus tokens are shown not a s Tunnel and Bridge token, but by their location codes. I do not know, what users prefer? Stefan |