Index: lang/english.txt =================================================================== --- lang/english.txt (revision 6161) +++ lang/english.txt (working copy) @@ -2497,6 +2497,9 @@ STR_882D_VALUE :{LTBLUE}{STRING}{BLACK} Value: {LTBLUE}{CURRENCY} STR_882E :{WHITE}{VEHICLE} STR_882F_LOADING_UNLOADING :{LTBLUE}Loading / Unloading +STR_VEHICLE_LOADING :{LTBLUE}Loading {NUM}% +STR_VEHICLE_UNLOADING :{LTBLUE}Unloading +STR_VEHICLE_DEPARTING :{LTBLUE}Departing STR_TRAIN_MUST_BE_STOPPED :{WHITE}Train must be stopped inside a depot STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT :{WHITE}Can't send train to depot... STR_8831_NO_MORE_SPACE_FOR_ORDERS :{WHITE}No more space for orders Index: vehicle_gui.c =================================================================== --- vehicle_gui.c (revision 6161) +++ vehicle_gui.c (working copy) @@ -1194,3 +1194,32 @@ } } } +StringID VehicleLoadingProgress(const Vehicle *v) +{ + const Vehicle *u; + uint16 cargo_count=0, cargo_cap=0; + + u = v; + + do { + // cycle through all wagons, add currently loaded amount to cargo_count and wagon capacity + // to cargo_cap + cargo_count += u->cargo_count; + cargo_cap += u->cargo_cap; + } while ((u = u->next) != NULL); + + if (cargo_count == 0 && !(v->current_order.flags & OF_FULL_LOAD)) { + // Total cargo = 0 and order for current station is not Full Load means we're unloading + return STR_VEHICLE_UNLOADING; + } else { + if (cargo_count > 0) { + // common notation (cargo_count/cargo_cap)*100 won't work because uint16/uint16 returns a uint16 + // making the display show either 0% or 100% + SetDParam(0, ((cargo_count*100)/cargo_cap)); + } else { + // Can't divide by zero, so display 0% if total capacity if 0. + SetDParam(0, 0); + } + return STR_VEHICLE_LOADING; + } +} Index: vehicle_gui.h =================================================================== --- vehicle_gui.h (revision 6161) +++ vehicle_gui.h (working copy) @@ -52,6 +52,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number); void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v); +StringID VehicleLoadingProgress(const Vehicle *v); int ShowAdditionalText(int x, int y, int w, EngineID engine_number); Index: aircraft_gui.c =================================================================== --- aircraft_gui.c (revision 6161) +++ aircraft_gui.c (working copy) @@ -560,9 +560,10 @@ str = STR_HEADING_FOR_HANGAR + _patches.vehicle_speed; } break; - case OT_LOADING: - str = STR_882F_LOADING_UNLOADING; + case OT_LOADING: { + str = VehicleLoadingProgress(v); break; + } default: if (v->num_orders == 0) { Index: economy.c =================================================================== --- economy.c (revision 6161) +++ economy.c (working copy) @@ -1454,6 +1454,7 @@ if (result != 0) { InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); if (result & 2) InvalidateWindow(WC_STATION_VIEW, last_visited); Index: roadveh_gui.c =================================================================== --- roadveh_gui.c (revision 6161) +++ roadveh_gui.c (working copy) @@ -346,11 +346,16 @@ str = STR_HEADING_FOR_ROAD_DEPOT + _patches.vehicle_speed; } break; - case OT_LOADING: - case OT_LEAVESTATION: - str = STR_882F_LOADING_UNLOADING; + case OT_LOADING: { + str = VehicleLoadingProgress(v); break; + } + case OT_LEAVESTATION: { + str = STR_VEHICLE_DEPARTING; + break; + } + default: if (v->num_orders == 0) { str = STR_NO_ORDERS + _patches.vehicle_speed; Index: train_gui.c =================================================================== --- train_gui.c (revision 6161) +++ train_gui.c (working copy) @@ -979,11 +979,17 @@ SetDParam(1, v->u.rail.last_speed); } break; - case OT_LOADING: - case OT_LEAVESTATION: - str = STR_882F_LOADING_UNLOADING; + case OT_LOADING: { + str = VehicleLoadingProgress(v); break; + } + case OT_LEAVESTATION: { + str = STR_VEHICLE_DEPARTING; + SetDParam(0, v->current_order.dest.station); + break; + } + case OT_GOTO_WAYPOINT: { SetDParam(0, v->current_order.dest.waypoint); str = STR_HEADING_FOR_WAYPOINT + _patches.vehicle_speed; Index: ship_gui.c =================================================================== --- ship_gui.c (revision 6161) +++ ship_gui.c (working copy) @@ -493,11 +493,16 @@ str = STR_HEADING_FOR_SHIP_DEPOT + _patches.vehicle_speed; } break; - case OT_LOADING: - case OT_LEAVESTATION: - str = STR_882F_LOADING_UNLOADING; + case OT_LOADING: { + str = VehicleLoadingProgress(v); break; + } + case OT_LEAVESTATION: { + str = STR_VEHICLE_DEPARTING; + break; + } + default: if (v->num_orders == 0) { str = STR_NO_ORDERS + _patches.vehicle_speed;