Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set/GetEntPropFloat doesn't work with math_counter's m_OutValue #1501

Closed
asherkin opened this issue Jun 14, 2021 · 2 comments · Fixed by #1536
Closed

Set/GetEntPropFloat doesn't work with math_counter's m_OutValue #1501

asherkin opened this issue Jun 14, 2021 · 2 comments · Fixed by #1536
Assignees
Labels
Bug general bugs; can be anything Good First Issue Issues that are suitable for first-time contributors. Help Wanted up for grabs

Comments

@asherkin
Copy link
Member

https://forums.alliedmods.net/showthread.php?p=2749741#post2749741

This check bails before it gets to the variant handling check:

if (td->fieldType != FIELD_FLOAT
	&& td->fieldType != FIELD_TIME)
{
	return pContext->ThrowNativeError("Data field %s is not a float (%d != [%d,%d])", 
		prop,
		td->fieldType,
		FIELD_FLOAT,
		FIELD_TIME);
}

https://cs.alliedmods.net/sourcemod/source/core/smn_entities.cpp#1574-1586

The other type functions appear to all be correct, it is only the float ones affected.

@asherkin asherkin added Bug general bugs; can be anything Good First Issue Issues that are suitable for first-time contributors. Help Wanted up for grabs labels Jun 14, 2021
@Adrianilloo
Copy link
Contributor

I guess a proper fix would be employing a function similar to the MatchTypeDescAsInteger called here: https://cs.alliedmods.net/sourcemod/source/core/smn_entities.cpp#1352, but for floats instead (if it doesn't already exist).

@asherkin
Copy link
Member Author

I guess a proper fix would be employing a function similar to the MatchTypeDescAsInteger called here: https://cs.alliedmods.net/sourcemod/source/core/smn_entities.cpp#1352, but for floats instead (if it doesn't already exist).

Nothing that complex, as floats are fixed-size, some form of && !(td->fieldType == FIELD_CUSTOM && (td->flags & FTYPEDESC_OUTPUT) == FTYPEDESC_OUTPUT) just needs adding to that if condition.

@asherkin asherkin self-assigned this Jul 17, 2021
asherkin added a commit that referenced this issue Jul 17, 2021
When variant support was added for props, the validation checks in the
float related functions weren't updated to allow them.

Tested with the plugin from the forum thread with a spawned
`math_counter`.

Fixes #1501
asherkin added a commit that referenced this issue Jul 17, 2021
When variant support was added for props, the validation checks in the
float related functions weren't updated to allow them.

Tested with the plugin from the forum thread with a spawned
`math_counter`.

Fixes #1501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug general bugs; can be anything Good First Issue Issues that are suitable for first-time contributors. Help Wanted up for grabs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants