//
// insert code here to check if the second road is actually better than the first road built (if one was built) !!
// otherwise, don't build.
//
if (true) {
if (roads_built >= 1) {
AILogDebug["util_build_best_road"] << name << " TODO - check to see if this road is better than the first one built!";
}
AILogDebug["util_build_best_road"] << name << " about to build road, dumping some road stats. source=" << road.get_source() << ", end=" << road.get_end(game->get_map().get());
AILogDebug["util_build_best_road"] << name << " thread #" << std::this_thread::get_id() << " AI is locking mutex before calling game->build_road (non-direct road)";
game->get_mutex()->lock();
AILogDebug["util_build_best_road"] << name << " thread #" << std::this_thread::get_id() << " AI has locked mutex before calling game->build_road (non-direct road)";
bool was_built = game->build_road(road, game->get_player(player_index));
AILogDebug["util_build_best_road"] << name << " thread #" << std::this_thread::get_id() << " AI is unlocking mutex after calling game->build_road (non-direct road)";
game->get_mutex()->unlock();
AILogDebug["util_build_best_road"] << name << " thread #" << std::this_thread::get_id() << " AI has unlocked mutex after calling game->build_road (non-direct road)";
if (was_built) {
AILogDebug["util_build_best_road"] << name << " successfully built road from " << start_pos << " to " << end_pos << " as specified in PotentialRoad";
roads_built++;
continue;
}
else {
AILogDebug["util_build_best_road"] << name << " ERROR - failed to build road from " << start_pos << " to " << end_pos << ", FIND OUT WHY! trying next best solution...";
}
}
else {
AILogDebug["util_build_best_road"] << name << " last road built is better than this proposed one, not building second road (should only happy for dual-affinity buildings)";
}