-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding network msg to network msg #4878
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,3 +191,19 @@ void NetworkMessage::addItem(const Item* item) | |
} | ||
|
||
void NetworkMessage::addItemId(uint16_t itemId) { add<uint16_t>(Item::items[itemId].clientId); } | ||
|
||
void NetworkMessage::addNetworkMessage(NetworkMessage* networkMsg) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probaly can be changed from: |
||
{ | ||
if (!networkMsg) { | ||
return; | ||
} | ||
|
||
if (!canAdd(networkMsg->getLength())) { | ||
return; | ||
} | ||
|
||
std::memcpy(buffer.data() + info.position, networkMsg->getBuffer() + INITIAL_BUFFER_POSITION, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wouldnt addBytes from networkmessage class suffice here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, i will check. |
||
networkMsg->getLength()); | ||
info.position += networkMsg->getLength(); | ||
info.length += networkMsg->getLength(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
networkMessage:compose(otherMsg)?