From: Tekkie C. <tek...@ho...> - 2007-05-28 10:33:17
|
Hope its ok this time. >From: Sean Bridges <sbr...@ya...> >To: Tekkie Chiu <tek...@ho...>, >tri...@li... >Subject: Re: [Triplea-develop] Allow more than one canal per sea zone >Date: Sun, 27 May 2007 08:53:53 -0700 (PDT) >MIME-Version: 1.0 >Received: from web53409.mail.re2.yahoo.com ([206.190.37.56]) by >bay0-mc7-f4.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Sun, 27 >May 2007 08:53:54 -0700 >Received: (qmail 28874 invoked by uid 60001); 27 May 2007 15:53:54 -0000 >Received: from [207.6.90.156] by web53409.mail.re2.yahoo.com via HTTP; Sun, >27 May 2007 08:53:53 PDT >X-Message-Info: >LsUYwwHHNt3660MmjhEvYg2f34OAemlK+ZzoV09lDsZmbz8QigGIQtU5Yvr3lK0P >DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; >h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; > >b=IkqlqSL31rmiw6g+JaswWWZsezkC856blVmPfknXRCDD0TAkQL+f6kxu1FEqu/xiRt9IQE+rR/hVLLrIq5ox8Q5jhbzR52Xp//ZOsg7pqX9jef6UQDMJFQdnpF5k3NFcwmB8SRiuw+iG6YOTevuqcHwEb4Gf0l7YfhAMCFyrS+s=; >X-YMail-OSG: >eOdvyQUVM1nlaGAfyjroSp8u6EGYfTZAzo.40fsqi_74e82PDAH7UN5SYUR3Fy_SRuEVPsRm8SXGoDbIf7Hj_AYklNRpKLCG6dd4s8yl1JBdhdXSGQ-- >Return-Path: sbr...@ya... >X-OriginalArrivalTime: 27 May 2007 15:53:54.0799 (UTC) >FILETIME=[3A98BFF0:01C7A077] > >Hello, > >Can you send the patch again? It looks like something >is inserting new lines to break up long lines. > >Just looking through the patch it seems fine, just add >a note in changelog.txt. > >Sean > >--- Tekkie Chiu <tek...@ho...> wrote: > > > This patch allows more than one canal per sea zone. > > To prevent prior canals for a particular sea zone > > being overwritten the > > attachment name needs to be different. > > Compatibility with existing xml. > > > > eg. > > ="canalAttachment" ... sea zone 15 > > ="canalAttachment2" ... sea zone 15 > > > > The xml canal code I used for testing (in revised) > > is attached. Two canals > > at sea zone 15 (Suez and Bosphorous). > > > > >_________________________________________________________________ > > Advertisement: Looking for a home loan? Compare > > 2,000 mortgages at RateCity > > >http://direct.ninemsn.com.au/adclick/CID=02fd7e1a0000000000000000?> > > >Index: > > >C:/workspace/TripleA/src/games/strategy/triplea/attatchments/CanalAttachment.java > > >=================================================================== > > --- > > >C:/workspace/TripleA/src/games/strategy/triplea/attatchments/CanalAttachment.java > > (revision > > 1757) > > +++ > > >C:/workspace/TripleA/src/games/strategy/triplea/attatchments/CanalAttachment.java > > (working > > copy) > > @@ -12,17 +12,21 @@ > > > > public static Set<Territory> > > getAllCanalSeaZones(String canalName, > > GameData data) > > { > > - Set<Territory> rVal = new > > HashSet<Territory>(); > > + Set<Territory> rVal = new > > HashSet<Territory>(); > > for(Territory t : data.getMap()) > > { > > - CanalAttachment canal = get(t); > > - if(canal == null) > > + Set<CanalAttachment> canalAttachments = > > get(t); > > + if(canalAttachments.isEmpty()) > > continue; > > > > - > > - > > if(canal.getCanalName().equals(canalName)) > > + Iterator<CanalAttachment> iter = > > canalAttachments.iterator(); > > + while(iter.hasNext() ) > > { > > - rVal.add(t); > > + CanalAttachment canalAttachment = > > iter.next(); > > + if > > (canalAttachment.getCanalName().equals(canalName)) > > + { > > + rVal.add(t); > > + } > > } > > } > > > > @@ -32,9 +36,22 @@ > > return rVal; > > } > > > > - public static CanalAttachment get(Territory t) > > + public static Set<CanalAttachment> > > get(Territory t) > > { > > - return (CanalAttachment) t.getAttachment( > > Constants.CANAL_ATTATCHMENT_NAME); > > + Set<CanalAttachment> rVal = new > > HashSet<CanalAttachment>(); > > + Map<String, IAttachment> map = > > t.getAttachments(); > > + Iterator<String> iter = > > map.keySet().iterator(); > > + while(iter.hasNext() ) > > + { > > + IAttachment attachment = > > map.get(iter.next()); > > + String name = attachment.getName(); > > + if > > (name.startsWith(Constants.CANAL_ATTATCHMENT_NAME)) > > + { > > + > > rVal.add((CanalAttachment)attachment); > > + } > > + } > > + return rVal; > > + > > } > > > > public void setCanalName(String name) > > Index: > > >C:/workspace/TripleA/src/games/strategy/triplea/weakAI/WeakAI.java > > >=================================================================== > > --- > > >C:/workspace/TripleA/src/games/strategy/triplea/weakAI/WeakAI.java > > (revision > > 1757) > > +++ > > >C:/workspace/TripleA/src/games/strategy/triplea/weakAI/WeakAI.java > > (working > > copy) > > @@ -391,10 +391,17 @@ > > { > > public boolean match(Territory o) > > { > > - if(CanalAttachment.get(o) == > > null) > > + Set<CanalAttachment> > > canalAttachments = > > CanalAttachment.get(o); > > + if(canalAttachments.isEmpty()) > > return true; > > - return Match.allMatch( > > CanalAttachment.get(o).getLandTerritories(), > > Matches.isTerritoryAllied(player, data)); > > > > + Iterator<CanalAttachment> iter > > = > > canalAttachments.iterator(); > > + while(iter.hasNext() ) > > + { > > + CanalAttachment > > canalAttachment = iter.next(); > > + return Match.allMatch( > > canalAttachment.getLandTerritories(), > > Matches.isTerritoryAllied(player, > > data)); > > + } > > + return true; > > } > > } > > ); > > Index: > > >C:/workspace/TripleA/src/games/strategy/triplea/delegate/MoveValidator.java > > >=================================================================== > > --- > > >C:/workspace/TripleA/src/games/strategy/triplea/delegate/MoveValidator.java > > (revision > > 1757) > > +++ > > >C:/workspace/TripleA/src/games/strategy/triplea/delegate/MoveValidator.java > > (working > > copy) > > @@ -399,25 +399,33 @@ > > > > for(Territory routeTerritory : territories) > > { > > - CanalAttachment attachment = > > CanalAttachment.get(routeTerritory); > > - if(attachment == null) > > + Set<CanalAttachment> canalAttachments = > > CanalAttachment.get(routeTerritory); > > + if(canalAttachments.isEmpty()) > > continue; > > - if(!territories.containsAll( > > >CanalAttachment.getAllCanalSeaZones(attachment.getCanalName(), > > data) )) > > + > > + Iterator<CanalAttachment> iter = > > canalAttachments.iterator(); > > + while(iter.hasNext() ) > > { > > - continue; > > - } > > + CanalAttachment attachment = > > iter.next(); > > + if(attachment == null) > > + continue; > > + if(!territories.containsAll( > > >CanalAttachment.getAllCanalSeaZones(attachment.getCanalName(), > > data) )) > > + { > > + continue; > > + } > > > > > > - for(Territory borderTerritory : > > attachment.getLandTerritories()) > > - { > > - if > > (!data.getAllianceTracker().isAllied(player, > > borderTerritory.getOwner())) > > + for(Territory borderTerritory : > > attachment.getLandTerritories()) > > { > > - return "Must own " + > > borderTerritory.getName() + " to go > > through " + attachment.getCanalName(); > > + if > > (!data.getAllianceTracker().isAllied(player, > > borderTerritory.getOwner())) > > + { > > + return "Must own " + > > borderTerritory.getName() + " to > > go through " + attachment.getCanalName(); > > + } > > + > > if(tracker.wasConquered(borderTerritory)) > > + { > > + return "Cannot move through " + > > > > attachment.getCanalName() + " without owning " + > > borderTerritory.getName() + > > " for an entire turn"; > > + } > > } > > - > > if(tracker.wasConquered(borderTerritory)) > > - { > > - return "Cannot move through " + > > attachment.getCanalName() >=== message truncated ===> <attatchment >name="canalAttatchment1" > > attatchTo="15 Sea Zone" > > >javaClass="games.strategy.triplea.attatchments.CanalAttachment" > > type="territory"> > > <option name="canalName" value="Suez > > Canal"/> > > <option name="landTerritories" value="Anglo > > Egypt:Trans-Jordan"/> > > </attatchment> > > > > <attatchment name="canalAttatchment2" > > attatchTo="34 Sea Zone" > > >javaClass="games.strategy.triplea.attatchments.CanalAttachment" > > type="territory"> > > <option name="canalName" value="Suez > > Canal"/> > > <option name="landTerritories" value="Anglo > > Egypt:Trans-Jordan"/> > > </attatchment> > > > > <attatchment name="canalAttatchment3" > > attatchTo="19 Sea Zone" > > >javaClass="games.strategy.triplea.attatchments.CanalAttachment" > > type="territory"> > > <option name="canalName" value="Panama > > Canal"/> > > <option name="landTerritories" > > value="Panama"/> > > </attatchment> > > > > <attatchment name="canalAttatchment4" > > attatchTo="20 Sea Zone" > > >javaClass="games.strategy.triplea.attatchments.CanalAttachment" > > type="territory"> > > <option name="canalName" value="Panama > > Canal"/> > > <option name="landTerritories" > > value="Panama"/> > > </attatchment> > > > > <attatchment name="canalAttatchment5" > > attatchTo="14 Sea Zone" > > >javaClass="games.strategy.triplea.attatchments.CanalAttachment" > > type="territory"> > > <option name="canalName" value="Bosphorus > > Canal East"/> > > <option name="landTerritories" > > value="Turkey"/> > > </attatchment> > > > > <attatchment name="canalAttatchment6" > > attatchTo="16 Sea Zone" > > >javaClass="games.strategy.triplea.attatchments.CanalAttachment" > > type="territory"> > > <option name="canalName" value="Bosphorus > > Canal East"/> > > <option name="landTerritories" > > value="Turkey"/> > > </attatchment> > > > > <attatchment name="canalAttatchment7" > > attatchTo="15 Sea Zone" > > >javaClass="games.strategy.triplea.attatchments.CanalAttachment" > > type="territory"> > > <option name="canalName" value="Bosphorus > > Canal West"/> > > <option name="landTerritories" > > value="Turkey"/> > > </attatchment> > > > > <attatchment name="canalAttatchment8" > > attatchTo="16 Sea Zone" > > >javaClass="games.strategy.triplea.attatchments.CanalAttachment" > > type="territory"> > > <option name="canalName" value="Bosphorus > > Canal West"/> > > <option name="landTerritories" > > value="Turkey"/> > > </attatchment> > > > >------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 > > express and take > > control of your XML. No limits. Just data. Click to > > get it now. > > http://sourceforge.net/powerbar/db2/> >_______________________________________________ > > Triplea-developers mailing list > > Tri...@li... > > >https://lists.sourceforge.net/lists/listinfo/triplea-developers > > > > > > >____________________________________________________________________________________Building >a website is a piece of cake. Yahoo! Small Business gives you all the tools >to get online. >http://smallbusiness.yahoo.com/webhosting _________________________________________________________________ Advertisement: 1000s of Sexy Singles online now at Lavalife - Click here http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D27782&_t=762255081&_r=lavalife_may07_1000sexysingles&_m=EXT |