summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-01-23 22:01:51 +0000
committerbjarni <bjarni@openttd.org>2005-01-23 22:01:51 +0000
commit6510b12203b0770d111055e5112e9a824d0f7dc7 (patch)
tree7af224941eb94f777a9d568f72669a0e333a159e /train_cmd.c
parentdd6a6fa7ecd3f7f7389ea4ac86cbb03875d16caa (diff)
downloadopenttd-6510b12203b0770d111055e5112e9a824d0f7dc7.tar.xz
(svn r1629) added a counter to tell how many engines you have of each type to the autoreplace vehicle windows and made them show only the vehicles you actually have in the left list.
this also fixes some window updates issues when autoreplacing
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/train_cmd.c b/train_cmd.c
index debea41c8..c871764d1 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -486,6 +486,9 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
_cmd_build_rail_veh_var1 = _railveh_unk1[p1];
_cmd_build_rail_veh_score = _railveh_score[p1];
+
+ InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window
+
return value;
}
@@ -847,6 +850,7 @@ int32 CmdSellRailWagon(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
if (last) cost -= last->value;
}
+ InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window
return cost;
}
@@ -2399,8 +2403,10 @@ static void HandleCrashedTrain(Vehicle *v)
ChangeTrainDirRandomly(v);
}
- if (state >= 4440 && !(v->tick_counter&0x1F))
+ if (state >= 4440 && !(v->tick_counter&0x1F)) {
DeleteLastWagon(v);
+ InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train);
+ }
}
static void HandleBrokenTrain(Vehicle *v)