MCPcopy Create free account
hub / github.com/Norbyte/bg3se / ValidateParam

Method ValidateParam

BG3Extender/Osiris/Shared/CustomFunctions.cpp:33–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33bool CustomFunction::ValidateParam(CustomFunctionParam const & param, OsiArgumentValue const & value) const
34{
35 if (param.Type == ValueType::None
36 || param.Dir == FunctionArgumentDirection::Out) {
37 return true;
38 }
39
40 auto typeMap = *gExtender->GetServer().Osiris().GetWrappers().Globals.Types;
41 auto typeId = typeMap->ResolveAlias((uint32_t)value.TypeId);
42 auto paramTypeId = typeMap->ResolveAlias((uint32_t)param.Type);
43
44 if (typeId != paramTypeId) {
45 OsiError("Function " << name_ << "/" << params_.size() << ": Argument '" << param.Name
46 << "' type mismatch; expected " << (unsigned)paramTypeId << ", got " << (unsigned)typeId);
47 return false;
48 }
49
50 return true;
51}
52
53// FIXME - REMOVE - FunctionNameHash is the same
54uint32_t OsiTypeHash(char const* str)

Callers

nothing calls this directly

Calls 3

GetServerMethod · 0.80
ResolveAliasMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected