Disable FName as a native parameter

This commit is contained in:
Ricardo Luís Vaz Silva 2023-06-15 19:30:46 -03:00 committed by Rachael Alexanderson
parent 0e438f10f3
commit c6978c23ab
2 changed files with 12 additions and 6 deletions

View File

@ -618,7 +618,8 @@ namespace
template<typename T> struct native_is_valid<T&> { static const bool value = true; static const bool retval = true; };
template<> struct native_is_valid<void> { static const bool value = true; static const bool retval = true; };
template<> struct native_is_valid<int> { static const bool value = true; static const bool retval = true; };
template<> struct native_is_valid<FName> { static const bool value = true; static const bool retval = true; static_assert(sizeof(FName) == sizeof(int)); static_assert(std::is_pod_v<FName>);};
// [RL0] this is disabled for now due to graf's concerns
// template<> struct native_is_valid<FName> { static const bool value = true; static const bool retval = true; static_assert(sizeof(FName) == sizeof(int)); static_assert(std::is_pod_v<FName>);};
template<> struct native_is_valid<unsigned int> { static const bool value = true; static const bool retval = true; };
template<> struct native_is_valid<double> { static const bool value = true; static const bool retval = true; };
template<> struct native_is_valid<bool> { static const bool value = true; static const bool retval = false;}; // Bool as return does not work!

View File

@ -5111,21 +5111,26 @@ void ChangeModelNative(
AActor * self,
AActor * invoker,
FStateParamInfo * stateinfo,
FName modeldef,
int i_modeldef,
int i_modelindex,
const FString &p_modelpath,
FName model,
int i_model,
int i_skinindex,
const FString &p_skinpath,
FName skin,
int i_skin,
int flags,
int generatorindex,
int i_animationindex,
const FString &p_animationpath,
FName animation
int i_animation
) {
if(!self) ThrowAbortException(X_READ_NIL, "In function parameter self");
FName modeldef { ENamedName(i_modeldef) };
FName model { ENamedName(i_model) };
FName skin { ENamedName(i_skin) };
FName animation { ENamedName(i_animation) };
if (modeldef != NAME_None && PClass::FindClass(modeldef.GetChars()) == nullptr)
{
Printf("Attempt to pass invalid modeldef name %s in %s.", modeldef.GetChars(), self->GetCharacterName());
@ -5322,7 +5327,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_ChangeModel, ChangeModelNative)
PARAM_STRING_VAL(animationpath);
PARAM_NAME(animation);
ChangeModelNative(self,stateowner,stateinfo,modeldef,modelindex,modelpath,model,skinindex,skinpath,skin,flags,generatorindex,animationindex,animationpath,animation);
ChangeModelNative(self,stateowner,stateinfo,modeldef.GetIndex(),modelindex,modelpath,model.GetIndex(),skinindex,skinpath,skin.GetIndex(),flags,generatorindex,animationindex,animationpath,animation.GetIndex());
return 0;
}