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

Fix checking cvar's bounds #230

Merged
merged 1 commit into from Mar 26, 2015

Conversation

Amaroq7
Copy link
Contributor

@Amaroq7 Amaroq7 commented Mar 26, 2015

It looks like the current code that checks bounds for a cvar will fail in two cases.

1st case
If we define min value that is higher than max value and max value is set to false,

create_cvar("cvar_name", "5", FCVAR_NONE, "desc", true, 1.0, false);

it will print -> The maximum value can not be below the minimum value

2nd case
If we define max value that is lower than min value and min value is set to false,

create_cvar("cvar_name", "5", FCVAR_NONE, "desc", false, 0.0, true, -1.0);

it will print -> The minimum value can not be above the maximum value

Solution
I think first we should check them if they are defined (both are set to true), then we can compare them. (Like I did in the this PR)

@Arkshine
Copy link
Member

Good catch. You're right, it makes sense to compare only if both bounds are set.

Thanks!

Related to #185.

Arkshine added a commit that referenced this pull request Mar 26, 2015
@Arkshine Arkshine merged commit bebe9f8 into alliedmodders:master Mar 26, 2015
@Amaroq7 Amaroq7 deleted the fix-checking-cvar-bounds branch March 26, 2015 21:01
@Arkshine Arkshine added the bug label Mar 26, 2015
@Arkshine Arkshine added the core label Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants