| 260 | } |
| 261 | |
| 262 | static cell_t smn_PbReadVector(IPluginContext *pCtx, const cell_t *params) |
| 263 | { |
| 264 | GET_MSG_FROM_HANDLE_OR_ERR(); |
| 265 | GET_FIELD_NAME_OR_ERR(); |
| 266 | |
| 267 | cell_t *out; |
| 268 | pCtx->LocalToPhysAddr(params[3], &out); |
| 269 | |
| 270 | Vector vec; |
| 271 | int index = params[0] >= 4 ? params[4] : -1; |
| 272 | if (index < 0) |
| 273 | { |
| 274 | if (!msg->GetVector(strField, &vec)) |
| 275 | { |
| 276 | return pCtx->ThrowNativeError("Invalid field \"%s\" for message \"%s\"", strField, msg->GetProtobufMessage()->GetTypeName().c_str()); |
| 277 | } |
| 278 | } |
| 279 | else |
| 280 | { |
| 281 | if (!msg->GetRepeatedVector(strField, index, &vec)) |
| 282 | { |
| 283 | return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, index, msg->GetProtobufMessage()->GetTypeName().c_str()); |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | out[0] = sp_ftoc(vec.x); |
| 288 | out[1] = sp_ftoc(vec.y); |
| 289 | out[2] = sp_ftoc(vec.z); |
| 290 | |
| 291 | return 1; |
| 292 | } |
| 293 | |
| 294 | static cell_t smn_PbReadVector2D(IPluginContext *pCtx, const cell_t *params) |
| 295 | { |
nothing calls this directly
no test coverage detected