Remove deprecated PbReadRepeated natives.
This commit is contained in:
@@ -308,148 +308,6 @@ static cell_t smn_PbGetRepeatedFieldCount(IPluginContext *pCtx, const cell_t *pa
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static cell_t smn_PbReadRepeatedInt(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
GET_MSG_FROM_HANDLE_OR_ERR();
|
||||
GET_FIELD_NAME_OR_ERR();
|
||||
|
||||
int ret;
|
||||
if (!msg->GetRepeatedInt32OrUnsignedOrEnum(strField, params[3], &ret))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static cell_t smn_PbReadRepeatedFloat(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
GET_MSG_FROM_HANDLE_OR_ERR();
|
||||
GET_FIELD_NAME_OR_ERR();
|
||||
|
||||
float ret;
|
||||
if (!msg->GetRepeatedFloatOrDouble(strField, params[3], &ret))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
|
||||
}
|
||||
|
||||
return sp_ftoc(ret);
|
||||
}
|
||||
|
||||
static cell_t smn_PbReadRepeatedBool(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
GET_MSG_FROM_HANDLE_OR_ERR();
|
||||
GET_FIELD_NAME_OR_ERR();
|
||||
|
||||
bool ret;
|
||||
if (!msg->GetRepeatedBool(strField, params[3], &ret))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
|
||||
}
|
||||
|
||||
return ret ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell_t smn_PbReadRepeatedString(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
GET_MSG_FROM_HANDLE_OR_ERR();
|
||||
GET_FIELD_NAME_OR_ERR();
|
||||
|
||||
char *buf;
|
||||
pCtx->LocalToPhysAddr(params[4], (cell_t **)&buf);
|
||||
|
||||
if (!msg->GetRepeatedString(strField, params[3], buf, params[5]))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t smn_PbReadRepeatedColor(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
GET_MSG_FROM_HANDLE_OR_ERR();
|
||||
GET_FIELD_NAME_OR_ERR();
|
||||
|
||||
cell_t *out;
|
||||
pCtx->LocalToPhysAddr(params[4], &out);
|
||||
|
||||
Color clr;
|
||||
if (!msg->GetRepeatedColor(strField, params[3], &clr))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
|
||||
}
|
||||
|
||||
out[0] = clr.r();
|
||||
out[1] = clr.g();
|
||||
out[2] = clr.b();
|
||||
out[3] = clr.a();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t smn_PbReadRepeatedAngle(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
GET_MSG_FROM_HANDLE_OR_ERR();
|
||||
GET_FIELD_NAME_OR_ERR();
|
||||
|
||||
cell_t *out;
|
||||
pCtx->LocalToPhysAddr(params[4], &out);
|
||||
|
||||
QAngle ang;
|
||||
if (!msg->GetRepeatedQAngle(strField, params[3], &ang))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
|
||||
}
|
||||
|
||||
out[0] = sp_ftoc(ang.x);
|
||||
out[1] = sp_ftoc(ang.y);
|
||||
out[2] = sp_ftoc(ang.z);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t smn_PbReadRepeatedVector(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
GET_MSG_FROM_HANDLE_OR_ERR();
|
||||
GET_FIELD_NAME_OR_ERR();
|
||||
|
||||
cell_t *out;
|
||||
pCtx->LocalToPhysAddr(params[4], &out);
|
||||
|
||||
Vector vec;
|
||||
if (!msg->GetRepeatedVector(strField, params[3], &vec))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
|
||||
}
|
||||
|
||||
out[0] = sp_ftoc(vec.x);
|
||||
out[1] = sp_ftoc(vec.y);
|
||||
out[2] = sp_ftoc(vec.z);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t smn_PbReadRepeatedVector2D(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
GET_MSG_FROM_HANDLE_OR_ERR();
|
||||
GET_FIELD_NAME_OR_ERR();
|
||||
|
||||
cell_t *out;
|
||||
pCtx->LocalToPhysAddr(params[4], &out);
|
||||
|
||||
Vector2D vec;
|
||||
if (!msg->GetRepeatedVector2D(strField, params[3], &vec))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
|
||||
}
|
||||
|
||||
out[0] = sp_ftoc(vec.x);
|
||||
out[1] = sp_ftoc(vec.y);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t smn_PbSetInt(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
GET_MSG_FROM_HANDLE_OR_ERR();
|
||||
@@ -920,14 +778,6 @@ REGISTER_NATIVES(protobufnatives)
|
||||
{"PbReadVector", smn_PbReadVector},
|
||||
{"PbReadVector2D", smn_PbReadVector2D},
|
||||
{"PbGetRepeatedFieldCount", smn_PbGetRepeatedFieldCount},
|
||||
{"PbReadRepeatedInt", smn_PbReadRepeatedInt},
|
||||
{"PbReadRepeatedFloat", smn_PbReadRepeatedFloat},
|
||||
{"PbReadRepeatedBool", smn_PbReadRepeatedBool},
|
||||
{"PbReadRepeatedString", smn_PbReadRepeatedString},
|
||||
{"PbReadRepeatedColor", smn_PbReadRepeatedColor},
|
||||
{"PbReadRepeatedAngle", smn_PbReadRepeatedAngle},
|
||||
{"PbReadRepeatedVector", smn_PbReadRepeatedVector},
|
||||
{"PbReadRepeatedVector2D", smn_PbReadRepeatedVector2D},
|
||||
{"PbSetInt", smn_PbSetInt},
|
||||
{"PbSetFloat", smn_PbSetFloat},
|
||||
{"PbSetBool", smn_PbSetBool},
|
||||
|
||||
Reference in New Issue
Block a user