summaryrefslogtreecommitdiff
path: root/train_gui.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-10-03 21:20:01 +0000
committertron <tron@openttd.org>2005-10-03 21:20:01 +0000
commitdb3b1228bfad7fb42ce708dc93db21d840b07577 (patch)
tree4379525d1560a92903c1fdc87cdbad70a36ea271 /train_gui.c
parentb0a365ee676b8b612d88a3df1cac904db73e8bcf (diff)
downloadopenttd-db3b1228bfad7fb42ce708dc93db21d840b07577.tar.xz
(svn r3010) Get rid of quite some dubious casts, either by using GB(), proper types or just removing them
Diffstat (limited to 'train_gui.c')
-rw-r--r--train_gui.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/train_gui.c b/train_gui.c
index 4d8a69e57..2bed4cfb1 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -538,7 +538,7 @@ found_it:
return 0;
}
-static void TrainDepotMoveVehicle(Vehicle *wagon, int sel, Vehicle *head)
+static void TrainDepotMoveVehicle(Vehicle *wagon, VehicleID sel, Vehicle *head)
{
Vehicle *v;
@@ -559,13 +559,13 @@ static void TrainDepotMoveVehicle(Vehicle *wagon, int sel, Vehicle *head)
if (wagon == v)
return;
- DoCommandP(v->tile, v->index + ((wagon==NULL ? (uint32)-1 : wagon->index) << 16), _ctrl_pressed ? 1 : 0, NULL, CMD_MOVE_RAIL_VEHICLE | CMD_MSG(STR_8837_CAN_T_MOVE_VEHICLE));
+ DoCommandP(v->tile, v->index + ((wagon == NULL ? INVALID_VEHICLE : wagon->index) << 16), _ctrl_pressed ? 1 : 0, NULL, CMD_MOVE_RAIL_VEHICLE | CMD_MSG(STR_8837_CAN_T_MOVE_VEHICLE));
}
static void TrainDepotClickTrain(Window *w, int x, int y)
{
GetDepotVehiclePtData gdvp;
- int mode, sel;
+ int mode;
Vehicle *v;
mode = GetVehicleFromTrainDepotWndPt(w, x, y, &gdvp);
@@ -576,9 +576,10 @@ static void TrainDepotClickTrain(Window *w, int x, int y)
v = gdvp.wagon;
switch(mode) {
- case 0: // start dragging of vehicle
- sel = (int16)WP(w,traindepot_d).sel;
- if (sel != -1) {
+ case 0: { // start dragging of vehicle
+ VehicleID sel = WP(w, traindepot_d).sel;
+
+ if (sel != INVALID_VEHICLE) {
WP(w,traindepot_d).sel = INVALID_VEHICLE;
TrainDepotMoveVehicle(v, sel, gdvp.head);
} else if (v != NULL) {
@@ -587,6 +588,7 @@ static void TrainDepotClickTrain(Window *w, int x, int y)
SetWindowDirty(w);
}
break;
+ }
case -1: // show info window
ShowTrainViewWindow(v);