change DelayedPacket name

This commit is contained in:
2023-08-12 14:53:50 +02:00
parent 8bddbce07a
commit d2e42c33a0
8 changed files with 12 additions and 12 deletions

View File

@@ -62,13 +62,13 @@ public:
virtual bool IsTimed() const { return false; }
};
class TimedPacket : public Packet {
class DelayedPacket : public Packet {
protected:
std::uint64_t m_PacketTime = 69;
public:
TimedPacket() {}
virtual ~TimedPacket() {}
DelayedPacket() {}
virtual ~DelayedPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const = 0;
virtual void Deserialize(DataBuffer& data) = 0;
@@ -84,7 +84,7 @@ public:
};
typedef std::unique_ptr<Packet> PacketPtr;
typedef std::unique_ptr<TimedPacket> TimedPacketPtr;
typedef std::unique_ptr<DelayedPacket> DelayedPacketPtr;
} // namespace protocol
} // namespace td

View File

@@ -5,7 +5,7 @@
namespace td {
namespace protocol {
class KeepAlivePacket : public TimedPacket {
class KeepAlivePacket : public Packet{
private:
std::uint64_t m_AliveID;
public:

View File

@@ -6,7 +6,7 @@
namespace td {
namespace protocol {
class RemoveTowerPacket : public TimedPacket {
class RemoveTowerPacket : public DelayedPacket {
private:
game::TowerID m_TowerID;
public:

View File

@@ -25,7 +25,7 @@ public:
game::Direction GetMobDirection() const { return m_MobDirection; }
};
class UpdateMobStatesPacket : public TimedPacket {
class UpdateMobStatesPacket : public DelayedPacket {
private:
std::vector<MobState> m_MobStates;
public:

View File

@@ -6,7 +6,7 @@
namespace td {
namespace protocol {
class UpgradeTowerPacket : public TimedPacket {
class UpgradeTowerPacket : public DelayedPacket {
private:
game::TowerID m_TowerID;
game::TowerLevel m_TowerLevel;

View File

@@ -6,7 +6,7 @@
namespace td {
namespace protocol {
class WorldAddTowerPacket : public TimedPacket {
class WorldAddTowerPacket : public DelayedPacket {
private:
game::TowerID m_TowerID;
std::int32_t m_TowerX, m_TowerY;

View File

@@ -53,8 +53,8 @@ PacketPtr CreatePacket(PacketType type, DataBuffer& buffer) {
packet = packets[type]();
TimedPacket* timedPacket = reinterpret_cast<TimedPacket*>(packet.get());
timedPacket->SetPacketTime(packetTime);
DelayedPacket* delayedPacket = reinterpret_cast<DelayedPacket*>(packet.get());
delayedPacket->SetPacketTime(packetTime);
} else {
packet = packets[type]();

View File

@@ -13,7 +13,7 @@ void Packet::WritePacketID(DataBuffer& data, bool packetID) const {
data << GetID();
}
void TimedPacket::WritePacketID(DataBuffer& data, bool packetID) const {
void DelayedPacket::WritePacketID(DataBuffer& data, bool packetID) const {
if (packetID)
data << static_cast<std::uint8_t>(GetID() | static_cast<std::uint8_t>(0x80)) << m_PacketTime;
}