@@ -1208,10 +1208,10 @@ void ShowDepotTooltip(Window *w, const TileIndex tile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct depot_totals {
|
struct depot_totals {
|
||||||
size_t total_vehicle_count = 0;
|
uint total_vehicle_count = 0;
|
||||||
size_t stopped_vehicle_count = 0;
|
uint stopped_vehicle_count = 0;
|
||||||
size_t waiting_vehicle_count = 0;
|
uint waiting_vehicle_count = 0;
|
||||||
size_t consist_count = 0;
|
uint free_wagon_count = 0;
|
||||||
};
|
};
|
||||||
depot_totals totals;
|
depot_totals totals;
|
||||||
|
|
||||||
@@ -1224,9 +1224,11 @@ void ShowDepotTooltip(Window *w, const TileIndex tile)
|
|||||||
if (v->IsStoppedInDepot()) totals->stopped_vehicle_count++;
|
if (v->IsStoppedInDepot()) totals->stopped_vehicle_count++;
|
||||||
}
|
}
|
||||||
if (v->type == VEH_TRAIN) {
|
if (v->type == VEH_TRAIN) {
|
||||||
if (Train::From(v)->IsFreeWagon()) {
|
const Train *t = Train::From(v);
|
||||||
totals->consist_count++;
|
if (t->IsFreeWagon()) {
|
||||||
totals->total_vehicle_count++;
|
for (const Train *u = t; u != nullptr; u = u->GetNextUnit()) {
|
||||||
|
totals->free_wagon_count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1234,20 +1236,22 @@ void ShowDepotTooltip(Window *w, const TileIndex tile)
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (totals.total_vehicle_count == 0) {
|
if (totals.total_vehicle_count == 0) {
|
||||||
|
if (totals.free_wagon_count > 0) {
|
||||||
|
SetDParam(0, totals.free_wagon_count);
|
||||||
|
GuiShowTooltips(w, STR_DEPOT_VIEW_FREE_WAGONS_TOOLTIP, 0, nullptr, TCC_HOVER_VIEWPORT);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringID str;
|
StringID str;
|
||||||
|
|
||||||
SetDParam(0, totals.total_vehicle_count);
|
SetDParam(0, totals.total_vehicle_count);
|
||||||
if (_settings_client.gui.depot_tooltip_mode == DTM_SIMPLE || (totals.stopped_vehicle_count == 0 && totals.waiting_vehicle_count == 0 && totals.consist_count == 0)) {
|
if (_settings_client.gui.depot_tooltip_mode == DTM_SIMPLE || (totals.stopped_vehicle_count == 0 && totals.waiting_vehicle_count == 0)) {
|
||||||
str = STR_DEPOT_VIEW_COUNT_TOOLTIP;
|
str = STR_DEPOT_VIEW_COUNT_TOOLTIP;
|
||||||
} else if (_settings_client.gui.depot_tooltip_mode == DTM_DETAILED && totals.total_vehicle_count == totals.stopped_vehicle_count) {
|
} else if (totals.total_vehicle_count == totals.stopped_vehicle_count) {
|
||||||
str = STR_DEPOT_VIEW_COUNT_STOPPED_TOOLTIP;
|
str = STR_DEPOT_VIEW_COUNT_STOPPED_TOOLTIP;
|
||||||
} else if (_settings_client.gui.depot_tooltip_mode == DTM_DETAILED && totals.total_vehicle_count == totals.waiting_vehicle_count) {
|
} else if (totals.total_vehicle_count == totals.waiting_vehicle_count) {
|
||||||
str = STR_DEPOT_VIEW_COUNT_WAITING_TOOLTIP;
|
str = STR_DEPOT_VIEW_COUNT_WAITING_TOOLTIP;
|
||||||
} else if (_settings_client.gui.depot_tooltip_mode == DTM_DETAILED && totals.total_vehicle_count == totals.consist_count) {
|
|
||||||
str = STR_DEPOT_VIEW_COUNT_CONSISTS_TOOLTIP;
|
|
||||||
} else {
|
} else {
|
||||||
str = SPECSTR_TEMP_START;
|
str = SPECSTR_TEMP_START;
|
||||||
_temp_special_strings[0] = GetString(STR_DEPOT_VIEW_TOTAL_TOOLTIP);
|
_temp_special_strings[0] = GetString(STR_DEPOT_VIEW_TOTAL_TOOLTIP);
|
||||||
@@ -1259,10 +1263,15 @@ void ShowDepotTooltip(Window *w, const TileIndex tile)
|
|||||||
SetDParam(0, totals.waiting_vehicle_count);
|
SetDParam(0, totals.waiting_vehicle_count);
|
||||||
_temp_special_strings[0] += GetString(STR_DEPOT_VIEW_WAITING_TOOLTIP);
|
_temp_special_strings[0] += GetString(STR_DEPOT_VIEW_WAITING_TOOLTIP);
|
||||||
}
|
}
|
||||||
if (totals.consist_count > 0) {
|
|
||||||
SetDParam(0, totals.consist_count);
|
|
||||||
_temp_special_strings[0] += GetString(STR_DEPOT_VIEW_CONSISTS_TOOLTIP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (totals.free_wagon_count > 0) {
|
||||||
|
SetDParam(0, str);
|
||||||
|
SetDParam(1, totals.total_vehicle_count);
|
||||||
|
SetDParam(2, STR_DEPOT_VIEW_FREE_WAGONS_TOOLTIP);
|
||||||
|
SetDParam(3, totals.free_wagon_count);
|
||||||
|
str = STR_DEPOT_VIEW_MIXED_CONTENTS_TOOLTIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiShowTooltips(w, str, 0, nullptr, TCC_HOVER_VIEWPORT);
|
GuiShowTooltips(w, str, 0, nullptr, TCC_HOVER_VIEWPORT);
|
||||||
}
|
}
|
||||||
|
@@ -1411,14 +1411,14 @@ STR_INDUSTRY_VIEW_REQUIRED_TOOLTIP_NEXT :, {STRING}{RAW_
|
|||||||
STR_INDUSTRY_VIEW_STOCKPILED_TOOLTIP :{CARGO_LONG} waiting{RAW_STRING}
|
STR_INDUSTRY_VIEW_STOCKPILED_TOOLTIP :{CARGO_LONG} waiting{RAW_STRING}
|
||||||
STR_INDUSTRY_VIEW_TRANSPORTED_TOOLTIP_EXTENSION :{CARGO_LONG}{RAW_STRING} ({COMMA}%)
|
STR_INDUSTRY_VIEW_TRANSPORTED_TOOLTIP_EXTENSION :{CARGO_LONG}{RAW_STRING} ({COMMA}%)
|
||||||
|
|
||||||
STR_DEPOT_VIEW_COUNT_TOOLTIP :{BLACK}{COMMA} vehicle{P "" s} {P is are} inside
|
STR_DEPOT_VIEW_COUNT_TOOLTIP :{BLACK}{COMMA} vehicle{P "" s} inside
|
||||||
STR_DEPOT_VIEW_COUNT_STOPPED_TOOLTIP :{BLACK}{COMMA} stopped vehicle{P "" s} {P is are} inside
|
STR_DEPOT_VIEW_COUNT_STOPPED_TOOLTIP :{BLACK}{COMMA} stopped vehicle{P "" s} inside
|
||||||
STR_DEPOT_VIEW_COUNT_WAITING_TOOLTIP :{BLACK}{COMMA} waiting vehicle{P "" s} {P is are} inside
|
STR_DEPOT_VIEW_COUNT_WAITING_TOOLTIP :{BLACK}{COMMA} waiting vehicle{P "" s} inside
|
||||||
STR_DEPOT_VIEW_COUNT_CONSISTS_TOOLTIP :{BLACK}{COMMA} consist{P "" s} {P is are} inside
|
STR_DEPOT_VIEW_TOTAL_TOOLTIP :{BLACK}{COMMA} vehicles inside:
|
||||||
STR_DEPOT_VIEW_TOTAL_TOOLTIP :{BLACK}Of {COMMA} vehicles inside:
|
|
||||||
STR_DEPOT_VIEW_STOPPED_TOOLTIP :{}{COMMA} {P is are} stopped
|
STR_DEPOT_VIEW_STOPPED_TOOLTIP :{}{COMMA} {P is are} stopped
|
||||||
STR_DEPOT_VIEW_WAITING_TOOLTIP :{}{COMMA} {P is are} waiting
|
STR_DEPOT_VIEW_WAITING_TOOLTIP :{}{COMMA} {P is are} waiting
|
||||||
STR_DEPOT_VIEW_CONSISTS_TOOLTIP :{}{COMMA} {P is are} {P "a " ""}consist{P "" s}
|
STR_DEPOT_VIEW_FREE_WAGONS_TOOLTIP :{BLACK}{COMMA} wagon{P "" s} inside
|
||||||
|
STR_DEPOT_VIEW_MIXED_CONTENTS_TOOLTIP :{BLACK}{STRING1}{}{STRING1}
|
||||||
|
|
||||||
STR_STATION_VIEW_NAME_TOOLTIP :{STATION}{NBSP}{STATION_FEATURES}
|
STR_STATION_VIEW_NAME_TOOLTIP :{STATION}{NBSP}{STATION_FEATURES}
|
||||||
STR_STATION_VIEW_CARGO_LINE_TOOLTIP :{STRING} ({COMMA}%): {CARGO_SHORT}
|
STR_STATION_VIEW_CARGO_LINE_TOOLTIP :{STRING} ({COMMA}%): {CARGO_SHORT}
|
||||||
|
Reference in New Issue
Block a user