This is the current implementation of CanFit in baseboat.cs:

Code:
  public bool CanFit(Point3D p, Map map, int itemID)
  {
  if (map == null || map == Map.Internal || this.Deleted || this.CheckDecay())
  return false;

  MultiComponentList newComponents = MultiData.GetComponents(itemID);

  for (int x = 0; x < newComponents.Width; ++x)
  {
  for (int y = 0; y < newComponents.Height; ++y)
  {
  int tx = p.X + newComponents.Min.X + x;
  int ty = p.Y + newComponents.Min.Y + y;

  if (newComponents.Tiles[x][y].Length == 0 || this.Contains(tx, ty))
  continue;

  LandTile landTile = map.Tiles.GetLandTile(tx, ty);
  StaticTile[] tiles = map.Tiles.GetStaticTiles(tx, ty, true);

  bool hasWater = false;

  if (landTile.Z == p.Z && ((landTile.ID >= 168 && landTile.ID <= 171) || (landTile.ID >= 310 && landTile.ID <= 311)))
  hasWater = true;

  int z = p.Z;

  //int landZ = 0, landAvg = 0, landTop = 0;

  //map.GetAverageZ( tx, ty, ref landZ, ref landAvg, ref landTop );

  //if ( !landTile.Ignored && top > landZ && landTop > z )
  //   return false;

  for (int i = 0; i < tiles.Length; ++i)
  {
  StaticTile tile = tiles[i];
  bool isWater = (tile.ID >= 0x1796 && tile.ID <= 0x17B2);

  if (tile.Z == p.Z && isWater)
  hasWater = true;
  else if (tile.Z >= p.Z && !isWater)
  return false;
  }

  if (!hasWater)
  return false;
  }
  }

I am currently working on implementing translucent water for our shard for new maps. I would like to keep existing maps looking the same so I have copied the water tiles and moved them to another location in the art files. This allows me to specify one set of water tiles that are translucent and do not have the impassible flag, and one set that has all the normal flags.

You can tell from these lines that script is using tile IDs to determine if the boat can fit (continue moving):
Code:
  if (landTile.Z == p.Z && ((landTile.ID >= 168 && landTile.ID <= 171) || (landTile.ID >= 310 && landTile.ID <= 311)))

Code:
  bool isWater = (tile.ID >= 0x1796 && tile.ID <= 0x17B2);

I'm curious, does anyone know why they didn't use tiledata flags and just look to see if the tile has the Wet flag?

Can anyone think of a good reason not to use the wet tile/land flag?

The reason I'd like to do it this way is that if your tiledata flags are correct, then you don't have to go back into this script to tell it the ranges of water tiles, and your ranges of water tiles don't even have to be in the same area of your art file. They could be scattered. (This is important if you are trying to keep backwards compatibility with the regular OSI maps and you place new tiles in different ranges so they don't conflict.)
 
Back