Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ bool CLuaWorldDefs::SetWorldSpecialPropertyEnabled(const WorldSpecialProperty pr

if (auto stream = g_pNet->AllocateNetBitStream())
{
stream->WriteString(EnumToString(property));
stream->Write(static_cast<std::uint8_t>(property));
stream->WriteBit(enabled);
g_pNet->SendPacket(PACKET_ID_PLAYER_WORLD_SPECIAL_PROPERTY, stream, PACKET_PRIORITY_HIGH, PACKET_RELIABILITY_RELIABLE_ORDERED);
g_pNet->DeallocateNetBitStream(stream);
Expand Down
10 changes: 5 additions & 5 deletions Server/mods/deathmatch/logic/CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4173,16 +4173,16 @@ void CGame::Packet_PlayerResourceStart(CPlayerResourceStartPacket& Packet)
void CGame::Packet_PlayerWorldSpecialProperty(CPlayerWorldSpecialPropertyPacket& packet) noexcept
{
CPlayer* player = packet.GetSourcePlayer();

if (!player)
return;

const std::string& property = packet.GetProperty();
const bool enabled = packet.IsEnabled();
const auto propertyId = static_cast<WorldSpecialProperty>(packet.GetPropertyId());
if (!EnumValueValid(propertyId))
return;

CLuaArguments arguments;
arguments.PushString(property);
arguments.PushBoolean(enabled);
arguments.PushString(EnumToString(propertyId));
arguments.PushBoolean(packet.IsEnabled());

player->CallEvent("onPlayerChangesWorldSpecialProperty", arguments, nullptr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@

bool CPlayerWorldSpecialPropertyPacket::Read(NetBitStreamInterface& stream) noexcept
{
stream.ReadString(m_property);
stream.ReadBit(m_enabled);

return true;
return stream.Read(m_propertyId) && stream.ReadBit(m_enabled);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class CPlayerWorldSpecialPropertyPacket final : public CPacket

bool Read(NetBitStreamInterface& stream) noexcept;

std::string GetProperty() const noexcept { return m_property; }
bool IsEnabled() const noexcept { return m_enabled; }
std::uint8_t GetPropertyId() const noexcept { return m_propertyId; }
bool IsEnabled() const noexcept { return m_enabled; }

private:
std::string m_property;
bool m_enabled;
std::uint8_t m_propertyId;
bool m_enabled;
};
2 changes: 1 addition & 1 deletion Shared/mods/deathmatch/logic/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ DECLARE_ENUM_CLASS(HmacAlgorithm);
DECLARE_ENUM_CLASS(ZLibFormat);
DECLARE_ENUM_CLASS(ZLibStrategy);

enum class WorldSpecialProperty
enum class WorldSpecialProperty : std::uint8_t
{
HOVERCARS,
AIRCARS,
Expand Down