<?xml version="1.0"?>
<building name="Bridge" game_type="Bridge" >
  <if>
    <BuildingOccupancy value="2" />
    <empty />
  </if>
  <!-- wood -->
  <else>
    <MaterialType value="Wood" />
    <if>
      <!-- raised -->
      <BuildingOccupancy value="6" />
      <if>
        <or>
          <NeighbourIdentical dir="West" />
          <NeighbourIdentical dir="East" />
        </or>
        <sprite index="366" color="building" />
        <if>
          <not>
            <NeighbourIdentical dir="West" />
          </not>
          <sprite index="367" color="building" />
        </if>
        <if>
          <not>
            <NeighbourIdentical dir="East" />
          </not>
          <sprite index="368" color="building" />
        </if>
      </if>
      <else>
        <sprite index="369" color="building" />
        <if>
          <not>
            <NeighbourIdentical dir="North" />
          </not>
          <sprite index="371" color="building" />
        </if>
        <if>
          <not>
            <NeighbourIdentical dir="South" />
          </not>
          <sprite index="370" color="building" />
        </if>
      </else>
    </if>
    <else>
      <!-- flat -->
      <sprite index="360" color="building" />
      <if>
        <not>
          <or>
            <NeighbourSameBuilding dir="North" />
            <NeighbourSameBuilding dir="West" />
          </or>
        </not>
        <sprite index="365" color="building"  >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
      </if>
      <else>
        <not>
          <NeighbourSameBuilding dir="North" />
        </not>
        <sprite index="362" color="building" >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
      </else>
      <else>
        <not>
          <NeighbourSameBuilding dir="West" />
        </not>
        <sprite index="361" color="building" >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
      </else>
      <if>
        <not>
          <NeighbourSameBuilding dir="South" />
        </not>
        <sprite index="363" color="building" >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
      </if>
      <if>
        <not>
          <NeighbourSameBuilding dir="East" />
        </not>
        <sprite index="364" color="building" >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
      </if>
    </else>
  </else>
  <!-- default (stone) -->
  <else>
    <!-- raised -->
    <BuildingOccupancy value="6" />
    <if>
      <or>
        <NeighbourIdentical dir="West" />
        <NeighbourIdentical dir="East" />
      </or>
      <sprite index="330" color="building" />
      <if>
        <not>
          <NeighbourIdentical dir="West" />
        </not>
        <sprite index="331" color="building" />
      </if>
      <if>
        <not>
          <NeighbourIdentical dir="East" />
        </not>
        <sprite index="332" color="building" />
      </if>
    </if>
    <else>
      <sprite index="333" color="building" />
      <if>
        <not>
          <NeighbourIdentical dir="North" />
        </not>
        <sprite index="335" color="building" />
      </if>
      <if>
        <not>
          <NeighbourIdentical dir="South" />
        </not>
        <sprite index="334" color="building" />
      </if>
    </else>
  </else>
  <else>
    <!-- flat -->
    <sprite index="324" color="building" />
    <if>
      <not>
        <or>
          <NeighbourSameBuilding dir="North" />
          <NeighbourSameBuilding dir="West" />
        </or>
      </not>
      <sprite index="329" color="building" >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
    </if>
    <else>
      <not>
        <NeighbourSameBuilding dir="North" />
      </not>
      <sprite index="326" color="building" >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
    </else>
    <else>
      <not>
        <NeighbourSameBuilding dir="West" />
      </not>
      <sprite index="325" color="building" >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
    </else>
    <if>
      <not>
        <NeighbourSameBuilding dir="South" />
      </not>
      <sprite index="327" color="building" >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
    </if>
    <if>
      <not>
        <NeighbourSameBuilding dir="East" />
      </not>
      <sprite index="328" color="building" >
			<subsprite blood_min="1" sheetIndex="0" blood_sprite="1" color="blood" file = "bgibs.png"/>
			<subsprite blood_min="1" sheetIndex="20" blood_sprite="1" file = "bgibs.png"/>
		</sprite>
    </if>
  </else>
  <!-- edging on flat bridges -->
  <if>
    <not>
      <or>
        <BuildingOccupancy value="6" />
        <BuildingOccupancy value="2" />
      </or>
    </not>
    <if>
      <not>
        <NeighbourSameBuilding dir="North" />
      </not>
      <sprite index="282" offsety="12" color="building" />
    </if>
    <if>
      <not>
        <NeighbourSameBuilding dir="West" />
      </not>
      <sprite index="280" offsety="12" color="building" />
    </if>
  </if>
</building>
