Merge pull request #672 from peace-maker/null_natives_fixed

Add natives to check for NULL_VECTOR and NULL_STRING
This commit is contained in:
Asher Baker
2017-10-27 20:03:09 +01:00
committed by GitHub
8 changed files with 348 additions and 19 deletions
+16
View File
@@ -143,6 +143,22 @@ struct SharedPlugin
public float NULL_VECTOR[3]; /**< Pass this into certain functions to act as a C++ NULL */
public const char NULL_STRING[1]; /**< pass this into certain functions to act as a C++ NULL */
/**
* Check if the given vector is the NULL_VECTOR.
*
* @param vec The vector to test.
* @return True if NULL_VECTOR, false otherwise.
*/
native bool IsNullVector(const float vec[3]);
/**
* Check if the given string is the NULL_STRING.
*
* @param str The string to test.
* @return True if NULL_STRING, false otherwise.
*/
native bool IsNullString(const char[] str);
/**
* Horrible compatibility shim.
*/
+36
View File
@@ -290,6 +290,16 @@ native void Call_PushArray(const any[] value, int size);
*/
native void Call_PushArrayEx(any[] value, int size, int cpflags);
/**
* Pushes the NULL_VECTOR onto the current call.
* @see IsNullVector
*
* @note Cannot be used before a call has been started.
*
* @error Called before a call has been started.
*/
native void Call_PushNullVector();
/**
* Pushes a string onto the current call.
*
@@ -317,6 +327,16 @@ native void Call_PushString(const char[] value);
*/
native void Call_PushStringEx(char[] value, int length, int szflags, int cpflags);
/**
* Pushes the NULL_STRING onto the current call.
* @see IsNullString
*
* @note Cannot be used before a call has been started.
*
* @error Called before a call has been started.
*/
native void Call_PushNullString();
/**
* Completes a call to a function or forward's call list.
*
@@ -465,6 +485,22 @@ native int GetNativeArray(int param, any[] local, int size);
*/
native int SetNativeArray(int param, const any[] local, int size);
/**
* Check if the native parameter is the NULL_VECTOR.
*
* @param param Parameter number, starting from 1.
* @return True if NULL_VECTOR, false otherwise.
*/
native bool IsNativeParamNullVector(int param);
/**
* Check if the native parameter is the NULL_STRING.
*
* @param param Parameter number, starting from 1.
* @return True if NULL_STRING, false otherwise.
*/
native bool IsNativeParamNullString(int param);
/**
* Formats a string using parameters from a native.
*