Code cleanup and refactoring.
This commit is contained in:
@@ -294,7 +294,7 @@ void UlxLuaCallLibrary::LuaCallArgument_string(UObject *context, const FString &
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(SimpleDynamicTag::STRING);
|
||||
sb.write_simple_dynamic_tag(LuaValueType::STRING);
|
||||
sb.write_string(pstring);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ void UlxLuaCallLibrary::LuaCallArgument_name(UObject *context, const FName &pnam
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(SimpleDynamicTag::TOKEN);
|
||||
sb.write_simple_dynamic_tag(LuaValueType::TOKEN);
|
||||
sb.write_string(namestr);
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ void UlxLuaCallLibrary::LuaCallArgument_float(UObject *context, double pfloat) {
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(SimpleDynamicTag::NUMBER);
|
||||
sb.write_simple_dynamic_tag(LuaValueType::NUMBER);
|
||||
sb.write_double(pfloat);
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ void UlxLuaCallLibrary::LuaCallArgument_int(UObject *context, int value) {
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(SimpleDynamicTag::NUMBER);
|
||||
sb.write_simple_dynamic_tag(LuaValueType::NUMBER);
|
||||
sb.write_double(value);
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ void UlxLuaCallLibrary::LuaCallArgument_vector(UObject *context, const FVector &
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(SimpleDynamicTag::VECTOR);
|
||||
sb.write_simple_dynamic_tag(LuaValueType::VECTOR);
|
||||
sb.write_fvector(pvector);
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ void UlxLuaCallLibrary::LuaCallArgument_vector2d(UObject *context, const FVector
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(SimpleDynamicTag::VECTOR);
|
||||
sb.write_simple_dynamic_tag(LuaValueType::VECTOR);
|
||||
sb.write_double(pvector.X);
|
||||
sb.write_double(pvector.Y);
|
||||
sb.write_double(0.0);
|
||||
@@ -351,7 +351,7 @@ void UlxLuaCallLibrary::LuaCallArgument_boolean(UObject *context, bool pbool) {
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(SimpleDynamicTag::BOOLEAN);
|
||||
sb.write_simple_dynamic_tag(LuaValueType::BOOLEAN);
|
||||
sb.write_bool(pbool);
|
||||
}
|
||||
|
||||
@@ -381,17 +381,17 @@ bool UlxLuaValues::Initialize(std::string_view data)
|
||||
|
||||
while (!Decoder.empty())
|
||||
{
|
||||
SimpleDynamicTag Tag = Decoder.read_simple_dynamic_tag();
|
||||
LuaValueType Tag = Decoder.read_simple_dynamic_tag();
|
||||
|
||||
int64 Pos = Decoder.total_reads();
|
||||
ElxLuaValueType Type;
|
||||
switch (Tag)
|
||||
{
|
||||
case SimpleDynamicTag::BOOLEAN: Type=ElxLuaValueType::Boolean; Decoder.read_bool(); break;
|
||||
case SimpleDynamicTag::NUMBER: Type=ElxLuaValueType::Float; Decoder.read_double(); break;
|
||||
case SimpleDynamicTag::STRING: Type=ElxLuaValueType::String; Decoder.read_string_view(); break;
|
||||
case SimpleDynamicTag::TOKEN: Type=ElxLuaValueType::Name; Decoder.read_string_view(); break;
|
||||
case SimpleDynamicTag::VECTOR: Type=ElxLuaValueType::Vector; Decoder.read_fvector(); break;
|
||||
case LuaValueType::BOOLEAN: Type=ElxLuaValueType::Boolean; Decoder.read_bool(); break;
|
||||
case LuaValueType::NUMBER: Type=ElxLuaValueType::Float; Decoder.read_double(); break;
|
||||
case LuaValueType::STRING: Type=ElxLuaValueType::String; Decoder.read_string_view(); break;
|
||||
case LuaValueType::TOKEN: Type=ElxLuaValueType::Name; Decoder.read_string_view(); break;
|
||||
case LuaValueType::VECTOR: Type=ElxLuaValueType::Vector; Decoder.read_fvector(); break;
|
||||
default: {
|
||||
Empty();
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user