Fixed type inference for nulls in console functions

This commit is contained in:
Thomas "elfprince13" Dickerson 2017-01-06 14:50:41 -05:00
parent 733fd3ef6d
commit 88106f9032
17 changed files with 29 additions and 22 deletions

View file

@ -39,6 +39,7 @@
#include "console/engineStructs.h"
#endif
template<typename T> constexpr T nullAsType(){ return nullptr; }
/// @file
/// Legacy TS-based console type definitions.

View file

@ -547,9 +547,12 @@ namespace engineAPI{
template<size_t index, size_t method_offset = 0, typename ...RealArgTs>
static IthArgType<index> getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs)
{
return (startArgc + index) < argc
? EngineUnmarshallData< IthArgType<index> >()( argv[ startArgc + index ] )
: std::get<index + method_offset>(defaultArgs.mArgs);
if((startArgc + index) < argc)
{
return EngineUnmarshallData< IthArgType<index> >()( argv[ startArgc + index ] );
} else {
return std::get<index + method_offset>(defaultArgs.mArgs);
}
}
template<size_t ...I>

View file

@ -23,6 +23,8 @@
#ifndef _ENGINEFUNCTIONS_H_
#define _ENGINEFUNCTIONS_H_
#include <tuple>
#ifndef _ENGINEEXPORTS_H_
#include "console/engineExports.h"
#endif

View file

@ -41,6 +41,8 @@ DECLARE_PRIMITIVE_R(S32);
DECLARE_PRIMITIVE_R(U32);
DECLARE_PRIMITIVE_R(F32);
DECLARE_PRIMITIVE_R(F64);
DECLARE_PRIMITIVE_R(U64);
DECLARE_PRIMITIVE_R(S64);
DECLARE_PRIMITIVE_R(void*);