mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
dGame Precompiled header improvements (#876)
* moving branch * Add deleteinven slash command * Change name of BRICKS_IN_BBB * Use string_view instead of strcmp * Clean up include tree * Remove unneeded headers from PCH files Removes unneeded headers from pre-compiled headers. This increases compile time, however reduces development time for most files. * Update Entity.h * Update EntityManager.h * Update GameMessages.cpp * There it compiles now Co-authored-by: Aaron Kimbrell <aronwk.aaron@gmail.com>
This commit is contained in:
68
dGame/dGameMessages/SyncSkill.h
Normal file
68
dGame/dGameMessages/SyncSkill.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#ifndef __SYNCSKILL__H__
|
||||
#define __SYNCSKILL__H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include "BitStream.h"
|
||||
|
||||
/* Message to synchronize a skill cast */
|
||||
class SyncSkill {
|
||||
static const GAME_MSG MsgID = GAME_MSG_SYNC_SKILL;
|
||||
|
||||
public:
|
||||
SyncSkill() {
|
||||
bDone = false;
|
||||
}
|
||||
|
||||
SyncSkill(std::string _sBitStream, uint32_t _uiBehaviorHandle, uint32_t _uiSkillHandle, bool _bDone = false) {
|
||||
bDone = _bDone;
|
||||
sBitStream = _sBitStream;
|
||||
uiBehaviorHandle = _uiBehaviorHandle;
|
||||
uiSkillHandle = _uiSkillHandle;
|
||||
}
|
||||
|
||||
SyncSkill(RakNet::BitStream* stream) : SyncSkill() {
|
||||
Deserialize(stream);
|
||||
}
|
||||
|
||||
~SyncSkill() {
|
||||
}
|
||||
|
||||
void Serialize(RakNet::BitStream* stream) {
|
||||
stream->Write(MsgID);
|
||||
|
||||
stream->Write(bDone);
|
||||
uint32_t sBitStreamLength = sBitStream.length();
|
||||
stream->Write(sBitStreamLength);
|
||||
for (unsigned int k = 0; k < sBitStreamLength; k++) {
|
||||
stream->Write(sBitStream[k]);
|
||||
}
|
||||
|
||||
stream->Write(uiBehaviorHandle);
|
||||
stream->Write(uiSkillHandle);
|
||||
}
|
||||
|
||||
bool Deserialize(RakNet::BitStream* stream) {
|
||||
stream->Read(bDone);
|
||||
uint32_t sBitStreamLength{};
|
||||
stream->Read(sBitStreamLength);
|
||||
for (uint32_t k = 0; k < sBitStreamLength; k++) {
|
||||
unsigned char character;
|
||||
stream->Read(character);
|
||||
sBitStream.push_back(character);
|
||||
}
|
||||
|
||||
stream->Read(uiBehaviorHandle);
|
||||
stream->Read(uiSkillHandle);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bDone{};
|
||||
std::string sBitStream{};
|
||||
uint32_t uiBehaviorHandle{};
|
||||
uint32_t uiSkillHandle{};
|
||||
};
|
||||
|
||||
#endif //!__SYNCSKILL__H__
|
Reference in New Issue
Block a user