From: Erik V. <ev...@us...> - 2009-08-03 21:27:28
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23302/rails/game Modified Files: PublicCompany.java Log Message: Make CGR have 10% shares if max. 10 shares are issued. Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** PublicCompany.java 4 May 2009 20:29:14 -0000 1.49 --- PublicCompany.java 3 Aug 2009 21:27:19 -0000 1.50 *************** *** 175,179 **** /** What percentage of ownership constitutes "one share" */ ! protected int shareUnit = DEFAULT_SHARE_UNIT; /** At what percentage sold does the company float */ --- 175,179 ---- /** What percentage of ownership constitutes "one share" */ ! protected IntegerState shareUnit; /** At what percentage sold does the company float */ *************** *** 265,270 **** Tag shareUnitTag = tag.getChild("ShareUnit"); if (shareUnitTag != null) { ! shareUnit = ! shareUnitTag.getAttributeAsInteger("percentage", shareUnit); } --- 265,270 ---- Tag shareUnitTag = tag.getChild("ShareUnit"); if (shareUnitTag != null) { ! shareUnit = new IntegerState (name+"_ShareUnit", ! shareUnitTag.getAttributeAsInteger("percentage", DEFAULT_SHARE_UNIT)); } *************** *** 476,480 **** certIsInitiallyAvailable); addCertificate(certificate); ! shareTotal += shares * shareUnit; } } --- 476,480 ---- certIsInitiallyAvailable); addCertificate(certificate); ! shareTotal += shares * shareUnit.intValue(); } } *************** *** 629,632 **** --- 629,636 ---- } + + if (shareUnit == null) { + shareUnit = new IntegerState (name+"_ShareUnit", DEFAULT_SHARE_UNIT); + } // Give each certificate an unique Id *************** *** 1156,1160 **** for (PublicCertificateI cert : certificates) { CashHolder recipient = getBeneficiary(cert); ! part = amount * cert.getShares() * shareUnit / 100; // For reporting, we want to add up the amounts per recipient if (split.containsKey(recipient)) { --- 1160,1164 ---- for (PublicCertificateI cert : certificates) { CashHolder recipient = getBeneficiary(cert); ! part = amount * cert.getShares() * shareUnit.intValue() / 100; // For reporting, we want to add up the amounts per recipient if (split.containsKey(recipient)) { *************** *** 1237,1241 **** */ public int getShareUnit() { ! return shareUnit; } --- 1241,1245 ---- */ public int getShareUnit() { ! return shareUnit.intValue(); } *************** *** 1378,1382 **** public int getNumberOfShares() { ! return 100 / shareUnit; } --- 1382,1386 ---- public int getNumberOfShares() { ! return 100 / shareUnit.intValue(); } |