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

Function FindDataMapInfo

core/smn_entities.cpp:1131–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1129}
1130
1131static cell_t FindDataMapInfo(IPluginContext *pContext, const cell_t *params)
1132{
1133 CBaseEntity *pEntity;
1134 datamap_t *pMap;
1135 typedescription_t *td;
1136 char *offset;
1137 pEntity = GetEntity(params[1]);
1138
1139 if (!pEntity)
1140 {
1141 return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]);
1142 }
1143
1144 if ((pMap=CBaseEntity_GetDataDescMap(pEntity)) == NULL)
1145 {
1146 return pContext->ThrowNativeError("Unable to retrieve GetDataDescMap offset");
1147 }
1148
1149 pContext->LocalToString(params[2], &offset);
1150 sm_datatable_info_t info;
1151 if (!g_HL2.FindDataMapInfo(pMap, offset, &info))
1152 {
1153 return -1;
1154 }
1155
1156 td = info.prop;
1157
1158 if (params[0] >= 4)
1159 {
1160 cell_t *pType, *pSize;
1161
1162 pContext->LocalToPhysAddr(params[3], &pType);
1163 pContext->LocalToPhysAddr(params[4], &pSize);
1164
1165 GuessDataPropTypes(td, pSize, pType);
1166
1167 if (params[0] == 5)
1168 {
1169 cell_t *pLocalOffs;
1170
1171 pContext->LocalToPhysAddr(params[5], &pLocalOffs);
1172
1173 *pLocalOffs = GetTypeDescOffs(info.prop);
1174 }
1175 }
1176
1177 return info.actual_offset;
1178}
1179
1180static cell_t GetEntDataString(IPluginContext *pContext, const cell_t *params)
1181{

Callers 2

GetEntityClassnameMethod · 0.85
AllocPooledStringMethod · 0.85

Calls 6

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

Tested by

no test coverage detected