mirror of https://github.com/OpenTTD/OpenTTD
(svn r1652) Fix: train and road vehicle lists are now redrawn when vehicles enters/leaves a depot (Hackykid)
fix: the ship status bar was not updated properly after a breakdown if show_speed was off (Hackykid)release/0.4.5
parent
ffb2c4de77
commit
e006f89aa3
|
@ -1029,15 +1029,15 @@ static void ProcessAircraftOrder(Vehicle *v)
|
||||||
v->current_order.type == OT_LOADING) {
|
v->current_order.type == OT_LOADING) {
|
||||||
if (v->current_order.type != OT_GOTO_DEPOT ||
|
if (v->current_order.type != OT_GOTO_DEPOT ||
|
||||||
!(v->current_order.flags & OF_UNLOAD))
|
!(v->current_order.flags & OF_UNLOAD))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
if (v->current_order.type == OT_GOTO_DEPOT &&
|
||||||
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
|
||||||
!VehicleNeedsService(v) &&
|
!VehicleNeedsService(v) &&
|
||||||
v->set_for_replacement == false) {
|
v->set_for_replacement == false) {
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->cur_order_index >= v->num_orders)
|
if (v->cur_order_index >= v->num_orders)
|
||||||
v->cur_order_index = 0;
|
v->cur_order_index = 0;
|
||||||
|
|
|
@ -515,7 +515,7 @@ static void RoadVehCheckTrainCrash(Vehicle *v)
|
||||||
|
|
||||||
// Make sure it's a road/rail crossing
|
// Make sure it's a road/rail crossing
|
||||||
if (!IsTileType(tile, MP_STREET) ||
|
if (!IsTileType(tile, MP_STREET) ||
|
||||||
(_map5[tile] & 0xF0) != 0x10)
|
(_map5[tile] & 0xF0) != 0x10)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (VehicleFromPos(tile, v, (VehicleFromPosProc*)EnumCheckRoadVehCrashTrain) != NULL)
|
if (VehicleFromPos(tile, v, (VehicleFromPosProc*)EnumCheckRoadVehCrashTrain) != NULL)
|
||||||
|
@ -671,7 +671,7 @@ static void *EnumCheckRoadVehClose(Vehicle *v, RoadVehFindData *rvf)
|
||||||
(_dists[v->direction] > 0 && (x_diff >= _dists[v->direction] || x_diff < 0)) ||
|
(_dists[v->direction] > 0 && (x_diff >= _dists[v->direction] || x_diff < 0)) ||
|
||||||
(_dists[v->direction+8] < 0 && (y_diff <= _dists[v->direction+8] || y_diff > 0)) ||
|
(_dists[v->direction+8] < 0 && (y_diff <= _dists[v->direction+8] || y_diff > 0)) ||
|
||||||
(_dists[v->direction+8] > 0 && (y_diff >= _dists[v->direction+8] || y_diff < 0)))
|
(_dists[v->direction+8] > 0 && (y_diff >= _dists[v->direction+8] || y_diff < 0)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -1408,6 +1408,7 @@ void RoadVehEnterDepot(Vehicle *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
||||||
|
InvalidateWindowClasses(WC_ROADVEH_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AgeRoadVehCargo(Vehicle *v)
|
static void AgeRoadVehCargo(Vehicle *v)
|
||||||
|
@ -1504,7 +1505,7 @@ void OnNewDay_RoadVeh(Vehicle *v)
|
||||||
SubtractMoneyFromPlayerFract(v->owner, cost);
|
SubtractMoneyFromPlayerFract(v->owner, cost);
|
||||||
|
|
||||||
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
||||||
InvalidateWindow(WC_ROADVEH_LIST, v->owner);
|
InvalidateWindowClasses(WC_ROADVEH_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleClickOnRoadVeh(Vehicle *v)
|
void HandleClickOnRoadVeh(Vehicle *v)
|
||||||
|
|
|
@ -822,7 +822,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
|
||||||
DrawVehicleProfitButton(v, x, y + 13);
|
DrawVehicleProfitButton(v, x, y + 13);
|
||||||
|
|
||||||
SetDParam(0, v->unitnumber);
|
SetDParam(0, v->unitnumber);
|
||||||
if (IsRoadDepotTile(v->tile))
|
if (IsRoadDepotTile(v->tile) && (v->vehstatus & VS_HIDDEN))
|
||||||
str = STR_021F;
|
str = STR_021F;
|
||||||
else
|
else
|
||||||
str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2;
|
str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2;
|
||||||
|
|
|
@ -175,7 +175,7 @@ static void HandleBrokenShip(Vehicle *v)
|
||||||
if (!(v->tick_counter & 1)) {
|
if (!(v->tick_counter & 1)) {
|
||||||
if (!--v->breakdown_delay) {
|
if (!--v->breakdown_delay) {
|
||||||
v->breakdown_ctr = 0;
|
v->breakdown_ctr = 0;
|
||||||
InvalidateWindowClasses(WC_SHIPS_LIST);
|
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
15
train_cmd.c
15
train_cmd.c
|
@ -1336,15 +1336,21 @@ static bool CheckTrainStayInDepot(Vehicle *v)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (v->u.rail.force_proceed == 0) {
|
if (v->u.rail.force_proceed == 0) {
|
||||||
if (++v->load_unload_time_rem < 37)
|
if (++v->load_unload_time_rem < 37) {
|
||||||
|
InvalidateWindowClasses(WC_TRAINS_LIST);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
v->load_unload_time_rem = 0;
|
v->load_unload_time_rem = 0;
|
||||||
|
|
||||||
if (UpdateSignalsOnSegment(v->tile, v->direction))
|
if (UpdateSignalsOnSegment(v->tile, v->direction)) {
|
||||||
|
InvalidateWindowClasses(WC_TRAINS_LIST);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VehicleServiceInDepot(v);
|
VehicleServiceInDepot(v);
|
||||||
|
InvalidateWindowClasses(WC_TRAINS_LIST);
|
||||||
TrainPlayLeaveStationSound(v);
|
TrainPlayLeaveStationSound(v);
|
||||||
|
|
||||||
v->u.rail.track = 1;
|
v->u.rail.track = 1;
|
||||||
|
@ -2485,7 +2491,7 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
|
||||||
/* Calculate next tile */
|
/* Calculate next tile */
|
||||||
tile += TileOffsByDir(t);
|
tile += TileOffsByDir(t);
|
||||||
// determine the track status on the next tile.
|
// determine the track status on the next tile.
|
||||||
ts = GetTileTrackStatus(tile, TRANSPORT_RAIL) & _reachable_tracks[t];
|
ts = GetTileTrackStatus(tile, TRANSPORT_RAIL) & _reachable_tracks[t];
|
||||||
|
|
||||||
/* Calc position within the current tile ?? */
|
/* Calc position within the current tile ?? */
|
||||||
x = v->x_pos & 0xF;
|
x = v->x_pos & 0xF;
|
||||||
|
@ -2690,6 +2696,7 @@ void TrainEnterDepot(Vehicle *v, uint tile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
InvalidateWindowClasses(WC_TRAINS_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CheckIfTrainNeedsService(Vehicle *v)
|
static void CheckIfTrainNeedsService(Vehicle *v)
|
||||||
|
@ -2797,7 +2804,7 @@ void OnNewDay_Train(Vehicle *v)
|
||||||
SubtractMoneyFromPlayerFract(v->owner, cost);
|
SubtractMoneyFromPlayerFract(v->owner, cost);
|
||||||
|
|
||||||
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
||||||
InvalidateWindow(WC_TRAINS_LIST, v->owner);
|
InvalidateWindowClasses(WC_TRAINS_LIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1319,7 +1319,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
|
||||||
DrawVehicleProfitButton(v, x, y + 13);
|
DrawVehicleProfitButton(v, x, y + 13);
|
||||||
|
|
||||||
SetDParam(0, v->unitnumber);
|
SetDParam(0, v->unitnumber);
|
||||||
if (IsTrainDepotTile(v->tile))
|
if (IsTrainDepotTile(v->tile) && (v->vehstatus & VS_HIDDEN))
|
||||||
str = STR_021F;
|
str = STR_021F;
|
||||||
else
|
else
|
||||||
str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2;
|
str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2;
|
||||||
|
|
Loading…
Reference in New Issue