From: Erik V. <eri...@xs...> - 2010-01-20 21:26:22
|
Correct, thanks for spotting this bug. I have solved it a bit more generically by setting that line to executeTradeCertificate(cert2, portfolio, cert2.getShares() * price); although I'm currently not aware of any exceptions to the rule that such certificates always are just one share; but in theory it's possible. Erik. -----Original Message----- From: Phil Davies [mailto:de...@gm...] Sent: Wednesday 20 January 2010 21:33 To: Development list for Rails: an 18xx game Subject: [Rails-devel] Issue with companies buying shares from the pool intothe company Spotted this issue today whilst running through a game today. When a company purchases it's shares from the pool, it buys each share at (number of shares it is buying * current market price) rather than just current market price. I think this is the bit that is causing the problem (patch below), it has a loop for the share purchase but passes the price as shares*price through to executeTradeCertificate Phil Index: rails/game/TreasuryShareRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TreasuryShareRound.java,v retrieving revision 1.18 diff -u -r1.18 TreasuryShareRound.java --- rails/game/TreasuryShareRound.java 18 Jan 2010 18:49:30 -0000 1.18 +++ rails/game/TreasuryShareRound.java 20 Jan 2010 20:25:40 -0000 @@ -360,7 +360,7 @@ PublicCertificateI cert2; for (int i = 0; i < number; i++) { cert2 = from.findCertificate(company, cert.getShares(), false); - executeTradeCertificate(cert2, portfolio, shares * price); + executeTradeCertificate(cert2, portfolio, price); } hasBought.set(true); ---------------------------------------------------------------------------- -- Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Rails-devel mailing list Rai...@li... https://lists.sourceforge.net/lists/listinfo/rails-devel |