From: Stefan F. <ste...@we...> - 2011-10-31 11:07:55
|
Thanks for that bug report. Some notes for Erik: I do not consider this error as minor, it seems to be a more general issue. I had a quick look at this at seems that this goes back to the methods getCurrentTrainLimit and getTrainLimit(int index) inside PublicCompany It seems that your changes of the PhaseManagement got this out of synch. Maybe this could refactored a little bit, as it requires many steps of function forwarding to get to those methods and involves some conversion to integer and using that as an array index, which most likely is the reason for that problem. I believe a method with something like getTrainLimit(Phase phase, PublicCompany company) would be much safer. If this is located in Phase, PhaseManager or PublicCompany is a matter of taste. Another possibility is to have the phase change trigger a change of an integer state variable that stores the number of trains available for each company. This problem could potentially arise in other games than 18EU. Unfortunately the reduction of the train limit seems to be unreported in the game report, thus it is not covered by our automated tests, so maybe this could be added too. During debugging I realized that the train limit is not shown in the Phase menu, so it appears that is shown nowhere. A (minor) bug is that the tile colors are shown as null for those phases, where the tile laying does not change. I will wait with the new release for a fix from your side, unless you tell me that this bug will require a substantial amount of work and would delay a new release for several days. Stefan Methods Quoted here: /** Get the current maximum number of trains got a given limit index. * @parm index The index of the train limit step as defined for the current phase. Values start at 0. * <p>N.B. the new style limit steps per phase start at 1, * so one must be subtracted before calling this method. */ protected int getTrainLimit(int index) { return trainLimit[Math.min(index, trainLimit.length - 1)]; } public int getCurrentTrainLimit() { return getTrainLimit(gameManager.getCurrentPhase().getTrainLimitIndex()); } On Monday, October 31, 2011 02:14:03 am John David Galt wrote: > In a three-player game of 18EU under Rails 1.5.1 (save file attached), I > found two minor bugs. > > 1) The train limit is not reduced to two until a 6-train is purchased > (should happen when the 5-train is purchased). > > 2) A company that has a Pullman and hits the limit is given a choice of > which train to discard (it's supposed to automatically be the Pullman). |