summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-11-03 20:19:15 +0000
committerbjarni <bjarni@openttd.org>2005-11-03 20:19:15 +0000
commitb950fee1190c5325be9657573e1e243737ac96bb (patch)
tree43b64f1282b23022bb368f0984a295691d2a7991
parent80af1ebca8ea5c28f5f85697fe8ff4524f7cde0c (diff)
downloadopenttd-b950fee1190c5325be9657573e1e243737ac96bb.tar.xz
(svn r3128) -Fix: [autoreplace] fixed bug that made the player pay twice for autoreplacing and could end up with negative money
-rw-r--r--vehicle.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/vehicle.c b/vehicle.c
index 47a686f8a..b642dacea 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1616,7 +1616,7 @@ static void MaybeReplaceVehicle(Vehicle *v)
Vehicle *w;
const Player *p = GetPlayer(v->owner);
byte flags = 0;
- int32 cost = 0, temp_cost = 0;
+ int32 cost, temp_cost = 0;
bool stopped = false;
_current_player = v->owner;
@@ -1632,6 +1632,7 @@ static void MaybeReplaceVehicle(Vehicle *v)
}
while (true) {
+ cost = 0;
w = v;
do {
// check if the vehicle should be replaced