forked from multitheftauto/mtasa-blue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
293 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Server/mods/deathmatch/logic/packets/CObjectBreakPacket.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto v1.0 | ||
* LICENSE: See LICENSE in the top level directory | ||
* FILE: mods/deathmatch/logic/packets/CObjectBreakPacket.cpp | ||
* PURPOSE: Header for object break packet class | ||
* | ||
* Multi Theft Auto is available from http://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#include "StdInc.h" | ||
#include "CObjectBreakPacket.h" | ||
#include <CObject.h> | ||
#include <net/SyncStructures.h> | ||
|
||
CObjectBreakPacket::CObjectBreakPacket() | ||
{ | ||
m_ObjectID = INVALID_ELEMENT_ID; | ||
m_Attacker = INVALID_ELEMENT_ID; | ||
} | ||
|
||
CObjectBreakPacket::CObjectBreakPacket(CObject* pObject, CElement* pAttacker) | ||
{ | ||
m_ObjectID = pObject->GetID(); | ||
m_Attacker = (pAttacker) ? pAttacker->GetID() : INVALID_ELEMENT_ID; | ||
} | ||
|
||
bool CObjectBreakPacket::Read(NetBitStreamInterface& BitStream) | ||
{ | ||
if (BitStream.Read(m_ObjectID) && BitStream.Read(m_Attacker)) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
bool CObjectBreakPacket::Write(NetBitStreamInterface& BitStream) const | ||
{ | ||
BitStream.Write(m_ObjectID); | ||
BitStream.Write(m_Attacker); | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto v1.0 | ||
* LICENSE: See LICENSE in the top level directory | ||
* FILE: mods/deathmatch/logic/packets/CObjectBreakPacket.h | ||
* PURPOSE: Object break state class | ||
* | ||
* Multi Theft Auto is available from http://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include "CPacket.h" | ||
|
||
class CObject; | ||
|
||
class CObjectBreakPacket final : public CPacket | ||
{ | ||
public: | ||
CObjectBreakPacket(); | ||
CObjectBreakPacket(CObject* pObject, CElement* pAttacker); | ||
|
||
ePacketID GetPacketID() const { return PACKET_ID_OBJECT_BREAK; }; | ||
unsigned long GetFlags() const { return PACKET_MEDIUM_PRIORITY | PACKET_RELIABLE; }; | ||
|
||
bool Read(NetBitStreamInterface& BitStream); | ||
bool Write(NetBitStreamInterface& BitStream) const; | ||
|
||
ElementID m_ObjectID; | ||
ElementID m_Attacker; | ||
}; |
48 changes: 48 additions & 0 deletions
48
Server/mods/deathmatch/logic/packets/CObjectDamagePacket.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto v1.0 | ||
* LICENSE: See LICENSE in the top level directory | ||
* FILE: mods/deathmatch/logic/packets/CObjectDamagePacket.cpp | ||
* PURPOSE: Header for object damage packet class | ||
* | ||
* Multi Theft Auto is available from http://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#include "StdInc.h" | ||
#include "CObjectDamagePacket.h" | ||
#include <CObject.h> | ||
#include <net/SyncStructures.h> | ||
|
||
CObjectDamagePacket::CObjectDamagePacket() | ||
{ | ||
m_ObjectID = INVALID_ELEMENT_ID; | ||
m_Attacker = INVALID_ELEMENT_ID; | ||
m_fLoss = 0; | ||
} | ||
|
||
CObjectDamagePacket::CObjectDamagePacket(CObject* pObject, float fLoss, CElement* pAttacker) | ||
{ | ||
m_ObjectID = pObject->GetID(); | ||
m_Attacker = (pAttacker) ? pAttacker->GetID() : INVALID_ELEMENT_ID; | ||
m_fLoss = fLoss; | ||
} | ||
|
||
bool CObjectDamagePacket::Read(NetBitStreamInterface& BitStream) | ||
{ | ||
if (BitStream.Read(m_ObjectID) && BitStream.Read(m_fLoss) && BitStream.Read(m_Attacker)) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
bool CObjectDamagePacket::Write(NetBitStreamInterface& BitStream) const | ||
{ | ||
BitStream.Write(m_ObjectID); | ||
BitStream.Write(m_fLoss); | ||
BitStream.Write(m_Attacker); | ||
|
||
return true; | ||
} |
33 changes: 33 additions & 0 deletions
33
Server/mods/deathmatch/logic/packets/CObjectDamagePacket.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/***************************************************************************** | ||
* | ||
* PROJECT: Multi Theft Auto v1.0 | ||
* LICENSE: See LICENSE in the top level directory | ||
* FILE: mods/deathmatch/logic/packets/CObjectDamagePacket.h | ||
* PURPOSE: Object damage state class | ||
* | ||
* Multi Theft Auto is available from http://www.multitheftauto.com/ | ||
* | ||
*****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include "CPacket.h" | ||
|
||
class CObject; | ||
|
||
class CObjectDamagePacket final : public CPacket | ||
{ | ||
public: | ||
CObjectDamagePacket(); | ||
CObjectDamagePacket(CObject* pObject, float fLoss, CElement* pAttacker); | ||
|
||
ePacketID GetPacketID() const { return PACKET_ID_OBJECT_DAMAGE; }; | ||
unsigned long GetFlags() const { return PACKET_MEDIUM_PRIORITY | PACKET_RELIABLE; }; | ||
|
||
bool Read(NetBitStreamInterface& BitStream); | ||
bool Write(NetBitStreamInterface& BitStream) const; | ||
|
||
ElementID m_ObjectID; | ||
float m_fLoss; | ||
ElementID m_Attacker; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters