Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jochen Bauer
spn-relayserver
Commits
882d4870
Commit
882d4870
authored
Apr 12, 2018
by
Hubert Denkmair
Browse files
add missing convert() functions
parent
85a67069
Changes
1
Hide whitespace changes
Inline
Side-by-side
relayserver/MsgPackProtocol.h
View file @
882d4870
#pragma once
#include <cstdint>
#include <vector>
#include <msgpack.hpp>
...
...
@@ -166,6 +165,17 @@ namespace msgpack {
}
};
template
<
>
struct
convert
<
MsgPackProtocol
::
PlayerInfoMessage
>
{
msgpack
::
object
const
&
operator
()(
msgpack
::
object
const
&
o
,
MsgPackProtocol
::
PlayerInfoMessage
&
v
)
const
{
if
(
o
.
type
!=
msgpack
::
type
::
ARRAY
)
throw
msgpack
::
type_error
();
if
(
o
.
via
.
array
.
size
!=
3
)
throw
msgpack
::
type_error
();
o
.
via
.
array
.
ptr
[
2
]
>>
v
.
player_id
;
return
o
;
}
};
template
<
>
struct
pack
<
MsgPackProtocol
::
TickMessage
>
{
template
<
typename
Stream
>
msgpack
::
packer
<
Stream
>&
operator
()(
msgpack
::
packer
<
Stream
>&
o
,
MsgPackProtocol
::
TickMessage
const
&
v
)
const
...
...
@@ -178,6 +188,17 @@ namespace msgpack {
}
};
template
<
>
struct
convert
<
MsgPackProtocol
::
TickMessage
>
{
msgpack
::
object
const
&
operator
()(
msgpack
::
object
const
&
o
,
MsgPackProtocol
::
TickMessage
&
v
)
const
{
if
(
o
.
type
!=
msgpack
::
type
::
ARRAY
)
throw
msgpack
::
type_error
();
if
(
o
.
via
.
array
.
size
!=
3
)
throw
msgpack
::
type_error
();
o
.
via
.
array
.
ptr
[
2
]
>>
v
.
frame_id
;
return
o
;
}
};
template
<
>
struct
pack
<
MsgPackProtocol
::
WorldUpdateMessage
>
{
template
<
typename
Stream
>
msgpack
::
packer
<
Stream
>&
operator
()(
msgpack
::
packer
<
Stream
>&
o
,
MsgPackProtocol
::
WorldUpdateMessage
const
&
v
)
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment