From: Erik V. <eri...@xs...> - 2011-01-25 21:22:19
|
Hi Bill, Please send me that saved file (or even better: enter a bug in Sourceforge and attach it there). Having a real test case always helps. I think I can understand why this happens: tile colours do not seem to be initialised if a special property is used to lay a tile. And I agree that this bug can better be fixed at its source than at its manifestation point. Erik. > -----Oorspronkelijk bericht----- > Van: Bill Rosgen [mailto:ro...@gm...] > Verzonden: dinsdag 25 januari 2011 10:58 > Aan: rai...@li... > Onderwerp: [Rails-devel] 1889 Regression: private B and laying the port tile? > > Hello, > > Hopefully this is the right place to post this. I've recently checked the source > out of svn and have been playing around with rails (so that I can play 18EU on > my laptop with small screen). When playing 1889 I run into a problem that > the owner of private B cannot lay the port tile, but only if I use the code I've > checked out of svn -- version 1.4 works correctly. > > Specifically, when the user clicks on a map space where he can lay the port > tile there's a NullPointerException thrown from line 106 of > UpgradesPanel.populate(). It looks like the call to layTile.getTileColours() > returns a null pointer for at least one of the tiles in the list (I assume it's the > port tile, since it's a special tile, so the constructed of LayTile is called for the > SPECIAL_PROPERTY case where LayTile.tileColours does not get set. > > I have a savegame that can be used as a test-case, but I encounter this > problem literally anytime the owner of private B attempts to lay the port tile > (which can be as early as the first tile lay), so I'm not sure it's worth sending > out. > > I am able to get around the problem my testing that layTile.getTileColours() > returns non-null, but as I'm not familiar with the code, I'm not sure if that will > break anything else. Specifically, if I change lines 104-115 of > UpgradesPanel.populate() to the following: > > for (TileI tile : tiles) { > // Skip if not allowed in LayTile > if (layTile.getTileColours() != null && > layTile.getTileColours().get(tile.getColourName()) < 1) continue; > > // special check: does the tile increase the colour number? > // this avoids that a special tile lay down or equalgrades existing > tiles > // TODO EV: I'm not sure if this is a necessary precaution. > if (layTile.getTileColours() != null && > !layTile.isTileColourAllowed(tile.getColourName())) continue; > > if (!orUIManager.tileUpgrades.contains(tile)) > orUIManager.tileUpgrades.add(tile); > } > > then it seems that the private power works correctly. > > I'd send a patch, but I'm not convinced that UpgradesPanel is the right place > to make this change and I'm also not sure that the bug isn't some artifact of > me misconfiguring Eclipse. > > Thanks, > Bill Rosgen > > > ---------------------------------------------------------------------------- -- > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |