MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ExtractValue

Function ExtractValue

engine/Poseidon/UI/Map/UIMapExtDisplay.cpp:1031–1085  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1029 return dst;
1030}
1031
1032static RString ExtractValue(RString name, const EditorParams& params, const Arguments& args, bool& required)
1033{
1034 const EditorParam* param = params.Find(name);
1035 if (!param)
1036 {
1037 LOG_ERROR(UI, "Undeclared parameter: {}", (const char*)name);
1038 return "ERROR";
1039 }
1040
1041 switch (param->source)
1042 {
1043 case EPSLink:
1044 {
1045 if (stricmp(param->subtype, "single") == 0)
1046 {
1047 // no default value
1048 required = true;
1049 return args.Get(name);
1050 }
1051 else
1052 {
1053 RString value = "[";
1054 bool first = true;
1055 for (int i = 0; i < args.Size(); i++)
1056 {
1057 if (args[i].name != name)
1058 continue;
1059 if (first)
1060 first = false;
1061 else
1062 value = value + ", ";
1063 value = value + args[i].value;
1064 }
1065 if (!first)
1066 required = true;
1067 return value + "]";
1068 }
1069 }
1070 default:
1071 {
1072 RString value = args.Get(name);
1073
1074 if (!param->hasDefValue || value != param->defValue)
1075 required = true;
1076
1077 if (stricmp(param->type, "text") == 0)
1078 return RString("\"") + NormalizeString(value) + RString("\"");
1079 else if (stricmp(param->type, "enum") == 0)
1080 return RString("\"") + value + RString("\"");
1081 else if (stricmp(param->type, "config") == 0)
1082 return RString("\"") + value + RString("\"");
1083 return value;
1084 }
1085 }
1086}
1087
1088#define PARSING_COMMENT "."

Callers 2

CreateOnValueFunction · 0.85
CreateOnExpressionFunction · 0.85

Calls 6

NormalizeStringFunction · 0.85
stricmpFunction · 0.50
RStringClass · 0.50
FindMethod · 0.45
GetMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected