Old revision #ptsdqblf6 | New revision #pzk83sgm1 | ||
---|---|---|---|
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 | 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) { | ||
6 | st2 = st; best_rating2 = st->goods[type].rating; | ||
7 | } | ||
8 | } else { | 4 | } else { |
9 | if (st1 == NULL) { | 5 | 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)) { |
10 | st1 = st; best_rating1 = st->goods[type].rating; | 6 | if (st->goods[type].rating >= best_rating1) { |
7 | st2 = st1; best_rating2 = best_rating1; st1 = st; best_rating1 = st->goods[type].rating; | ||
8 | } else { | ||
9 | if (st2 == NULL || st->goods[type].rating >= best_rating2 || (owner != MAX_COMPANIES && st2->owner != OWNER_NONE && st2->owner != st->owner)) { | ||
10 | st2 = st; best_rating2 = st->goods[type].rating; | ||
11 | } | ||
12 | } | ||
11 | } else { | 13 | } else { |
12 | if (st->goods[type].rating >= best_rating1) { | 12 | if (st1->owner != owner && st->owner == owner) { |
13 | if (st->owner == st1->owner && (st1->owner == owner || st1->owner == OWNER_NONE) || (st->owner != st1->owner && st1->owner != owner)) { | 13 | st2 = NULL; best_rating2 = 0; st1 = st; best_rating1 = st->goods[type].rating; |
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 | } | 16 | } |
29 | } | 17 | } |
30 | } | 18 | } |