| 1773 | } |
| 1774 | |
| 1775 | static cell_t SetEntPropFloat(IPluginContext *pContext, const cell_t *params) |
| 1776 | { |
| 1777 | CBaseEntity *pEntity; |
| 1778 | char *prop; |
| 1779 | int offset; |
| 1780 | int bit_count; |
| 1781 | edict_t *pEdict; |
| 1782 | |
| 1783 | int element = 0; |
| 1784 | if (params[0] >= 5) |
| 1785 | { |
| 1786 | element = params[5]; |
| 1787 | } |
| 1788 | |
| 1789 | if (!IndexToAThings(params[1], &pEntity, &pEdict)) |
| 1790 | { |
| 1791 | return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[1]), params[1]); |
| 1792 | } |
| 1793 | |
| 1794 | pContext->LocalToString(params[3], &prop); |
| 1795 | |
| 1796 | switch (params[2]) |
| 1797 | { |
| 1798 | case Prop_Data: |
| 1799 | { |
| 1800 | typedescription_t *td; |
| 1801 | |
| 1802 | FIND_PROP_DATA(td); |
| 1803 | |
| 1804 | if (td->fieldType != FIELD_FLOAT |
| 1805 | && td->fieldType != FIELD_TIME |
| 1806 | && (td->fieldType != FIELD_CUSTOM || (td->flags & FTYPEDESC_OUTPUT) != FTYPEDESC_OUTPUT)) |
| 1807 | { |
| 1808 | return pContext->ThrowNativeError("Data field %s is not a float (%d != [%d,%d,%d])", |
| 1809 | prop, |
| 1810 | td->fieldType, |
| 1811 | FIELD_FLOAT, |
| 1812 | FIELD_TIME, |
| 1813 | FIELD_CUSTOM); |
| 1814 | } |
| 1815 | |
| 1816 | CHECK_SET_PROP_DATA_OFFSET(); |
| 1817 | |
| 1818 | SET_TYPE_IF_VARIANT(FIELD_FLOAT); |
| 1819 | |
| 1820 | break; |
| 1821 | } |
| 1822 | case Prop_Send: |
| 1823 | { |
| 1824 | FIND_PROP_SEND(DPT_Float, "float"); |
| 1825 | if (!CanSetPropName(prop)) |
| 1826 | { |
| 1827 | return pContext->ThrowNativeError("Cannot set %s with \"FollowCSGOServerGuidelines\" option enabled.", prop); |
| 1828 | } |
| 1829 | break; |
| 1830 | } |
| 1831 | default: |
| 1832 | { |
nothing calls this directly
no test coverage detected