//have an intersection! Free, with your purchase!
Road inters1 = r.rule.globalGoals(city, road, Direction.LEFT);
Road inters2 = r.rule.globalGoals(city, road, Direction.RIGHT);
//set the type to street, give it a proper rule
inters1.setType(RoadType.STREET);
inters1.rule = new Grid(city);
inters2.setType(RoadType.STREET);
inters2.rule = new Grid(city);
rq.add(inters1);
rq.add(inters2);
rqM.add(localConstraints(r));
}
road = connect(road);
roads.insert(road.getEnvelope(), road);
cv.roads.add(road);
if(cv != null){
cv.draw();
}
}
//generate streets entirely
//log.log("Streets generating");
rq.stackStyle = true;
if(!rq.isEmpty()){
//generate streets
if(city.random.nextDouble()>.99){
rq.stackStyle = false;
}else{
rq.stackStyle = true;
}
Road road = localConstraints(rq.remove());
if(road != null){
if(road.finished){
//finished
}else{
if(road.rule instanceof OffRamp){
road.rule = new Grid(city);
}
if(city.random.nextDouble()>.9){ //makes it look like a modern/whatever neighborhood
road.rule = road.rule.mutate();
}
//use grid pattern to fill in areas between highways (Manhattan-esque pattern, but not perfect)