Example #1
0
  boolean roadTest(int tx, int ty) {
    if (!city.testBounds(tx, ty)) {
      return false;
    }

    char c = city.getTile(tx, ty);

    if (c < ROADBASE) return false;
    else if (c > LASTRAIL) return false;
    else if (c >= POWERBASE && c < LASTPOWER) return false;
    else return true;
  }
Example #2
0
  void setTrafficMem() {
    while (!positions.isEmpty()) {
      CityLocation pos = positions.pop();
      mapX = pos.x;
      mapY = pos.y;
      assert city.testBounds(mapX, mapY);

      // check for road/rail
      int tile = city.getTile(mapX, mapY);
      if (tile >= ROADBASE && tile < POWERBASE) {
        city.addTraffic(mapX, mapY, 50);
      }
    }
  }