From: Bill R. <ro...@gm...> - 2011-03-29 05:07:16
|
Here is a patch to implement <Tradeable> tags. I've moved all of the code dealing with private buy-in prices into the PrivateCompany class (which required modifying OperatingRound to get the prices from the right place). I've also updated all of the game XML files that used the old method. This change should also correctly prevent the B&O from being sold to a company. I've tested 1830, 18AL, and the 1848 implementation that I am working on, and they all seem to work. The syntax is as described by Erik: To specify a standard 1830-style private (in the CompanyType tag): <Tradeable toCompany="yes" lowerPriceFactor="0.5" upperPriceFactor="2.0"/> To make a private not tradeable to a company: <Tradeable toCompany="no"/> To specify explicit min and max prices: <Tradeable toCompany="yes" lowerPrice="1" upperPrice="40"/> To mark a private as sellable to another player (not yet implemented in rails, but the private company can be told about it): <Tradeable toPlayer="yes"/> Prices (or PriceFactors) specified within a tag apply only to the case(s) specified, i.e. it's possible to have two lines that specify different prices for different sale types, i.e.: <Tradeable toCompany="yes" lowerPriceFactor="0.5" upperPriceFactor="2.0"/> <Tradeable toPlayer="yes" lowerPrice="1"/> Any prices not specified are set to a flag PrivateCompanyI.NO_PRICE_LIMIT, which are interpreted by OperatingRound as either 0 for a lowerPrice or the current company treasury for an upperPrice. I'm not sure that this is the best way to implement this: suggestions are welcome. Prices can be set using a mix, i.e. <Tradeable toCompany="yes" lowerPrice="1" upperPriceFactor="2.0"/> If over-specified, the attributes lowerPrice and upperPrice take precedence. I can move all of this to the Company class if desired (this should be easy), but to my knowledge no one is currently working on a game that would use this. (Hopefully the patch is well-formed: I don't have a lot of experience with Eclipse.) Bill |