MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / MakeVehicleButtonReference

Method MakeVehicleButtonReference

src/script/api/script_story_page.cpp:271–288  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

269}
270
271/* static */ ScriptStoryPage::StoryPageButtonFormatting ScriptStoryPage::MakeVehicleButtonReference(StoryPageButtonColour colour, StoryPageButtonFlags flags, StoryPageButtonCursor cursor, ScriptVehicle::VehicleType vehtype)
272{
273 EnforcePrecondition(UINT32_MAX, IsValidStoryPageButtonColour(colour));
274 EnforcePrecondition(UINT32_MAX, IsValidStoryPageButtonFlags(flags));
275 EnforcePrecondition(UINT32_MAX, IsValidStoryPageButtonCursor(cursor));
276 EnforcePrecondition(UINT32_MAX, vehtype == ScriptVehicle::VT_INVALID || vehtype == ScriptVehicle::VT_RAIL || vehtype == ScriptVehicle::VT_ROAD || vehtype == ScriptVehicle::VT_WATER || vehtype == ScriptVehicle::VT_AIR);
277
278 StoryPageButtonData data;
279 data.SetColour((::Colours)colour);
280 data.SetFlags((::StoryPageButtonFlags)flags);
281 data.SetCursor((::StoryPageButtonCursor)cursor);
282 data.SetVehicleType((::VehicleType)vehtype);
283 if (!data.ValidateColour()) return UINT32_MAX;
284 if (!data.ValidateFlags()) return UINT32_MAX;
285 if (!data.ValidateCursor()) return UINT32_MAX;
286 if (!data.ValidateVehicleType()) return UINT32_MAX;
287 return data.referenced_id;
288}

Callers

nothing calls this directly

Calls 9

SetFlagsMethod · 0.80
SetCursorMethod · 0.80
SetVehicleTypeMethod · 0.80
ValidateColourMethod · 0.80
ValidateFlagsMethod · 0.80
ValidateCursorMethod · 0.80
ValidateVehicleTypeMethod · 0.80
SetColourMethod · 0.45

Tested by

no test coverage detected