From: Mark S. <mar...@gm...> - 2008-12-02 01:26:16
|
I found a reasonable quick way in 1830 to force a player to buy a train out of hand (3 player game, start B&O, PRR, and a 3rd Railroad all $67 per share. B&O buys four (4) two trains (yes stupid plan, but this is to test the code), PRR buy four trains, the 3rd Railroad buy the last three trains. Next Stock Round start company #4 at $67 per share, and then in the next OR, have that company buy a 4 train - killing the twos before B&O can operate. Now when B&O operates, no trains, and < $300 in company and hand together (B&O also needs to build $160 (two tiles), and buy a Token. Then... we get to a ShareSellingRound launching. And it goes BOOM! --- Null Pointer Exception right at the start of setSellableShares for loop, because companyManager is not set in the constructor. Digging into this class structure if find the following: + -- Round | +-- StockRound extends Round | | | +-- ShareSellingRound extends StockRound | | | +-- TreasuryShareRound extends StockRound | | | +-- StockRound_1856 extends StockRound | | | +-- StockRound_1835 extends StockRound | | | +-- StockRound_18EU extends StockRound | +-- OperatingRound extends Round | | | +-- OperatingRound_1856 extends OperatingRound | | | +-- OperatingRound_18EU extends OperatingRound | | | +-- OperatingRound_18AL extends OperatingRound | +-- StartRound extends OperatingRound | +-- StartRound_1830 extends StartRound | +-- StartRound_1835 extends StartRound | +-- StartRound_1851 extends StartRound | +-- StartRound_18EU extends StartRound Issues that I see: 1. The StartRound_1830.java and StartRound_1835.java should be placed under the specific/_1830 and specific/_1835 sub-folders along with the other special case classes 2. The Round, StockRound, OperatingRound, and the respective subclasses do not have constructors for no elements, or for theStockRound (and sub-classes) an cosntructor with the GameManager Round superclass should have (but doesn't). The Round superclass does have a method 'setGameManager' which assigns gameManager and companyManager. I have adjusted my copies of the various classes to resolve this Null Pointer Exception, by creating constructors for the Round, StockRound, OperatingRound and the sub-classes of StockRound. It does require modifications of all of these for the constructors. A total of 8 classes to update. (the sub-classes of OperatingRound does not require an update. But probably should have constructors created for consistancy's sake. Since I am creating new methods, should I also add in the JavaDocs for them as well? Mark |