diff options
author | peter1138 <peter1138@openttd.org> | 2006-10-11 18:57:02 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-10-11 18:57:02 +0000 |
commit | 1926d978884ce5d0a5b9765ec0281281dfee4409 (patch) | |
tree | acd5de70cd70f1976fea81f39d5fbf4b33294697 | |
parent | 75fe56eff07f746b7884411b879cb8d6938aab0a (diff) | |
download | openttd-1926d978884ce5d0a5b9765ec0281281dfee4409.tar.xz |
(svn r6738) - Fix (r2441): Only apply the virtual transfer profit if the order is a transfer order, rather than to any unload order. This fixes an issue where the AI doesn't know that a route is unprofitable.
-rw-r--r-- | economy.c | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -1302,7 +1302,7 @@ static bool LoadWait(const Vehicle* v, const Vehicle* u) int LoadUnloadVehicle(Vehicle *v) { int profit = 0; - int v_profit; //virtual profit for feeder systems + int v_profit = 0; //virtual profit for feeder systems int v_profit_total = 0; int unloading_time = 20; Vehicle *u = v; @@ -1345,13 +1345,15 @@ int LoadUnloadVehicle(Vehicle *v) /* unload goods and let it wait at the station */ st->time_since_unload = 0; - v_profit = GetTransportedGoodsIncome( - v->cargo_count, - DistanceManhattan(GetStation(v->cargo_source)->xy, GetStation(last_visited)->xy), - v->cargo_days, - v->cargo_type) * 3 / 2; + if (u->current_order.flags & OF_TRANSFER) { + v_profit = GetTransportedGoodsIncome( + v->cargo_count, + DistanceManhattan(GetStation(v->cargo_source)->xy, GetStation(last_visited)->xy), + v->cargo_days, + v->cargo_type) * 3 / 2; - v_profit_total += v_profit; + v_profit_total += v_profit; + } unloading_time += v->cargo_count; t = GB(ge->waiting_acceptance, 0, 12); @@ -1368,8 +1370,11 @@ int LoadUnloadVehicle(Vehicle *v) } // Update amount of waiting cargo SB(ge->waiting_acceptance, 0, 12, min(v->cargo_count + t, 0xFFF)); - ge->feeder_profit += v_profit; - u->profit_this_year += v_profit; + + if (u->current_order.flags & OF_TRANSFER) { + ge->feeder_profit += v_profit; + u->profit_this_year += v_profit; + } result |= 2; v->cargo_count = 0; } |