From: Stefan F. <ste...@we...> - 2014-09-04 16:54:10
|
Martin: you were right, I proposed my solution without access to the current code. So this was my "ideal" solution. What should be done is: In MapHex: * Replace field BooleanState isBlockedForTileLays by PrivateCompany isBlockedForTileLaysBy * Remove setBlockedForTileLays() method and all code that calls them. * isBlockedForTileLays() changes to isBlockedForTileLays(PublicCompany company) and forwards to a method blocksForTileLays(PublicCompany company) inside PrivateCompany. In Private Company: * This new method of PrivateCompany then checks if the condition for blocking the tile is actually given. It checks if the company is still in players hand for 1830 type of privates and for 1837 type of privates if the owner of the operating company is different to the one of the private. As the check for the state of private company occurs every time the tile is laid, there is no need to maintain a state variable inside MapHex if the hex is blocked. Test games should detect if the refactoring works correctly. Hope that helps. Stefan PS: reservedForCompany of MapHex has nothing to do with Privates. It indicates if the hex is reserved for a tile lay only by a specific public company. This occurs in 18EU and 1825. However it reminds me that this is not checked currently by the tile laying code, it is only used to paint the name of the company on the map board. On 09/04/2014 05:41 PM, Dr. Martin Brumm wrote: > HI Stefan, > > yes that would be easiest, but in the moment we have the following > diverging approaches: > > MapHex.java: > private final BooleanState isBlockedForTileLays = > BooleanState.create(this, "isBlockedForTileLays"); > > private String reservedForCompany = null; > > We set the first one from PrivateCompany. > > The second one is read from Map.xml... > > So right now Map.xml and CompanyManager.xml need to carry Information, > thats "interesting" :) > > By relying on the first state we have no chance of seeing the owner of > that hex we only know its blocked. > Now linking those blocking and unblocking methods to the > reservedForCompany String, will be possible (and dangerous for > existing games ?). > > Currently there is no check if a given Private blocks a hex: theres > just the Call boolean maphex.isBlockedForTileLays(). > > Maybe we should/can change that BooleanState into a StringState > isBlockedForTileLays with the Company being set as value ? Whats your > opinion, how dangerous might that be to the existing games for reloading ? > > Btw reservedForCompany is just used for decoration right now, shouldnt > we have that set from the blocking Hex code out of CompanyManager.xml > as well ?? > > REgards, > martin > > > Am 04.09.14 um 17:17 schrieb Stefan Frey: >> Martin: >> it seems the easiest solution is to adjust the method that checks if >> the Private blocks the hex to be parameterised with the operating >> company. >> There you are able to check if both private and operating companies >> have the identical owner. >> This avoids to block or unblock the hex itself. >> In the XML definition of the private you could add something like >> exceptOwner in the XML tag that defines hex blocking. >> I think it is simple and general enough to be included into the main >> code without requiring further examples. >> Stefan >> >> >> >> >> "Dr. Martin Brumm" <dr....@t-...>schrieb: >> >> Hi, >> >> the private companies in 1837 have the power to block access to their >> hexes to anyone but the owner and the companies that the owner is >> controlling, without the companies having to buy in the privates. >> >> Currently the blocking hex state will be lifted when the private >> company >> is bought in by a major company. >> >> The special ability of the privates in 1837 are twofold, they should >> lift the blocking (which they currently dont) and they should >> level the >> building cost (which they do). >> >> So question to the group on how to proceed here ? Are there any other >> games out there with the behaviour of the privates alike to 1837 ? or >> are all other privates which do block hexes from the type of the >> 1830-privates ? >> >> I dont really see a way in the moment to temporarly lift the >> blocking of >> the hex during a major company action and have it reblock >> everything again. >> So building up a new map for the MapHexes that keeps track of the >> blocker ? And if that is preparing a tile lay ignore the blocked >> maphex ? >> >> What do you guys think or did i miss anything ? >> >> Regards, >> Martin >> >> ------------------------------------------------------------------------------ >> Slashdot TV. >> Video for Nerds. Stuff that matters. >> http://tv.slashdot.org/ >> _______________________________________________ >> Rails-devel mailing list >> Rai...@li... >> https://lists.sourceforge.net/lists/listinfo/rails-devel >> >> >> >> ------------------------------------------------------------------------------ >> Slashdot TV. >> Video for Nerds. Stuff that matters. >> http://tv.slashdot.org/ >> >> >> _______________________________________________ >> Rails-devel mailing list >> Rai...@li... >> https://lists.sourceforge.net/lists/listinfo/rails-devel > > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > > > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel |