Final refactor of basebuffer
This commit is contained in:
@@ -288,7 +288,7 @@ void UlxLuaCallLibrary::LuaCallArgument_string(UObject *context, const FString &
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->GetLuaCallBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(LuaValueType::STRING);
|
||||
sb.write_lua_value_type(LuaValueType::STRING);
|
||||
sb.write_string(pstring);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ void UlxLuaCallLibrary::LuaCallArgument_name(UObject *context, const FName &pnam
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->GetLuaCallBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(LuaValueType::TOKEN);
|
||||
sb.write_lua_value_type(LuaValueType::TOKEN);
|
||||
sb.write_string(namestr);
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ void UlxLuaCallLibrary::LuaCallArgument_float(UObject *context, double pfloat) {
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->GetLuaCallBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(LuaValueType::NUMBER);
|
||||
sb.write_lua_value_type(LuaValueType::NUMBER);
|
||||
sb.write_double(pfloat);
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ void UlxLuaCallLibrary::LuaCallArgument_int(UObject *context, int value) {
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->GetLuaCallBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(LuaValueType::NUMBER);
|
||||
sb.write_lua_value_type(LuaValueType::NUMBER);
|
||||
sb.write_double(value);
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ void UlxLuaCallLibrary::LuaCallArgument_vector(UObject *context, const FVector &
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->GetLuaCallBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(LuaValueType::VECTOR);
|
||||
sb.write_lua_value_type(LuaValueType::VECTOR);
|
||||
sb.write_fvector(pvector);
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ void UlxLuaCallLibrary::LuaCallArgument_vector2d(UObject *context, const FVector
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->GetLuaCallBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(LuaValueType::VECTOR);
|
||||
sb.write_lua_value_type(LuaValueType::VECTOR);
|
||||
sb.write_double(pvector.X);
|
||||
sb.write_double(pvector.Y);
|
||||
sb.write_double(0.0);
|
||||
@@ -345,7 +345,7 @@ void UlxLuaCallLibrary::LuaCallArgument_boolean(UObject *context, bool pbool) {
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->GetLuaCallBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
sb.write_simple_dynamic_tag(LuaValueType::BOOLEAN);
|
||||
sb.write_lua_value_type(LuaValueType::BOOLEAN);
|
||||
sb.write_bool(pbool);
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ bool UlxLuaValues::Initialize(std::string_view data)
|
||||
|
||||
while (!Decoder.empty())
|
||||
{
|
||||
LuaValueType Tag = Decoder.read_simple_dynamic_tag();
|
||||
LuaValueType Tag = Decoder.read_lua_value_type();
|
||||
|
||||
int64 Pos = Decoder.total_reads();
|
||||
ElxLuaValueType Type;
|
||||
|
||||
@@ -10,6 +10,9 @@ private:
|
||||
bool err_integer_truncated_;
|
||||
public:
|
||||
using string_type = std::string;
|
||||
using fvector_type = FVector;
|
||||
using dvector_type = FVector;
|
||||
using luavalue_type = BaseLuaValue<std::string>;
|
||||
void *basebuffer_malloc(size_t size) { return malloc(size); }
|
||||
void basebuffer_free(void *p) { free(p); }
|
||||
void clear_error_flags() { err_eof_on_read_ = err_string_too_long_ = err_integer_truncated_ = false; }
|
||||
|
||||
Reference in New Issue
Block a user