Cvars: Adjust few things

- Hook is not as post, because allowing blocking change is not really that useful and this makes a context more simpler.
- Setting a min bound > max bound and reversely throw an error
- set_pcvar_bounds set cvar value on new min/max bound.
- Remove error "A cvar can't be binded with several variables", it's okay to no error such situation.
This commit is contained in:
Arkshine
2015-01-28 00:25:27 +01:00
parent 1a5e1928ec
commit e4a7e67783
4 changed files with 79 additions and 58 deletions

View File

@ -91,6 +91,9 @@ native get_cvar_pointer(const cvar[]);
/**
* Creates a hook for when a cvar's value is changed.
*
* @note You cannot prevent cvar changes from happening, you can only change the value again.
* @note Be careful not to set a cvar inside a cvar change hook such that
* it re-invokes he same callback. This results in infinite recursion.
* @note Callback will be called in the following manner:
*
* public cvar_change_callback(pcvar, const old_value[], const new_value[])