MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / FindDataMapOffs

Function FindDataMapOffs

core/smn_entities.cpp:1091–1129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1089}
1090
1091static cell_t FindDataMapOffs(IPluginContext *pContext, const cell_t *params)
1092{
1093 CBaseEntity *pEntity;
1094 datamap_t *pMap;
1095 typedescription_t *td;
1096 char *offset;
1097 pEntity = GetEntity(params[1]);
1098
1099 if (!pEntity)
1100 {
1101 return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
1102 }
1103
1104 if ((pMap=CBaseEntity_GetDataDescMap(pEntity)) == NULL)
1105 {
1106 return pContext->ThrowNativeError("Unable to retrieve GetDataDescMap offset");
1107 }
1108
1109 pContext->LocalToString(params[2], &offset);
1110 sm_datatable_info_t info;
1111 if (!g_HL2.FindDataMapInfo(pMap, offset, &info))
1112 {
1113 return -1;
1114 }
1115
1116 td = info.prop;
1117
1118 if (params[0] == 4)
1119 {
1120 cell_t *pType, *pSize;
1121
1122 pContext->LocalToPhysAddr(params[3], &pType);
1123 pContext->LocalToPhysAddr(params[4], &pSize);
1124
1125 GuessDataPropTypes(td, pSize, pType);
1126 }
1127
1128 return GetTypeDescOffs(td);
1129}
1130
1131static cell_t FindDataMapInfo(IPluginContext *pContext, const cell_t *params)
1132{

Callers

nothing calls this directly

Calls 6

GuessDataPropTypesFunction · 0.85
GetTypeDescOffsFunction · 0.85
ReferenceToIndexMethod · 0.80
FindDataMapInfoMethod · 0.80
GetEntityFunction · 0.70

Tested by

no test coverage detected