public Terrain(String terrain){
  int firstColon=terrain.indexOf(':');
  int lastColon=terrain.lastIndexOf(':');
  String name=terrain.substring(0,firstColon);
  type=Terrains.getType(name);
  if (firstColon == lastColon) {
    level=levelFor(terrain.substring(firstColon + 1));
    exitsSpecified=false;
    if ((type == Terrains.BUILDING) || (type == Terrains.FUEL_TANK)) {
      exitsSpecified=true;
    }
  }
 else {
    level=levelFor(terrain.substring(firstColon + 1,lastColon));
    exitsSpecified=true;
    exits=levelFor(terrain.substring(lastColon + 1));
  }
  terrainFactor=Terrains.getTerrainFactor(type,level);
}

public Terrain ( String terrain ) { int firstColon = terrain . indexOf ( ':' ) ; int lastColon = terrain . lastIndexOf ( ':' ) ; String name = terrain . substring ( 0 , firstColon ) ; type = Terrains . getType ( name ) ; if ( firstColon == lastColon ) { level = levelFor ( terrain . substring ( firstColon + 1 ) ) ; exitsSpecified = false ; if ( ( type == Terrains . BUILDING ) || ( type == Terrains . FUEL_TANK ) ) { exitsSpecified = true ; } } else { level = levelFor ( terrain . substring ( firstColon + 1 , lastColon ) ) ; exitsSpecified = true ; exits = levelFor ( terrain . substring ( lastColon + 1 ) ) ; } terrainFactor = Terrains . getTerrainFactor ( type , level ) ; }
parses a string containing terrain info into the actual terrain
