native GetStructVector(Handle:struct, const String:member[], Float:vec[3]);
| 215 | |
| 216 | //native GetStructVector(Handle:struct, const String:member[], Float:vec[3]); |
| 217 | static cell_t GetStructVector(IPluginContext *pContext, const cell_t *params) |
| 218 | { |
| 219 | Handle_t hndl = static_cast<Handle_t>(params[1]); |
| 220 | HandleError err; |
| 221 | HandleSecurity sec; |
| 222 | |
| 223 | sec.pOwner = NULL; |
| 224 | sec.pIdentity = myself->GetIdentity(); |
| 225 | |
| 226 | StructHandle *pHandle; |
| 227 | if ((err = g_pHandleSys->ReadHandle(hndl, g_StructHandle, &sec, (void **)&pHandle)) |
| 228 | != HandleError_None) |
| 229 | { |
| 230 | return pContext->ThrowNativeError("Invalid struct handle %x (error %d)", hndl, err); |
| 231 | } |
| 232 | |
| 233 | char *member; |
| 234 | pContext->LocalToString(params[2], &member); |
| 235 | |
| 236 | cell_t *addr; |
| 237 | pContext->LocalToPhysAddr(params[3], &addr); |
| 238 | |
| 239 | Vector value; |
| 240 | |
| 241 | if (!pHandle->GetVector(member, &value)) |
| 242 | { |
| 243 | return pContext->ThrowNativeError("Invalid member, or incorrect data type"); |
| 244 | } |
| 245 | |
| 246 | addr[0] = sp_ftoc(value.x); |
| 247 | addr[1] = sp_ftoc(value.y); |
| 248 | addr[2] = sp_ftoc(value.z); |
| 249 | |
| 250 | return 1; |
| 251 | } |
| 252 | |
| 253 | //native SetStructVector(Handle:struct, const String:member[], Float:vec[3]); |
| 254 | static cell_t SetStructVector(IPluginContext *pContext, const cell_t *params) |
nothing calls this directly
no test coverage detected