Allow Blockades in All Sea Zones?



  • Is there any streamlined way to create a blockade attachment to every sea zone territory at once?

    E.g. right now I have:

    <attachment name="territoryAttachment" attachTo="Mediterranean Sea Zone 8" javaClass="games.strategy.triplea.attachments.TerritoryAttachment" type="territory">
    	<option name="production" value="0"/>
    	<option name="blockadeZone" value="true"/>
    </attachment>
    

    And I would like these same properties to apply to all 100 of my sea zones, many of which have different names that are somewhat hard to keep track of. Is there any way to do this efficiently? Also, how would I go about turning off the 'blockade' graphic or replacing the graphic with something that is basically invisible? I don't want the little grey ship in a circle to appear in all of my sea zones, because that would just be distracting.

    Thank you!


  • Moderators

    Not sure if the "variableList" redrum created would work for that or not. I've never used it. It's in pos2

    yea I can't find the blockade image. It's gotta be somewhere. I don't think it's hardwired but maybe it is. You might wanna ask @wc_sumpton



  • Hmm. I played around with the variableList for a while, but it wasn't working well for me, so I just coded it by hand. And I found the blockade.png! It's in the "misc" folder. Adding a misc folder to my map and adding a new blockade.png file that's just a transparent square made the icon vanish the way I wanted. 🙂



  • @Jason-Green-Lowe

    The graphic used is called 'blockade.png'. To replace put the icon you want into the 'misc' folder with the same name.

    The quickest way to create your blockadezone's would be with a variable list which would be placed at the top of the xml, just after 'diceSides'. Just copy the 'sea zone' definitions into a variable :

    <!-- <diceSides value="6"/> -->
    <variableList>
       <variable name="allSeaZones">
          <territory name="Mediterranean Sea Zone 8" water="true"/>
          etc...
       </variable>
    </variableList>
    

    Once you have that done, replace 'territory' with 'element' and 'water="true"/' with '/'.

    Then your code would look like this:

    <attachment foreach="$allSeaZones$" name="territoryAttachment" attachTo="@allSeaZones@" javaClass="games.strategy.triplea.attachments.TerritoryAttachment" type="territory">
       <option name="production" value="0"/>
       <option name="blockadezone" value="true"/>
    </attachment>
    

    Hope this is helpful.

    Cheers...



  • @Jason-Green-Lowe

    You have it!!! congrats.

    Cheers...


  • Admin

    @Jason-Green-Lowe not currently

    There is a proposal on the table to consolidate territory attachments into the territory tag itself. Adding a blockade zone attribute would be a natural move and is part of that discussion: https://forums.triplea-game.org/topic/2266/proposal-combine-tags-into-territory

    To turn all territories by default to blockadeZone would require something else though. I think then we're talking about a way to perhaps set custom defaults. Something like:

    <territoryDefaults>
      <production value="0" />  <!-- already default, just for example -->
      <isWater value = "true" /> <!-- example by default today this is false -->
      <blockadeZone value="true" />
    </territoryDefaults>
    

    But even then, you'd have to turn off blockade zone for land territories, so that implies that there should be a difference between water and land territories. Namely that the two should be physically separate tags because their attributes are different.


  • Admin

    Ah, just saw the responses : )
    The variable route would work, you are still duplicating the territory names, but at least it's more concise. 👍


Log in to reply