Fix tooltip string parameters, change function signatures to match upstream

This commit is contained in:
Jonathan G Rennison
2023-11-17 17:26:57 +00:00
parent 9ceef09e9c
commit c76dc937e3
20 changed files with 96 additions and 110 deletions

View File

@@ -423,9 +423,7 @@ public:
}
/* Build tooltipstring */
static char details[1024];
details[0] = '\0';
char *pos = details;
std::string details;
for (CargoID cargo_type = 0; cargo_type < NUM_CARGO; cargo_type++) {
if (capacity[cargo_type] == 0) continue;
@@ -434,14 +432,13 @@ public:
SetDParam(1, loaded[cargo_type]); // {CARGO} #2
SetDParam(2, cargo_type); // {SHORTCARGO} #1
SetDParam(3, capacity[cargo_type]); // {SHORTCARGO} #2
pos = GetString(pos, STR_DEPOT_VEHICLE_TOOLTIP_CARGO, lastof(details));
details = GetString(STR_DEPOT_VEHICLE_TOOLTIP_CARGO);
}
/* Show tooltip window */
uint64 args[2];
args[0] = (whole_chain ? num : v->engine_type);
args[1] = (uint64)(size_t)details;
GuiShowTooltips(this, whole_chain ? STR_DEPOT_VEHICLE_TOOLTIP_CHAIN : STR_DEPOT_VEHICLE_TOOLTIP, 2, args, TCC_RIGHT_CLICK);
SetDParam(0, whole_chain ? num : v->engine_type);
SetDParamStr(1, std::move(details));
GuiShowTooltips(this, whole_chain ? STR_DEPOT_VEHICLE_TOOLTIP_CHAIN : STR_DEPOT_VEHICLE_TOOLTIP, TCC_RIGHT_CLICK, 2);
return true;
}