Old revision #ptsdqblf6 | New revision #pzkhn4386 | ||
---|---|---|---|
1 | /* This station can be used, add it to st1/st2 */ | 1 | /* This station can be used, add it to st1/st2 */ |
2 | if (owner == MAX_COMPANIES || owner == INVALID_OWNER || st->owner == OWNER_NONE || st->owner == owner) { | 2 | if (st1 == NULL) { |
3 | if (st1 == NULL || st->goods[type].rating >= best_rating1) { | 3 | st1 = st; best_rating1 = st->goods[type].rating; |
4 | } else if (owner == MAX_COMPANIES || st1->owner == OWNER_NONE || st->owner == OWNER_NONE || (st->owner == owner && st->owner == st1->owner) || (st->owner != owner && st1->owner != owner)) { | ||
5 | if (st->goods[type].rating >= best_rating1) { | ||
4 | st2 = st1; best_rating2 = best_rating1; st1 = st; best_rating1 = st->goods[type].rating; | 6 | st2 = st1; best_rating2 = best_rating1; st1 = st; best_rating1 = st->goods[type].rating; |
5 | } else if (st2 == NULL || st->goods[type].rating >= best_rating2 | 5 | } else if (st2 == NULL || st->goods[type].rating >= best_rating2 || (owner != MAX_COMPANIES && st2->owner != OWNER_NONE && st2->owner != st->owner)) { |
6 | st2 = st; best_rating2 = st->goods[type].rating; | 8 | st2 = st; best_rating2 = st->goods[type].rating; |
7 | } | 9 | } |
8 | } else { | 8 | } else if (st1->owner != owner && st->owner == owner) { |
9 | if (st1 == NULL) { | 9 | st2 = NULL; best_rating2 = 0; st1 = st; best_rating1 = st->goods[type].rating; |
10 | st1 = st; best_rating1 = st->goods[type].rating; | ||
11 | } else { | ||
12 | if (st->goods[type].rating >= best_rating1) { | ||
13 | if (st->owner == st1->owner && (st1->owner == owner || st1->owner == OWNER_NONE) || (st->owner != st1->owner && st1->owner != owner)) { | ||
14 | st2 = st1; best_rating2 = best_rating1; st1 = st; best_rating1 = st->goods[type].rating; | ||
15 | } | ||
16 | } else { | ||
17 | if (st2 == NULL) { | ||
18 | if (st->owner == st1->owner && (st1->owner == owner || st1->owner == OWNER_NONE) || (st->owner != st1->owner && st1->owner != owner)) { | ||
19 | st2 = st; best_rating2 = st->goods[type].rating; | ||
20 | } | ||
21 | } else { | ||
22 | if (st->goods[type].rating >= best_rating2) { | ||
23 | if (st->owner == st2->owner && (st2->owner == owner || st2->owner == OWNER_NONE) || (st->owner != st2->owner && st2->owner != owner)) { | ||
24 | st2 = st; best_rating2 = st->goods[type].rating; | ||
25 | } | ||
26 | } | ||
27 | } | ||
28 | } | ||
29 | } | ||
30 | } | 12 | } |
31 | } | 13 | } |