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

Function GetGRFStringTextStackParameters

src/newgrf_text.cpp:977–990  ·  view source on GitHub ↗

* Process the text ref stack for a GRF String and return its parameters. * @param grffile GRFFile of string. * @param stringid StringID of string. * @param textstack Text parameter stack. * @returns Parameters for GRF string. */

Source from the content-addressed store, hash-verified

975 * @returns Parameters for GRF string.
976 */
977std::vector<StringParameter> GetGRFStringTextStackParameters(const GRFFile *grffile, StringID stringid, std::span<const int32_t> textstack)
978{
979 if (stringid == INVALID_STRING_ID) return {};
980
981 auto str = GetStringPtr(stringid);
982
983 std::vector<StringParameter> params;
984 params.reserve(20);
985
986 TextRefStack stack{grffile, textstack};
987 HandleNewGRFStringControlCodes(str, stack, params);
988
989 return params;
990}
991
992/**
993 * Format a GRF string using the text ref stack for parameters.

Calls 3

GetStringPtrFunction · 0.85
reserveMethod · 0.80

Tested by

no test coverage detected