fixing stuff
This commit is contained in:
48
src/game/Gen.cpp
Normal file
48
src/game/Gen.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "Gen.h"
|
||||
|
||||
namespace Generated
|
||||
{
|
||||
bool IsValid(const ModelHandle& h)
|
||||
{
|
||||
return h.ModelIdx != UINT16_MAX && IsValid(h.Asset);
|
||||
}
|
||||
bool IsValid(const AssetHandle& h)
|
||||
{
|
||||
return h.Idx != UINT32_MAX;
|
||||
}
|
||||
bool operator==(const AssetHandle& lhs, const AssetHandle& rhs)
|
||||
{
|
||||
return lhs.Idx == rhs.Idx;
|
||||
}
|
||||
bool operator==(const ModelHandle& lhs, const ModelHandle& rhs)
|
||||
{
|
||||
if (!IsValid(lhs) || !IsValid(rhs)) return IsValid(lhs) == IsValid(rhs);
|
||||
return lhs.ModelIdx == rhs.ModelIdx && lhs.Asset == rhs.Asset;
|
||||
}
|
||||
PuzPos operator+=(PuzPos lhs, const PuzPos& rhs)
|
||||
{
|
||||
lhs.X += rhs.X;
|
||||
lhs.Y += rhs.Y;
|
||||
return lhs;
|
||||
}
|
||||
PuzPos operator+(PuzPos lhs, const PuzPos& rhs)
|
||||
{
|
||||
PuzPos res = lhs;
|
||||
res.X += rhs.X;
|
||||
res.Y += rhs.Y;
|
||||
return res;
|
||||
}
|
||||
PuzPos operator-=(PuzPos lhs, const PuzPos& rhs)
|
||||
{
|
||||
lhs.X -= rhs.X;
|
||||
lhs.Y -= rhs.Y;
|
||||
return lhs;
|
||||
}
|
||||
PuzPos operator-(PuzPos lhs, const PuzPos& rhs)
|
||||
{
|
||||
PuzPos res = lhs;
|
||||
res.X += rhs.X;
|
||||
res.Y += rhs.Y;
|
||||
return res;
|
||||
}
|
||||
} // namespace Generated
|
||||
Reference in New Issue
Block a user