set OSC_ENGINE_VERSION value to compile for an earlier version
This commit is contained in:
monsieurgustav
2014-10-16 20:01:13 +02:00
parent 4a503995ea
commit cb3d2d8abb
4 changed files with 37 additions and 3 deletions
@@ -90,15 +90,25 @@ struct FOscDataElemStruct
void SetString(FName value)
{
#if OSC_ENGINE_VERSION < 40500
static_assert(sizeof(value) <= sizeof(Data), "Too short to hold the string value.");
Data = *reinterpret_cast<const int64*>(&value);
#else
static_assert(sizeof(FMinimalName) <= sizeof(Data), "Too short to hold the string value.");
const auto mininal = NameToMinimalName(value);
Data = *reinterpret_cast<const int64*>(&mininal);
#endif
Type = STRING;
Data = *reinterpret_cast<int64*>(&value);
assert(value == AsStringValue());
}
FName AsStringValue() const
{
#if OSC_ENGINE_VERSION < 40500
return *reinterpret_cast<const FName *>(&Data);
#else
return MinimalNameToName(*reinterpret_cast<const FMinimalName *>(&Data));
#endif
}
bool IsString() const
+4
View File
@@ -1,6 +1,10 @@
#pragma once
// Target engine version. Used to enable compatibility code.
#define OSC_ENGINE_VERSION 40500
/* Public Dependencies
*****************************************************************************/
@@ -150,7 +150,11 @@ void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
{
FSimpleDelegateGraphTask::CreateAndDispatchWhenReady(
FSimpleDelegateGraphTask::FDelegate::CreateUObject(this, &UOscDispatcher::CallbackMainThread),
#if OSC_ENGINE_VERSION < 40500
TEXT("OscDispatcherProcessMessages"),
#else
TStatId(),
#endif
nullptr,
ENamedThreads::GameThread);
}