Fixed VARINT & UNSIGNED flags being read from dt instead of member in SendProp arrays (bug 5591, r=prodigysim).

This commit is contained in:
Nicholas Hastings 2013-02-04 07:38:30 -05:00
parent e20e272ee1
commit c2ecb7363c
2 changed files with 22 additions and 20 deletions

View File

@ -984,6 +984,7 @@ static cell_t SetEntDataString(IPluginContext *pContext, const cell_t *params)
#define FIND_PROP_SEND(type, type_name) \ #define FIND_PROP_SEND(type, type_name) \
sm_sendprop_info_t info;\ sm_sendprop_info_t info;\
SendProp *pProp; \
IServerUnknown *pUnk = (IServerUnknown *)pEntity; \ IServerUnknown *pUnk = (IServerUnknown *)pEntity; \
IServerNetworkable *pNet = pUnk->GetNetworkable(); \ IServerNetworkable *pNet = pUnk->GetNetworkable(); \
if (!pNet) \ if (!pNet) \
@ -1000,9 +1001,10 @@ static cell_t SetEntDataString(IPluginContext *pContext, const cell_t *params)
} \ } \
\ \
offset = info.actual_offset; \ offset = info.actual_offset; \
bit_count = info.prop->m_nBits; \ pProp = info.prop; \
bit_count = pProp->m_nBits; \
\ \
switch (info.prop->GetType()) \ switch (pProp->GetType()) \
{ \ { \
case type: \ case type: \
{ \ { \
@ -1016,7 +1018,6 @@ static cell_t SetEntDataString(IPluginContext *pContext, const cell_t *params)
} \ } \
case DPT_DataTable: \ case DPT_DataTable: \
{ \ { \
SendProp *pProp; \
FIND_PROP_SEND_IN_SENDTABLE(info, pProp, element, type, type_name); \ FIND_PROP_SEND_IN_SENDTABLE(info, pProp, element, type, type_name); \
\ \
offset += pProp->GetOffset(); \ offset += pProp->GetOffset(); \
@ -1027,13 +1028,13 @@ static cell_t SetEntDataString(IPluginContext *pContext, const cell_t *params)
{ \ { \
return pContext->ThrowNativeError("SendProp %s type is not " type_name " (%d != %d)", \ return pContext->ThrowNativeError("SendProp %s type is not " type_name " (%d != %d)", \
prop, \ prop, \
info.prop->GetType(), \ pProp->GetType(), \
type); \ type); \
} \ } \
} \ } \
#define FIND_PROP_SEND_IN_SENDTABLE(info, pProp, element, type, type_name) \ #define FIND_PROP_SEND_IN_SENDTABLE(info, pProp, element, type, type_name) \
SendTable *pTable = info.prop->GetDataTable(); \ SendTable *pTable = pProp->GetDataTable(); \
if (!pTable) \ if (!pTable) \
{ \ { \
return pContext->ThrowNativeError("Error looking up DataTable for prop %s", \ return pContext->ThrowNativeError("Error looking up DataTable for prop %s", \
@ -1054,8 +1055,8 @@ static cell_t SetEntDataString(IPluginContext *pContext, const cell_t *params)
{ \ { \
return pContext->ThrowNativeError("SendProp %s type is not " type_name " ([%d,%d] != %d)", \ return pContext->ThrowNativeError("SendProp %s type is not " type_name " ([%d,%d] != %d)", \
prop, \ prop, \
info.prop->GetType(), \ pProp->GetType(), \
info.prop->m_nBits, \ pProp->m_nBits, \
type); \ type); \
} }
@ -1191,11 +1192,11 @@ static cell_t GetEntProp(IPluginContext *pContext, const cell_t *params)
case Prop_Send: case Prop_Send:
{ {
FIND_PROP_SEND(DPT_Int, "integer"); FIND_PROP_SEND(DPT_Int, "integer");
is_unsigned = ((info.prop->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED); is_unsigned = ((pProp->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED);
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later // This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE
if (info.prop->GetFlags() & SPROP_VARINT) if (pProp->GetFlags() & SPROP_VARINT)
{ {
bit_count = sizeof(int) * 8; bit_count = sizeof(int) * 8;
} }
@ -1293,7 +1294,7 @@ static cell_t SetEntProp(IPluginContext *pContext, const cell_t *params)
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later // This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE
if (info.prop->GetFlags() & SPROP_VARINT) if (pProp->GetFlags() & SPROP_VARINT)
{ {
bit_count = sizeof(int) * 8; bit_count = sizeof(int) * 8;
} }

View File

@ -89,15 +89,17 @@ enum PropFieldType
#define FIND_PROP_SEND(type, type_name) \ #define FIND_PROP_SEND(type, type_name) \
sm_sendprop_info_t info;\ sm_sendprop_info_t info;\
SendProp *pProp; \
if (!gamehelpers->FindSendPropInfo(g_szGameRulesProxy, prop, &info)) \ if (!gamehelpers->FindSendPropInfo(g_szGameRulesProxy, prop, &info)) \
{ \ { \
return pContext->ThrowNativeError("Property \"%s\" not found on the gamerules proxy", prop); \ return pContext->ThrowNativeError("Property \"%s\" not found on the gamerules proxy", prop); \
} \ } \
\ \
offset = info.actual_offset; \ offset = info.actual_offset; \
bit_count = info.prop->m_nBits; \ pProp = info.prop; \
bit_count = pProp->m_nBits; \
\ \
switch (info.prop->GetType()) \ switch (pProp->GetType()) \
{ \ { \
case type: \ case type: \
{ \ { \
@ -111,7 +113,6 @@ enum PropFieldType
} \ } \
case DPT_DataTable: \ case DPT_DataTable: \
{ \ { \
SendProp *pProp; \
FIND_PROP_SEND_IN_SENDTABLE(info, pProp, element, type, type_name); \ FIND_PROP_SEND_IN_SENDTABLE(info, pProp, element, type, type_name); \
\ \
offset += pProp->GetOffset(); \ offset += pProp->GetOffset(); \
@ -122,13 +123,13 @@ enum PropFieldType
{ \ { \
return pContext->ThrowNativeError("SendProp %s type is not " type_name " (%d != %d)", \ return pContext->ThrowNativeError("SendProp %s type is not " type_name " (%d != %d)", \
prop, \ prop, \
info.prop->GetType(), \ pProp->GetType(), \
type); \ type); \
} \ } \
} \ } \
#define FIND_PROP_SEND_IN_SENDTABLE(info, pProp, element, type, type_name) \ #define FIND_PROP_SEND_IN_SENDTABLE(info, pProp, element, type, type_name) \
SendTable *pTable = info.prop->GetDataTable(); \ SendTable *pTable = pProp->GetDataTable(); \
if (!pTable) \ if (!pTable) \
{ \ { \
return pContext->ThrowNativeError("Error looking up DataTable for prop %s", \ return pContext->ThrowNativeError("Error looking up DataTable for prop %s", \
@ -149,8 +150,8 @@ enum PropFieldType
{ \ { \
return pContext->ThrowNativeError("SendProp %s type is not " type_name " ([%d,%d] != %d)", \ return pContext->ThrowNativeError("SendProp %s type is not " type_name " ([%d,%d] != %d)", \
prop, \ prop, \
info.prop->GetType(), \ pProp->GetType(), \
info.prop->m_nBits, \ pProp->m_nBits, \
type); \ type); \
} }
@ -170,11 +171,11 @@ static cell_t GameRules_GetProp(IPluginContext *pContext, const cell_t *params)
int elementCount = 1; int elementCount = 1;
FIND_PROP_SEND(DPT_Int, "integer"); FIND_PROP_SEND(DPT_Int, "integer");
is_unsigned = ((info.prop->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED); is_unsigned = ((pProp->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED);
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later // This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE
if (info.prop->GetFlags() & SPROP_VARINT) if (pProp->GetFlags() & SPROP_VARINT)
{ {
bit_count = sizeof(int) * 8; bit_count = sizeof(int) * 8;
} }
@ -244,7 +245,7 @@ static cell_t GameRules_SetProp(IPluginContext *pContext, const cell_t *params)
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later // This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE
if (info.prop->GetFlags() & SPROP_VARINT) if (pProp->GetFlags() & SPROP_VARINT)
{ {
bit_count = sizeof(int) * 8; bit_count = sizeof(int) * 8;
} }