Remove deprecated PbReadRepeated natives.
Remove deprecated PbReadRepeated natives.
1.1 --- a/core/smn_protobuf.cpp Tue Apr 16 12:19:45 2013 -0400
1.2 +++ b/core/smn_protobuf.cpp Tue Apr 23 07:11:49 2013 -0400
1.3 @@ -308,148 +308,6 @@
1.4 return cnt;
1.5 }
1.6
1.7 -static cell_t smn_PbReadRepeatedInt(IPluginContext *pCtx, const cell_t *params)
1.8 -{
1.9 - GET_MSG_FROM_HANDLE_OR_ERR();
1.10 - GET_FIELD_NAME_OR_ERR();
1.11 -
1.12 - int ret;
1.13 - if (!msg->GetRepeatedInt32OrUnsignedOrEnum(strField, params[3], &ret))
1.14 - {
1.15 - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
1.16 - }
1.17 -
1.18 - return ret;
1.19 -}
1.20 -
1.21 -static cell_t smn_PbReadRepeatedFloat(IPluginContext *pCtx, const cell_t *params)
1.22 -{
1.23 - GET_MSG_FROM_HANDLE_OR_ERR();
1.24 - GET_FIELD_NAME_OR_ERR();
1.25 -
1.26 - float ret;
1.27 - if (!msg->GetRepeatedFloatOrDouble(strField, params[3], &ret))
1.28 - {
1.29 - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
1.30 - }
1.31 -
1.32 - return sp_ftoc(ret);
1.33 -}
1.34 -
1.35 -static cell_t smn_PbReadRepeatedBool(IPluginContext *pCtx, const cell_t *params)
1.36 -{
1.37 - GET_MSG_FROM_HANDLE_OR_ERR();
1.38 - GET_FIELD_NAME_OR_ERR();
1.39 -
1.40 - bool ret;
1.41 - if (!msg->GetRepeatedBool(strField, params[3], &ret))
1.42 - {
1.43 - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
1.44 - }
1.45 -
1.46 - return ret ? 1 : 0;
1.47 -}
1.48 -
1.49 -static cell_t smn_PbReadRepeatedString(IPluginContext *pCtx, const cell_t *params)
1.50 -{
1.51 - GET_MSG_FROM_HANDLE_OR_ERR();
1.52 - GET_FIELD_NAME_OR_ERR();
1.53 -
1.54 - char *buf;
1.55 - pCtx->LocalToPhysAddr(params[4], (cell_t **)&buf);
1.56 -
1.57 - if (!msg->GetRepeatedString(strField, params[3], buf, params[5]))
1.58 - {
1.59 - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
1.60 - }
1.61 -
1.62 - return 1;
1.63 -}
1.64 -
1.65 -static cell_t smn_PbReadRepeatedColor(IPluginContext *pCtx, const cell_t *params)
1.66 -{
1.67 - GET_MSG_FROM_HANDLE_OR_ERR();
1.68 - GET_FIELD_NAME_OR_ERR();
1.69 -
1.70 - cell_t *out;
1.71 - pCtx->LocalToPhysAddr(params[4], &out);
1.72 -
1.73 - Color clr;
1.74 - if (!msg->GetRepeatedColor(strField, params[3], &clr))
1.75 - {
1.76 - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
1.77 - }
1.78 -
1.79 - out[0] = clr.r();
1.80 - out[1] = clr.g();
1.81 - out[2] = clr.b();
1.82 - out[3] = clr.a();
1.83 -
1.84 - return 1;
1.85 -}
1.86 -
1.87 -static cell_t smn_PbReadRepeatedAngle(IPluginContext *pCtx, const cell_t *params)
1.88 -{
1.89 - GET_MSG_FROM_HANDLE_OR_ERR();
1.90 - GET_FIELD_NAME_OR_ERR();
1.91 -
1.92 - cell_t *out;
1.93 - pCtx->LocalToPhysAddr(params[4], &out);
1.94 -
1.95 - QAngle ang;
1.96 - if (!msg->GetRepeatedQAngle(strField, params[3], &ang))
1.97 - {
1.98 - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
1.99 - }
1.100 -
1.101 - out[0] = sp_ftoc(ang.x);
1.102 - out[1] = sp_ftoc(ang.y);
1.103 - out[2] = sp_ftoc(ang.z);
1.104 -
1.105 - return 1;
1.106 -}
1.107 -
1.108 -static cell_t smn_PbReadRepeatedVector(IPluginContext *pCtx, const cell_t *params)
1.109 -{
1.110 - GET_MSG_FROM_HANDLE_OR_ERR();
1.111 - GET_FIELD_NAME_OR_ERR();
1.112 -
1.113 - cell_t *out;
1.114 - pCtx->LocalToPhysAddr(params[4], &out);
1.115 -
1.116 - Vector vec;
1.117 - if (!msg->GetRepeatedVector(strField, params[3], &vec))
1.118 - {
1.119 - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
1.120 - }
1.121 -
1.122 - out[0] = sp_ftoc(vec.x);
1.123 - out[1] = sp_ftoc(vec.y);
1.124 - out[2] = sp_ftoc(vec.z);
1.125 -
1.126 - return 1;
1.127 -}
1.128 -
1.129 -static cell_t smn_PbReadRepeatedVector2D(IPluginContext *pCtx, const cell_t *params)
1.130 -{
1.131 - GET_MSG_FROM_HANDLE_OR_ERR();
1.132 - GET_FIELD_NAME_OR_ERR();
1.133 -
1.134 - cell_t *out;
1.135 - pCtx->LocalToPhysAddr(params[4], &out);
1.136 -
1.137 - Vector2D vec;
1.138 - if (!msg->GetRepeatedVector2D(strField, params[3], &vec))
1.139 - {
1.140 - return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
1.141 - }
1.142 -
1.143 - out[0] = sp_ftoc(vec.x);
1.144 - out[1] = sp_ftoc(vec.y);
1.145 -
1.146 - return 1;
1.147 -}
1.148 -
1.149 static cell_t smn_PbSetInt(IPluginContext *pCtx, const cell_t *params)
1.150 {
1.151 GET_MSG_FROM_HANDLE_OR_ERR();
1.152 @@ -920,14 +778,6 @@
1.153 {"PbReadVector", smn_PbReadVector},
1.154 {"PbReadVector2D", smn_PbReadVector2D},
1.155 {"PbGetRepeatedFieldCount", smn_PbGetRepeatedFieldCount},
1.156 - {"PbReadRepeatedInt", smn_PbReadRepeatedInt},
1.157 - {"PbReadRepeatedFloat", smn_PbReadRepeatedFloat},
1.158 - {"PbReadRepeatedBool", smn_PbReadRepeatedBool},
1.159 - {"PbReadRepeatedString", smn_PbReadRepeatedString},
1.160 - {"PbReadRepeatedColor", smn_PbReadRepeatedColor},
1.161 - {"PbReadRepeatedAngle", smn_PbReadRepeatedAngle},
1.162 - {"PbReadRepeatedVector", smn_PbReadRepeatedVector},
1.163 - {"PbReadRepeatedVector2D", smn_PbReadRepeatedVector2D},
1.164 {"PbSetInt", smn_PbSetInt},
1.165 {"PbSetFloat", smn_PbSetFloat},
1.166 {"PbSetBool", smn_PbSetBool},
2.1 --- a/plugins/include/protobuf.inc Tue Apr 16 12:19:45 2013 -0400
2.2 +++ b/plugins/include/protobuf.inc Tue Apr 23 07:11:49 2013 -0400
2.3 @@ -142,108 +142,6 @@
2.4 native PbGetRepeatedFieldCount(Handle:pb, const String:field[]);
2.5
2.6 /**
2.7 - * Reads an int32, uint32, sint32, fixed32, or sfixed32 from a protobuf message repeated field.
2.8 - *
2.9 - * @param pb protobuf handle.
2.10 - * @param field Field name.
2.11 - * @param index Index in the repeated field.
2.12 - * @return Integer value read.
2.13 - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type.
2.14 - */
2.15 -#pragma deprecated use PbReadInt with index param
2.16 -native PbReadRepeatedInt(Handle:pb, const String:field[], index);
2.17 -
2.18 -/**
2.19 - * Reads a float or downcasted double from a protobuf message repeated field.
2.20 - *
2.21 - * @param pb protobuf handle.
2.22 - * @param field Field name.
2.23 - * @param index Index in the repeated field.
2.24 - * @return Float value read.
2.25 - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type.
2.26 - */
2.27 -#pragma deprecated use PbReadFloat with index param
2.28 -native Float:PbReadRepeatedFloat(Handle:pb, const String:field[], index);
2.29 -
2.30 -/**
2.31 - * Reads a bool from a protobuf message repeated field.
2.32 - *
2.33 - * @param pb protobuf handle.
2.34 - * @param field Field name.
2.35 - * @param index Index in the repeated field.
2.36 - * @return Boolean value read.
2.37 - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type.
2.38 - */
2.39 -#pragma deprecated use PbReadBool with index param
2.40 -native bool:PbReadRepeatedBool(Handle:pb, const String:field[], index);
2.41 -
2.42 -/**
2.43 - * Reads a string from a protobuf message repeated field.
2.44 - *
2.45 - * @param pb protobuf handle.
2.46 - * @param field Field name.
2.47 - * @param index Index in the repeated field.
2.48 - * @param buffer Destination string buffer.
2.49 - * @param maxlength Maximum length of output string buffer.
2.50 - * @noreturn
2.51 - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type.
2.52 - */
2.53 -#pragma deprecated use PbReadString with index param
2.54 -native PbReadRepeatedString(Handle:pb, const String:field[], index, String:buffer[], size);
2.55 -
2.56 -/**
2.57 - * Reads an RGBA color value from a protobuf message repeated field.
2.58 - *
2.59 - * @param pb protobuf handle.
2.60 - * @param field Field name.
2.61 - * @param index Index in the repeated field.
2.62 - * @param buffer Destination color buffer.
2.63 - * @noreturn
2.64 - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type.
2.65 - */
2.66 -#pragma deprecated use PbReadColor with index param
2.67 -native PbReadRepeatedColor(Handle:pb, const String:field[], index, buffer[4]);
2.68 -
2.69 -/**
2.70 - * Reads an XYZ angle value from a protobuf message repeated field.
2.71 - *
2.72 - * @param pb protobuf handle.
2.73 - * @param field Field name.
2.74 - * @param index Index in the repeated field.
2.75 - * @param buffer Destination angle buffer.
2.76 - * @noreturn
2.77 - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type.
2.78 - */
2.79 -#pragma deprecated use PbReadAngle with index param
2.80 -native PbReadRepeatedAngle(Handle:pb, const String:field[], index, Float:buffer[3]);
2.81 -
2.82 -/**
2.83 - * Reads an XYZ vector value from a protobuf message repeated field.
2.84 - *
2.85 - * @param pb protobuf handle.
2.86 - * @param field Field name.
2.87 - * @param index Index in the repeated field.
2.88 - * @param buffer Destination vector buffer.
2.89 - * @noreturn
2.90 - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type.
2.91 - */
2.92 -#pragma deprecated use PbReadVector with index param
2.93 -native PbReadRepeatedVector(Handle:pb, const String:field[], index, Float:buffer[3]);
2.94 -
2.95 -/**
2.96 - * Reads an XY vector value from a protobuf message repeated field.
2.97 - *
2.98 - * @param pb protobuf handle.
2.99 - * @param field Field name.
2.100 - * @param index Index in the repeated field.
2.101 - * @param buffer Destination vector buffer.
2.102 - * @noreturn
2.103 - * @error Invalid or incorrect Handle, non-existant field, or incorrect field type.
2.104 - */
2.105 -#pragma deprecated use PbReadVector2D with index param
2.106 -native PbReadRepeatedVector2D(Handle:pb, const String:field[], index, Float:buffer[2]);
2.107 -
2.108 -/**
2.109 * Sets an int32, uint32, sint32, fixed32, sfixed32, or enum value on a protobuf message.
2.110 *
2.111 * @param pb protobuf handle.