Closed tlongstretch closed 3 years ago
ah I had a bug where the "avoid building large buildings near enemy borders" was considering UNOWNED borders not just enemy
fixed // don't build large civilian buildings, including stocks, near enemy borders if (building_type >= Building::TypeStock && building_type != Building::TypeHut && building_type != Building::TypeTower && building_type != Building::TypeForester){ AILogDebug["util_build_near_pos"] << name << " this is a Large Civilian building, checking to see if enemy borders are near"; for (unsigned int i = 0; i < AI::spiral_dist(8); i++) { MapPos pos = map->pos_add_extended_spirally(center_pos, i); // if not mine and not unowned (i.e. owned by somebody else) if (map->get_owner(pos) != player_index && map->get_owner(pos) != -1) { AILogDebug["util_build_near_pos"] << name << " found enemy borders near this potential build_near_pos center and this is a Large Civilian building! Not building in this area, returning"; return bad_map_pos; } }
I'm thinking it doesn't have enough positions to consider because it only looks in a spiral 12-tiles wide around each Farm attached to the current inventory pos, but what if there's no space? I think it just gives up
if this is the actual cause, maybe just make the circle bigger? Or allow it to be built anywhere??