mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Code formatting and cleanup
This commit is contained in:
parent
f3de2cfe1c
commit
8754e0ebb3
@ -332,7 +332,7 @@ void CClient::initPlayerInterfaces()
|
||||
logNetwork->trace("Initialized player interfaces %d ms", CSH->th->getDiff());
|
||||
}
|
||||
|
||||
std::string CClient::aiNameForPlayer(const PlayerSettings & ps, bool battleAI, bool alliedToHuman)
|
||||
std::string CClient::aiNameForPlayer(const PlayerSettings & ps, bool battleAI, bool alliedToHuman) const
|
||||
{
|
||||
if(ps.name.size())
|
||||
{
|
||||
@ -344,7 +344,7 @@ std::string CClient::aiNameForPlayer(const PlayerSettings & ps, bool battleAI, b
|
||||
return aiNameForPlayer(battleAI, alliedToHuman);
|
||||
}
|
||||
|
||||
std::string CClient::aiNameForPlayer(bool battleAI, bool alliedToHuman)
|
||||
std::string CClient::aiNameForPlayer(bool battleAI, bool alliedToHuman) const
|
||||
{
|
||||
const int sensibleAILimit = settings["session"]["oneGoodAI"].Bool() ? 1 : PlayerColor::PLAYER_LIMIT_I;
|
||||
std::string goodAdventureAI = alliedToHuman ? settings["server"]["alliedAI"].String() : settings["server"]["playerAI"].String();
|
||||
|
@ -138,8 +138,8 @@ public:
|
||||
void initMapHandler();
|
||||
void initPlayerEnvironments();
|
||||
void initPlayerInterfaces();
|
||||
std::string aiNameForPlayer(const PlayerSettings & ps, bool battleAI, bool alliedToHuman); //empty means no AI -> human
|
||||
std::string aiNameForPlayer(bool battleAI, bool alliedToHuman);
|
||||
std::string aiNameForPlayer(const PlayerSettings & ps, bool battleAI, bool alliedToHuman) const; //empty means no AI -> human
|
||||
std::string aiNameForPlayer(bool battleAI, bool alliedToHuman) const;
|
||||
void installNewPlayerInterface(std::shared_ptr<CGameInterface> gameInterface, PlayerColor color, bool battlecb = false);
|
||||
void installNewBattleInterface(std::shared_ptr<CBattleGameInterface> battleInterface, PlayerColor color, bool needCallback = true);
|
||||
|
||||
|
@ -59,54 +59,6 @@ ObjectTemplate::ObjectTemplate():
|
||||
{
|
||||
}
|
||||
|
||||
ObjectTemplate::ObjectTemplate(const ObjectTemplate& other):
|
||||
visitDir(other.visitDir),
|
||||
allowedTerrains(other.allowedTerrains),
|
||||
id(other.id),
|
||||
subid(other.subid),
|
||||
printPriority(other.printPriority),
|
||||
animationFile(other.animationFile),
|
||||
editorAnimationFile(other.editorAnimationFile),
|
||||
stringID(other.stringID),
|
||||
width(other.width),
|
||||
height(other.height),
|
||||
visitable(other.visitable),
|
||||
blockedOffsets(other.blockedOffsets),
|
||||
blockMapOffset(other.blockMapOffset),
|
||||
visitableOffset(other.visitableOffset)
|
||||
{
|
||||
//default copy constructor is failing with usedTiles this for unknown reason
|
||||
|
||||
usedTiles.resize(other.usedTiles.size());
|
||||
for(size_t i = 0; i < usedTiles.size(); i++)
|
||||
std::copy(other.usedTiles[i].begin(), other.usedTiles[i].end(), std::back_inserter(usedTiles[i]));
|
||||
}
|
||||
|
||||
ObjectTemplate & ObjectTemplate::operator=(const ObjectTemplate & rhs)
|
||||
{
|
||||
visitDir = rhs.visitDir;
|
||||
allowedTerrains = rhs.allowedTerrains;
|
||||
id = rhs.id;
|
||||
subid = rhs.subid;
|
||||
printPriority = rhs.printPriority;
|
||||
animationFile = rhs.animationFile;
|
||||
editorAnimationFile = rhs.editorAnimationFile;
|
||||
stringID = rhs.stringID;
|
||||
width = rhs.width;
|
||||
height = rhs.height;
|
||||
visitable = rhs.visitable;
|
||||
blockedOffsets = rhs.blockedOffsets;
|
||||
blockMapOffset = rhs.blockMapOffset;
|
||||
visitableOffset = rhs.visitableOffset;
|
||||
|
||||
usedTiles.clear();
|
||||
usedTiles.resize(rhs.usedTiles.size());
|
||||
for(size_t i = 0; i < usedTiles.size(); i++)
|
||||
std::copy(rhs.usedTiles[i].begin(), rhs.usedTiles[i].end(), std::back_inserter(usedTiles[i]));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ObjectTemplate::afterLoadFixup()
|
||||
{
|
||||
if(id == Obj::EVENT)
|
||||
|
@ -123,10 +123,6 @@ public:
|
||||
bool canBePlacedAt(TerrainId terrain) const;
|
||||
|
||||
ObjectTemplate();
|
||||
//custom copy constructor is required
|
||||
ObjectTemplate(const ObjectTemplate & other);
|
||||
|
||||
ObjectTemplate& operator=(const ObjectTemplate & rhs);
|
||||
|
||||
void readTxt(CLegacyConfigParser & parser);
|
||||
void readMsk();
|
||||
|
@ -101,9 +101,9 @@ class BinaryDeserializer : public CLoaderBase
|
||||
}
|
||||
};
|
||||
|
||||
STRONG_INLINE ui32 readAndCheckLength()
|
||||
STRONG_INLINE uint32_t readAndCheckLength()
|
||||
{
|
||||
ui32 length;
|
||||
uint32_t length;
|
||||
load(length);
|
||||
//NOTE: also used for h3m's embedded in campaigns, so it may be quite large in some cases (e.g. XXL maps with multiple objects)
|
||||
if(length > 1000000)
|
||||
@ -119,7 +119,7 @@ class BinaryDeserializer : public CLoaderBase
|
||||
class IPointerLoader
|
||||
{
|
||||
public:
|
||||
virtual Serializeable * loadPtr(CLoaderBase &ar, IGameCallback * cb, ui32 pid) const =0; //data is pointer to the ACTUAL POINTER
|
||||
virtual Serializeable * loadPtr(CLoaderBase &ar, IGameCallback * cb, uint32_t pid) const =0; //data is pointer to the ACTUAL POINTER
|
||||
virtual ~IPointerLoader() = default;
|
||||
|
||||
template<typename Type> static IPointerLoader *getApplier(const Type * t = nullptr)
|
||||
@ -132,7 +132,7 @@ class BinaryDeserializer : public CLoaderBase
|
||||
class CPointerLoader : public IPointerLoader
|
||||
{
|
||||
public:
|
||||
Serializeable * loadPtr(CLoaderBase &ar, IGameCallback * cb, ui32 pid) const override //data is pointer to the ACTUAL POINTER
|
||||
Serializeable * loadPtr(CLoaderBase &ar, IGameCallback * cb, uint32_t pid) const override //data is pointer to the ACTUAL POINTER
|
||||
{
|
||||
auto & s = static_cast<BinaryDeserializer &>(ar);
|
||||
|
||||
@ -157,13 +157,13 @@ public:
|
||||
Version version;
|
||||
|
||||
std::vector<std::string> loadedStrings;
|
||||
std::map<ui32, Serializeable*> loadedPointers;
|
||||
std::map<uint32_t, Serializeable*> loadedPointers;
|
||||
std::map<const Serializeable*, std::shared_ptr<Serializeable>> loadedSharedPointers;
|
||||
IGameCallback * cb = nullptr;
|
||||
bool smartPointerSerialization;
|
||||
bool saving;
|
||||
|
||||
bool hasFeature(Version what)
|
||||
bool hasFeature(Version what) const
|
||||
{
|
||||
return version >= what;
|
||||
};
|
||||
@ -238,8 +238,8 @@ public:
|
||||
template < typename T, typename std::enable_if_t < std::is_array_v<T>, int > = 0 >
|
||||
void load(T &data)
|
||||
{
|
||||
ui32 size = std::size(data);
|
||||
for(ui32 i = 0; i < size; i++)
|
||||
uint32_t size = std::size(data);
|
||||
for(uint32_t i = 0; i < size; i++)
|
||||
load(data[i]);
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ public:
|
||||
template < typename T, typename std::enable_if_t < std::is_enum_v<T>, int > = 0 >
|
||||
void load(T &data)
|
||||
{
|
||||
si32 read;
|
||||
int32_t read;
|
||||
load( read );
|
||||
data = static_cast<T>(read);
|
||||
}
|
||||
@ -259,7 +259,7 @@ public:
|
||||
template < typename T, typename std::enable_if_t < std::is_same_v<T, bool>, int > = 0 >
|
||||
void load(T &data)
|
||||
{
|
||||
ui8 read;
|
||||
uint8_t read;
|
||||
load( read );
|
||||
data = static_cast<bool>(read);
|
||||
}
|
||||
@ -267,18 +267,18 @@ public:
|
||||
template <typename T, typename std::enable_if_t < !std::is_same_v<T, bool >, int > = 0>
|
||||
void load(std::vector<T> &data)
|
||||
{
|
||||
ui32 length = readAndCheckLength();
|
||||
uint32_t length = readAndCheckLength();
|
||||
data.resize(length);
|
||||
for(ui32 i=0;i<length;i++)
|
||||
for(uint32_t i=0;i<length;i++)
|
||||
load( data[i]);
|
||||
}
|
||||
|
||||
template <typename T, typename std::enable_if_t < !std::is_same_v<T, bool >, int > = 0>
|
||||
void load(std::deque<T> & data)
|
||||
{
|
||||
ui32 length = readAndCheckLength();
|
||||
uint32_t length = readAndCheckLength();
|
||||
data.resize(length);
|
||||
for(ui32 i = 0; i < length; i++)
|
||||
for(uint32_t i = 0; i < length; i++)
|
||||
load(data[i]);
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
ui32 pid = 0xffffffff; //pointer id (or maybe rather pointee id)
|
||||
uint32_t pid = 0xffffffff; //pointer id (or maybe rather pointee id)
|
||||
if(smartPointerSerialization)
|
||||
{
|
||||
load( pid ); //get the id
|
||||
@ -351,7 +351,7 @@ public:
|
||||
}
|
||||
}
|
||||
//get type id
|
||||
ui16 tid;
|
||||
uint16_t tid;
|
||||
load( tid );
|
||||
|
||||
if(!tid)
|
||||
@ -376,7 +376,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ptrAllocated(T *ptr, ui32 pid)
|
||||
void ptrAllocated(T *ptr, uint32_t pid)
|
||||
{
|
||||
if(smartPointerSerialization && pid != 0xffffffff)
|
||||
loadedPointers[pid] = const_cast<Serializeable*>(dynamic_cast<const Serializeable*>(ptr)); //add loaded pointer to our lookup map; cast is to avoid errors with const T* pt
|
||||
@ -394,7 +394,7 @@ public:
|
||||
NonConstT *internalPtr;
|
||||
load(internalPtr);
|
||||
|
||||
Serializeable * internalPtrDerived = static_cast<Serializeable*>(internalPtr);
|
||||
const auto * internalPtrDerived = static_cast<Serializeable*>(internalPtr);
|
||||
|
||||
if(internalPtr)
|
||||
{
|
||||
@ -441,16 +441,16 @@ public:
|
||||
template <typename T, size_t N>
|
||||
void load(std::array<T, N> &data)
|
||||
{
|
||||
for(ui32 i = 0; i < N; i++)
|
||||
for(uint32_t i = 0; i < N; i++)
|
||||
load( data[i] );
|
||||
}
|
||||
template <typename T>
|
||||
void load(std::set<T> &data)
|
||||
{
|
||||
ui32 length = readAndCheckLength();
|
||||
uint32_t length = readAndCheckLength();
|
||||
data.clear();
|
||||
T ins;
|
||||
for(ui32 i=0;i<length;i++)
|
||||
for(uint32_t i=0;i<length;i++)
|
||||
{
|
||||
load( ins );
|
||||
data.insert(ins);
|
||||
@ -459,10 +459,10 @@ public:
|
||||
template <typename T, typename U>
|
||||
void load(std::unordered_set<T, U> &data)
|
||||
{
|
||||
ui32 length = readAndCheckLength();
|
||||
uint32_t length = readAndCheckLength();
|
||||
data.clear();
|
||||
T ins;
|
||||
for(ui32 i=0;i<length;i++)
|
||||
for(uint32_t i=0;i<length;i++)
|
||||
{
|
||||
load(ins);
|
||||
data.insert(ins);
|
||||
@ -471,10 +471,10 @@ public:
|
||||
template <typename T>
|
||||
void load(std::list<T> &data)
|
||||
{
|
||||
ui32 length = readAndCheckLength();
|
||||
uint32_t length = readAndCheckLength();
|
||||
data.clear();
|
||||
T ins;
|
||||
for(ui32 i=0;i<length;i++)
|
||||
for(uint32_t i=0;i<length;i++)
|
||||
{
|
||||
load(ins);
|
||||
data.push_back(ins);
|
||||
@ -490,10 +490,10 @@ public:
|
||||
template <typename T1, typename T2>
|
||||
void load(std::unordered_map<T1,T2> &data)
|
||||
{
|
||||
ui32 length = readAndCheckLength();
|
||||
uint32_t length = readAndCheckLength();
|
||||
data.clear();
|
||||
T1 key;
|
||||
for(ui32 i=0;i<length;i++)
|
||||
for(uint32_t i=0;i<length;i++)
|
||||
{
|
||||
load(key);
|
||||
load(data[key]);
|
||||
@ -503,10 +503,10 @@ public:
|
||||
template <typename T1, typename T2>
|
||||
void load(std::map<T1,T2> &data)
|
||||
{
|
||||
ui32 length = readAndCheckLength();
|
||||
uint32_t length = readAndCheckLength();
|
||||
data.clear();
|
||||
T1 key;
|
||||
for(ui32 i=0;i<length;i++)
|
||||
for(uint32_t i=0;i<length;i++)
|
||||
{
|
||||
load(key);
|
||||
load(data[key]);
|
||||
@ -537,7 +537,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
ui32 length = readAndCheckLength();
|
||||
uint32_t length = readAndCheckLength();
|
||||
data.resize(length);
|
||||
this->read(static_cast<void *>(data.data()), length, false);
|
||||
}
|
||||
@ -546,7 +546,7 @@ public:
|
||||
template<typename... TN>
|
||||
void load(std::variant<TN...> & data)
|
||||
{
|
||||
si32 which;
|
||||
int32_t which;
|
||||
load( which );
|
||||
assert(which < sizeof...(TN));
|
||||
|
||||
@ -561,7 +561,7 @@ public:
|
||||
template<typename T>
|
||||
void load(std::optional<T> & data)
|
||||
{
|
||||
ui8 present;
|
||||
uint8_t present;
|
||||
load( present );
|
||||
if(present)
|
||||
{
|
||||
@ -579,16 +579,16 @@ public:
|
||||
template <typename T>
|
||||
void load(boost::multi_array<T, 3> & data)
|
||||
{
|
||||
ui32 length = readAndCheckLength();
|
||||
ui32 x;
|
||||
ui32 y;
|
||||
ui32 z;
|
||||
uint32_t length = readAndCheckLength();
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t z;
|
||||
load(x);
|
||||
load(y);
|
||||
load(z);
|
||||
data.resize(boost::extents[x][y][z]);
|
||||
assert(length == data.num_elements()); //x*y*z should be equal to number of elements
|
||||
for(ui32 i = 0; i < length; i++)
|
||||
for(uint32_t i = 0; i < length; i++)
|
||||
load(data.data()[i]);
|
||||
}
|
||||
template <std::size_t T>
|
||||
|
@ -24,7 +24,7 @@ protected:
|
||||
public:
|
||||
CSaverBase(IBinaryWriter * w): writer(w){};
|
||||
|
||||
inline void write(const void * data, unsigned size)
|
||||
void write(const void * data, unsigned size)
|
||||
{
|
||||
writer->write(reinterpret_cast<const std::byte*>(data), size);
|
||||
};
|
||||
@ -86,7 +86,7 @@ class BinarySerializer : public CSaverBase
|
||||
{
|
||||
public:
|
||||
virtual void savePtr(CSaverBase &ar, const void *data) const =0;
|
||||
virtual ~CBasicPointerSaver(){}
|
||||
virtual ~CBasicPointerSaver() = default;
|
||||
|
||||
template<typename T> static CBasicPointerSaver *getApplier(const T * t=nullptr)
|
||||
{
|
||||
@ -115,13 +115,13 @@ public:
|
||||
using Version = ESerializationVersion;
|
||||
|
||||
std::map<std::string, uint32_t> savedStrings;
|
||||
std::map<const Serializeable*, ui32> savedPointers;
|
||||
std::map<const Serializeable*, uint32_t> savedPointers;
|
||||
|
||||
const Version version = Version::CURRENT;
|
||||
bool smartPointerSerialization;
|
||||
bool saving;
|
||||
|
||||
bool hasFeature(Version what)
|
||||
bool hasFeature(Version what) const
|
||||
{
|
||||
return version >= what;
|
||||
};
|
||||
@ -162,7 +162,7 @@ public:
|
||||
template < typename T, typename std::enable_if_t < std::is_same_v<T, bool>, int > = 0 >
|
||||
void save(const T &data)
|
||||
{
|
||||
ui8 writ = static_cast<ui8>(data);
|
||||
uint8_t writ = static_cast<uint8_t>(data);
|
||||
save(writ);
|
||||
}
|
||||
|
||||
@ -198,15 +198,15 @@ public:
|
||||
template < typename T, typename std::enable_if_t < std::is_enum_v<T>, int > = 0 >
|
||||
void save(const T &data)
|
||||
{
|
||||
si32 writ = static_cast<si32>(data);
|
||||
int32_t writ = static_cast<int32_t>(data);
|
||||
*this & writ;
|
||||
}
|
||||
|
||||
template < typename T, typename std::enable_if_t < std::is_array_v<T>, int > = 0 >
|
||||
void save(const T &data)
|
||||
{
|
||||
ui32 size = std::size(data);
|
||||
for(ui32 i=0; i < size; i++)
|
||||
uint32_t size = std::size(data);
|
||||
for(uint32_t i=0; i < size; i++)
|
||||
*this & data[i];
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ public:
|
||||
{
|
||||
// We might have an object that has multiple inheritance and store it via the non-first base pointer.
|
||||
// Therefore, all pointers need to be normalized to the actual object address.
|
||||
const Serializeable * actualPointer = static_cast<const Serializeable*>(data);
|
||||
const auto * actualPointer = static_cast<const Serializeable*>(data);
|
||||
auto i = savedPointers.find(actualPointer);
|
||||
if(i != savedPointers.end())
|
||||
{
|
||||
@ -271,7 +271,7 @@ public:
|
||||
}
|
||||
|
||||
//give id to this pointer
|
||||
ui32 pid = (ui32)savedPointers.size();
|
||||
uint32_t pid = savedPointers.size();
|
||||
savedPointers[actualPointer] = pid;
|
||||
save(pid);
|
||||
}
|
||||
@ -318,30 +318,30 @@ public:
|
||||
template <typename T, typename std::enable_if_t < !std::is_same_v<T, bool >, int > = 0>
|
||||
void save(const std::vector<T> &data)
|
||||
{
|
||||
ui32 length = (ui32)data.size();
|
||||
uint32_t length = data.size();
|
||||
*this & length;
|
||||
for(ui32 i=0;i<length;i++)
|
||||
for(uint32_t i=0;i<length;i++)
|
||||
save(data[i]);
|
||||
}
|
||||
template <typename T, typename std::enable_if_t < !std::is_same_v<T, bool >, int > = 0>
|
||||
void save(const std::deque<T> & data)
|
||||
{
|
||||
ui32 length = (ui32)data.size();
|
||||
uint32_t length = data.size();
|
||||
*this & length;
|
||||
for(ui32 i = 0; i < length; i++)
|
||||
for(uint32_t i = 0; i < length; i++)
|
||||
save(data[i]);
|
||||
}
|
||||
template <typename T, size_t N>
|
||||
void save(const std::array<T, N> &data)
|
||||
{
|
||||
for(ui32 i=0; i < N; i++)
|
||||
for(uint32_t i=0; i < N; i++)
|
||||
save(data[i]);
|
||||
}
|
||||
template <typename T>
|
||||
void save(const std::set<T> &data)
|
||||
{
|
||||
auto & d = const_cast<std::set<T> &>(data);
|
||||
ui32 length = (ui32)d.size();
|
||||
uint32_t length = d.size();
|
||||
save(length);
|
||||
for(auto i = d.begin(); i != d.end(); i++)
|
||||
save(*i);
|
||||
@ -350,7 +350,7 @@ public:
|
||||
void save(const std::unordered_set<T, U> &data)
|
||||
{
|
||||
auto & d = const_cast<std::unordered_set<T, U> &>(data);
|
||||
ui32 length = (ui32)d.size();
|
||||
uint32_t length = d.size();
|
||||
*this & length;
|
||||
for(auto i = d.begin(); i != d.end(); i++)
|
||||
save(*i);
|
||||
@ -359,7 +359,7 @@ public:
|
||||
void save(const std::list<T> &data)
|
||||
{
|
||||
auto & d = const_cast<std::list<T> &>(data);
|
||||
ui32 length = (ui32)d.size();
|
||||
uint32_t length = d.size();
|
||||
*this & length;
|
||||
for(auto i = d.begin(); i != d.end(); i++)
|
||||
save(*i);
|
||||
@ -371,7 +371,7 @@ public:
|
||||
{
|
||||
if (data.empty())
|
||||
{
|
||||
save(ui32(0));
|
||||
save(static_cast<uint32_t>(0));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ public:
|
||||
|
||||
if (it == savedStrings.end())
|
||||
{
|
||||
save(ui32(data.length()));
|
||||
save(static_cast<uint32_t>(data.length()));
|
||||
this->write(static_cast<const void *>(data.data()), data.size());
|
||||
|
||||
// -1, -2...
|
||||
@ -395,7 +395,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
save(ui32(data.length()));
|
||||
save(static_cast<uint32_t>(data.length()));
|
||||
this->write(static_cast<const void *>(data.data()), data.size());
|
||||
}
|
||||
}
|
||||
@ -409,7 +409,7 @@ public:
|
||||
template <typename T1, typename T2>
|
||||
void save(const std::unordered_map<T1,T2> &data)
|
||||
{
|
||||
*this & ui32(data.size());
|
||||
*this & static_cast<uint32_t>(data.size());
|
||||
for(auto i = data.begin(); i != data.end(); i++)
|
||||
{
|
||||
save(i->first);
|
||||
@ -419,7 +419,7 @@ public:
|
||||
template <typename T1, typename T2>
|
||||
void save(const std::map<T1,T2> &data)
|
||||
{
|
||||
*this & ui32(data.size());
|
||||
*this & static_cast<uint32_t>(data.size());
|
||||
for(auto i = data.begin(); i != data.end(); i++)
|
||||
{
|
||||
save(i->first);
|
||||
@ -429,7 +429,7 @@ public:
|
||||
template <typename T1, typename T2>
|
||||
void save(const std::multimap<T1, T2> &data)
|
||||
{
|
||||
*this & ui32(data.size());
|
||||
*this & static_cast<uint32_t>(data.size());
|
||||
for(auto i = data.begin(); i != data.end(); i++)
|
||||
{
|
||||
save(i->first);
|
||||
@ -439,7 +439,7 @@ public:
|
||||
template<typename T0, typename... TN>
|
||||
void save(const std::variant<T0, TN...> & data)
|
||||
{
|
||||
si32 which = data.index();
|
||||
int32_t which = data.index();
|
||||
save(which);
|
||||
|
||||
VariantVisitorSaver<BinarySerializer> visitor(*this);
|
||||
@ -450,26 +450,26 @@ public:
|
||||
{
|
||||
if(data)
|
||||
{
|
||||
save((ui8)1);
|
||||
save(static_cast<uint8_t>(1));
|
||||
save(*data);
|
||||
}
|
||||
else
|
||||
{
|
||||
save((ui8)0);
|
||||
save(static_cast<uint32_t>(0));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void save(const boost::multi_array<T, 3> &data)
|
||||
{
|
||||
ui32 length = data.num_elements();
|
||||
uint32_t length = data.num_elements();
|
||||
*this & length;
|
||||
auto shape = data.shape();
|
||||
ui32 x = shape[0];
|
||||
ui32 y = shape[1];
|
||||
ui32 z = shape[2];
|
||||
uint32_t x = shape[0];
|
||||
uint32_t y = shape[1];
|
||||
uint32_t z = shape[2];
|
||||
*this & x & y & z;
|
||||
for(ui32 i = 0; i < length; i++)
|
||||
for(uint32_t i = 0; i < length; i++)
|
||||
save(data.data()[i]);
|
||||
}
|
||||
template <std::size_t T>
|
||||
|
Loading…
x
Reference in New Issue
Block a user