indent with tabs
This commit is contained in:
@@ -136,7 +136,8 @@ private:
|
||||
bool m_IsBigTower;
|
||||
public:
|
||||
TowerInfo(std::string&& name, std::string&& description, bool big) : m_Name(std::move(name)),
|
||||
m_Description(std::move(description)), m_IsBigTower(big) {}
|
||||
m_Description(std::move(description)), m_IsBigTower(big) {
|
||||
}
|
||||
|
||||
const std::string& GetName() const { return m_Name; }
|
||||
const std::string& GetDescription() const { return m_Description; }
|
||||
|
||||
@@ -28,7 +28,7 @@ struct ChunkCoord {
|
||||
namespace std {
|
||||
template <>
|
||||
struct hash<td::game::ChunkCoord> {
|
||||
std::size_t operator()(const td::game::ChunkCoord& key) const noexcept{
|
||||
std::size_t operator()(const td::game::ChunkCoord& key) const noexcept {
|
||||
return std::hash<std::int16_t>()(key.x << 16 | key.y);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,8 +11,7 @@ namespace server {
|
||||
|
||||
class Server;
|
||||
|
||||
struct KeepAlive
|
||||
{
|
||||
struct KeepAlive {
|
||||
std::uint64_t keepAliveID = 0;
|
||||
std::uint64_t sendTime;
|
||||
bool recievedResponse = false;
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace td {
|
||||
namespace utils {
|
||||
|
||||
template <typename... Args>
|
||||
std::string format(const std::string& format, Args... args){
|
||||
std::string format(const std::string& format, Args... args) {
|
||||
int size = snprintf(nullptr, 0, format.c_str(), args...) + 1; // Extra space for '\0'
|
||||
if (size <= 0){
|
||||
if (size <= 0) {
|
||||
throw std::runtime_error("Error during formatting.");
|
||||
}
|
||||
std::unique_ptr<char[]> buf(new char[size]);
|
||||
|
||||
@@ -424,7 +424,8 @@ public:
|
||||
SpawnMobPacket() {}
|
||||
SpawnMobPacket(game::MobID id, game::MobType type, std::uint8_t level, game::PlayerID sender,
|
||||
float x, float y, game::Direction dir) : m_MobID(id), m_MobType(type), m_MobLevel(level),
|
||||
m_MobDirection(dir), m_Sender(sender), m_MobX(x), m_MobY(y) {}
|
||||
m_MobDirection(dir), m_Sender(sender), m_MobX(x), m_MobY(y) {
|
||||
}
|
||||
virtual ~SpawnMobPacket() {}
|
||||
|
||||
virtual DataBuffer Serialize(bool packetID = true) const;
|
||||
@@ -449,7 +450,8 @@ private:
|
||||
public:
|
||||
PlaceTowerPacket() {}
|
||||
PlaceTowerPacket(std::int32_t x, std::int32_t y, game::TowerType type) :
|
||||
m_TowerX(x), m_TowerY(y), m_TowerType(type) {}
|
||||
m_TowerX(x), m_TowerY(y), m_TowerType(type) {
|
||||
}
|
||||
virtual ~PlaceTowerPacket() {}
|
||||
|
||||
virtual DataBuffer Serialize(bool packetID = true) const;
|
||||
@@ -472,7 +474,8 @@ private:
|
||||
public:
|
||||
WorldAddTowerPacket() {}
|
||||
WorldAddTowerPacket(game::TowerID id, std::int32_t x, std::int32_t y, game::TowerType type, game::PlayerID player) :
|
||||
m_TowerID(id), m_TowerX(x), m_TowerY(y), m_TowerType(type), m_Builder(player) {}
|
||||
m_TowerID(id), m_TowerX(x), m_TowerY(y), m_TowerType(type), m_Builder(player) {
|
||||
}
|
||||
virtual ~WorldAddTowerPacket() {}
|
||||
|
||||
virtual DataBuffer Serialize(bool packetID = true) const;
|
||||
@@ -534,7 +537,8 @@ private:
|
||||
public:
|
||||
MobState() {}
|
||||
MobState(game::MobID id, const Point& position, float life, game::Direction direction) :
|
||||
m_MobID(id), m_MobPosition(position), m_MobLife(life), m_MobDirection(direction) {}
|
||||
m_MobID(id), m_MobPosition(position), m_MobLife(life), m_MobDirection(direction) {
|
||||
}
|
||||
|
||||
game::MobID GetMobId() const { return m_MobID; }
|
||||
Point GetMobPosition() const { return m_MobPosition; }
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
DataBuffer::DataBuffer() : m_ReadOffset(0) { }
|
||||
DataBuffer::DataBuffer(const DataBuffer& other) : m_Buffer(other.m_Buffer), m_ReadOffset(other.m_ReadOffset) { }
|
||||
DataBuffer::DataBuffer(DataBuffer&& other) : m_Buffer(std::move(other.m_Buffer)), m_ReadOffset(std::move(other.m_ReadOffset)) { }
|
||||
DataBuffer::DataBuffer(const std::string& str) : m_Buffer(str.begin(), str.end()), m_ReadOffset(0) { }
|
||||
DataBuffer::DataBuffer() : m_ReadOffset(0) {}
|
||||
DataBuffer::DataBuffer(const DataBuffer& other) : m_Buffer(other.m_Buffer), m_ReadOffset(other.m_ReadOffset) {}
|
||||
DataBuffer::DataBuffer(DataBuffer&& other) : m_Buffer(std::move(other.m_Buffer)), m_ReadOffset(std::move(other.m_ReadOffset)) {}
|
||||
DataBuffer::DataBuffer(const std::string& str) : m_Buffer(str.begin(), str.end()), m_ReadOffset(0) {}
|
||||
|
||||
DataBuffer::DataBuffer(const DataBuffer& other, Data::difference_type offset) : m_ReadOffset(0) {
|
||||
m_Buffer.reserve(other.GetSize() - static_cast<std::size_t>(offset));
|
||||
|
||||
@@ -16,8 +16,7 @@ Socket::Socket(Type type)
|
||||
: m_Blocking(false),
|
||||
m_Type(type),
|
||||
m_Status(Disconnected),
|
||||
m_Handle(static_cast<SocketHandle>(INVALID_SOCKET))
|
||||
{
|
||||
m_Handle(static_cast<SocketHandle>(INVALID_SOCKET)) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,7 @@ namespace td {
|
||||
namespace network {
|
||||
|
||||
UDPSocket::UDPSocket()
|
||||
: Socket(Socket::UDP), m_Port(0)
|
||||
{
|
||||
: Socket(Socket::UDP), m_Port(0) {
|
||||
m_Handle = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user