diff options
Diffstat (limited to 'common/msgstruct.py')
-rw-r--r-- | common/msgstruct.py | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/common/msgstruct.py b/common/msgstruct.py index 26389f0..93b6bea 100644 --- a/common/msgstruct.py +++ b/common/msgstruct.py @@ -12,37 +12,37 @@ except ImportError: MSG_WELCOME = "Welcome to gamesrv.py(3) !\n" -MSG_BROADCAST_PORT= "*" -MSG_DEF_PLAYFIELD = "p" -MSG_DEF_KEY = "k" -MSG_DEF_ICON = "r" -MSG_DEF_BITMAP = "m" -MSG_DEF_SAMPLE = "w" -MSG_DEF_MUSIC = "z" -MSG_PLAY_MUSIC = "Z" -MSG_FADEOUT = "f" -MSG_PLAYER_JOIN = "+" -MSG_PLAYER_KILL = "-" -MSG_PLAYER_ICON = "i" -MSG_PING = "g" -MSG_PONG = "G" -MSG_INLINE_FRAME = "\\" +MSG_BROADCAST_PORT= b"*" +MSG_DEF_PLAYFIELD = b"p" +MSG_DEF_KEY = b"k" +MSG_DEF_ICON = b"r" +MSG_DEF_BITMAP = b"m" +MSG_DEF_SAMPLE = b"w" +MSG_DEF_MUSIC = b"z" +MSG_PLAY_MUSIC = b"Z" +MSG_FADEOUT = b"f" +MSG_PLAYER_JOIN = b"+" +MSG_PLAYER_KILL = b"-" +MSG_PLAYER_ICON = b"i" +MSG_PING = b"g" +MSG_PONG = b"G" +MSG_INLINE_FRAME = b"\\" MSG_PATCH_FILE = MSG_DEF_MUSIC -MSG_ZPATCH_FILE = "P" -MSG_MD5_FILE = "M" -MSG_RECORDED = "\x00" +MSG_ZPATCH_FILE = b"P" +MSG_MD5_FILE = b"M" +MSG_RECORDED = b"\x00" -CMSG_PROTO_VERSION= "v" -CMSG_KEY = "k" -CMSG_ADD_PLAYER = "+" -CMSG_REMOVE_PLAYER= "-" -CMSG_UDP_PORT = "<" -CMSG_ENABLE_SOUND = "s" -CMSG_ENABLE_MUSIC = "m" -CMSG_PING = "g" -CMSG_PONG = "G" -CMSG_DATA_REQUEST = "M" -CMSG_PLAYER_NAME = "n" +CMSG_PROTO_VERSION= b"v" +CMSG_KEY = b"k" +CMSG_ADD_PLAYER = b"+" +CMSG_REMOVE_PLAYER= b"-" +CMSG_UDP_PORT = b"<" +CMSG_ENABLE_SOUND = b"s" +CMSG_ENABLE_MUSIC = b"m" +CMSG_PING = b"g" +CMSG_PONG = b"G" +CMSG_DATA_REQUEST = b"M" +CMSG_PLAYER_NAME = b"n" BROADCAST_MESSAGE = "game!" # less than 6 bytes @@ -60,7 +60,7 @@ def message(tp, *values): typecodes = ''.join(typecodes) assert len(typecodes) < 256 return pack(("!B%dsc" % len(typecodes)) + typecodes, - len(typecodes), typecodes, tp, *values) + len(typecodes), typecodes.encode(), tp, *values) def decodemessage(data): if data: |