change DelayedPacket name
This commit is contained in:
@@ -62,13 +62,13 @@ public:
|
|||||||
virtual bool IsTimed() const { return false; }
|
virtual bool IsTimed() const { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TimedPacket : public Packet {
|
class DelayedPacket : public Packet {
|
||||||
protected:
|
protected:
|
||||||
std::uint64_t m_PacketTime = 69;
|
std::uint64_t m_PacketTime = 69;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TimedPacket() {}
|
DelayedPacket() {}
|
||||||
virtual ~TimedPacket() {}
|
virtual ~DelayedPacket() {}
|
||||||
|
|
||||||
virtual DataBuffer Serialize(bool packetID = true) const = 0;
|
virtual DataBuffer Serialize(bool packetID = true) const = 0;
|
||||||
virtual void Deserialize(DataBuffer& data) = 0;
|
virtual void Deserialize(DataBuffer& data) = 0;
|
||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef std::unique_ptr<Packet> PacketPtr;
|
typedef std::unique_ptr<Packet> PacketPtr;
|
||||||
typedef std::unique_ptr<TimedPacket> TimedPacketPtr;
|
typedef std::unique_ptr<DelayedPacket> DelayedPacketPtr;
|
||||||
|
|
||||||
} // namespace protocol
|
} // namespace protocol
|
||||||
} // namespace td
|
} // namespace td
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
|
|
||||||
class KeepAlivePacket : public TimedPacket {
|
class KeepAlivePacket : public Packet{
|
||||||
private:
|
private:
|
||||||
std::uint64_t m_AliveID;
|
std::uint64_t m_AliveID;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
|
|
||||||
class RemoveTowerPacket : public TimedPacket {
|
class RemoveTowerPacket : public DelayedPacket {
|
||||||
private:
|
private:
|
||||||
game::TowerID m_TowerID;
|
game::TowerID m_TowerID;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
game::Direction GetMobDirection() const { return m_MobDirection; }
|
game::Direction GetMobDirection() const { return m_MobDirection; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class UpdateMobStatesPacket : public TimedPacket {
|
class UpdateMobStatesPacket : public DelayedPacket {
|
||||||
private:
|
private:
|
||||||
std::vector<MobState> m_MobStates;
|
std::vector<MobState> m_MobStates;
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
|
|
||||||
class UpgradeTowerPacket : public TimedPacket {
|
class UpgradeTowerPacket : public DelayedPacket {
|
||||||
private:
|
private:
|
||||||
game::TowerID m_TowerID;
|
game::TowerID m_TowerID;
|
||||||
game::TowerLevel m_TowerLevel;
|
game::TowerLevel m_TowerLevel;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
namespace td {
|
namespace td {
|
||||||
namespace protocol {
|
namespace protocol {
|
||||||
|
|
||||||
class WorldAddTowerPacket : public TimedPacket {
|
class WorldAddTowerPacket : public DelayedPacket {
|
||||||
private:
|
private:
|
||||||
game::TowerID m_TowerID;
|
game::TowerID m_TowerID;
|
||||||
std::int32_t m_TowerX, m_TowerY;
|
std::int32_t m_TowerX, m_TowerY;
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ PacketPtr CreatePacket(PacketType type, DataBuffer& buffer) {
|
|||||||
|
|
||||||
packet = packets[type]();
|
packet = packets[type]();
|
||||||
|
|
||||||
TimedPacket* timedPacket = reinterpret_cast<TimedPacket*>(packet.get());
|
DelayedPacket* delayedPacket = reinterpret_cast<DelayedPacket*>(packet.get());
|
||||||
timedPacket->SetPacketTime(packetTime);
|
delayedPacket->SetPacketTime(packetTime);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
packet = packets[type]();
|
packet = packets[type]();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void Packet::WritePacketID(DataBuffer& data, bool packetID) const {
|
|||||||
data << GetID();
|
data << GetID();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimedPacket::WritePacketID(DataBuffer& data, bool packetID) const {
|
void DelayedPacket::WritePacketID(DataBuffer& data, bool packetID) const {
|
||||||
if (packetID)
|
if (packetID)
|
||||||
data << static_cast<std::uint8_t>(GetID() | static_cast<std::uint8_t>(0x80)) << m_PacketTime;
|
data << static_cast<std::uint8_t>(GetID() | static_cast<std::uint8_t>(0x80)) << m_PacketTime;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user