/* This station can be used, add it to st1/st2 */ if (owner == MAX_COMPANIES || owner == INVALID_OWNER || st->owner == OWNER_NONE || st->owner == owner) { if (st1 == NULL || st->goods[type].rating >= best_rating1) { st2 = st1; best_rating2 = best_rating1; st1 = st; best_rating1 = st->goods[type].rating; } else if (st2 == NULL || st->goods[type].rating >= best_rating2) { st2 = st; best_rating2 = st->goods[type].rating; } } else { if (st1 == NULL) { st1 = st; best_rating1 = st->goods[type].rating; } else { if (st->goods[type].rating >= best_rating1) { if (st->owner == st1->owner && (st1->owner == owner || st1->owner == OWNER_NONE) || (st->owner != st1->owner && st1->owner != owner)) { st2 = st1; best_rating2 = best_rating1; st1 = st; best_rating1 = st->goods[type].rating; } } else { if (st2 == NULL) { if (st->owner == st1->owner && (st1->owner == owner || st1->owner == OWNER_NONE) || (st->owner != st1->owner && st1->owner != owner)) { st2 = st; best_rating2 = st->goods[type].rating; } } else { if (st->goods[type].rating >= best_rating2) { if (st->owner == st2->owner && (st2->owner == owner || st2->owner == OWNER_NONE) || (st->owner != st2->owner && st2->owner != owner)) { st2 = st; best_rating2 = st->goods[type].rating; } } } } } } }