Add TIdentifier specialization for OrcaStream

This commit is contained in:
ζeh Matt 2021-11-24 19:34:53 +02:00
parent 63702fcc6f
commit f704358cb3
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 16 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#include "../world/Location.hpp"
#include "Crypt.h"
#include "FileStream.h"
#include "Identifier.hpp"
#include "MemoryStream.h"
#include <algorithm>
@ -312,6 +313,21 @@ namespace OpenRCT2
}
}
template<typename T, T TNullValue, typename TTag> void ReadWrite(TIdentifier<T, TNullValue, TTag>& value)
{
if (_mode == Mode::READING)
{
T temp{};
ReadWrite(temp);
value = TIdentifier<T, TNullValue, TTag>::FromUnderlying(temp);
}
else
{
const auto temp = value.ToUnderlying();
ReadWrite(temp);
}
}
void ReadWrite(bool& value)
{
uint8_t value8 = value ? 1 : 0;