| author | Nicholas Hastings <skamonkey@gmail.com> |
| Tue Oct 11 19:41:56 2011 -0400 (2011-10-11) | |
| changeset 3398 | fcf4e97e0844 |
| parent 3397 | 268844cefc10 |
| child 3399 | c81e3ec1123a |
1.1 --- a/core/smn_entities.cpp Mon Oct 10 21:44:36 2011 -0400 1.2 +++ b/core/smn_entities.cpp Tue Oct 11 19:41:56 2011 -0400 1.3 @@ -1155,6 +1155,7 @@ 1.4 const char *class_name; 1.5 edict_t *pEdict; 1.6 int bit_count; 1.7 + bool is_unsigned = false; 1.8 1.9 int element = 0; 1.10 if (params[0] >= 5) 1.11 @@ -1197,6 +1198,7 @@ 1.12 case Prop_Send: 1.13 { 1.14 FIND_PROP_SEND(DPT_Int, "integer"); 1.15 + is_unsigned = ((info.prop->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED); 1.16 break; 1.17 } 1.18 default: 1.19 @@ -1216,11 +1218,25 @@ 1.20 } 1.21 else if (bit_count >= 9) 1.22 { 1.23 - return *(int16_t *)((uint8_t *)pEntity + offset); 1.24 + if (is_unsigned) 1.25 + { 1.26 + return *(uint16_t *)((uint8_t *)pEntity + offset); 1.27 + } 1.28 + else 1.29 + { 1.30 + return *(int16_t *)((uint8_t *)pEntity + offset); 1.31 + } 1.32 } 1.33 else if (bit_count >= 2) 1.34 { 1.35 - return *(int8_t *)((uint8_t *)pEntity + offset); 1.36 + if (is_unsigned) 1.37 + { 1.38 + return *(uint8_t *)((uint8_t *)pEntity + offset); 1.39 + } 1.40 + else 1.41 + { 1.42 + return *(int8_t *)((uint8_t *)pEntity + offset); 1.43 + } 1.44 } 1.45 else 1.46 {