diff --git a/src/game_playerother.h b/src/game_playerother.h index 450f773d9..be431e1c9 100644 --- a/src/game_playerother.h +++ b/src/game_playerother.h @@ -29,8 +29,8 @@ class Game_PlayerOther : public Game_PlayerBase { int GetOpacity() const override; - Drawable::Z_t GetScreenZ(bool apply_shift = false) const override { - return Game_Character::GetScreenZ(apply_shift) | (0xFFFEu << 16u) + id; + Drawable::Z_t GetScreenZ(int x_offset, int y_offset) const override { + return Game_Character::GetScreenZ(x_offset, y_offset) | (0xFFFEu << 16u) + id; } void UpdateNextMovementAction() override { @@ -79,4 +79,4 @@ inline int Game_PlayerOther::GetOpacity() const { return std::floor(opacity); } -#endif \ No newline at end of file +#endif diff --git a/src/multiplayer/messages.h b/src/multiplayer/messages.h index ccf13515e..b0e6b3d8c 100644 --- a/src/multiplayer/messages.h +++ b/src/multiplayer/messages.h @@ -207,7 +207,8 @@ namespace S2C { static void BuildParams(Game_Pictures::Params& p, const PL& v) { p.position_x = Decode(v.at(2)); p.position_y = Decode(v.at(3)); - p.magnify = Decode(v.at(8)); + p.magnify_width = Decode(v.at(8)); + p.magnify_height = Decode(v.at(8)); p.top_trans = Decode(v.at(9)); p.bottom_trans = Decode(v.at(10)); p.red = Decode(v.at(11)); @@ -498,7 +499,7 @@ namespace C2S { void Append(std::string& s) const { AppendPartial(s, pic_id, p.position_x, p.position_y, map_x, map_y, pan_x, pan_y, - p.magnify, p.top_trans, p.bottom_trans, + p.magnify_width, p.top_trans, p.bottom_trans, p.red, p.green, p.blue, p.saturation, p.effect_mode, p.effect_power); } diff --git a/src/multiplayer/packet.h b/src/multiplayer/packet.h index ac06637b4..70b794ff7 100644 --- a/src/multiplayer/packet.h +++ b/src/multiplayer/packet.h @@ -57,30 +57,32 @@ class C2SPacket : public Packet { std::string m_name; }; -class S2CPacket : public Packet { -public: - virtual ~S2CPacket() = default; - +namespace S2CPacket__detail { template - static T Decode(std::string_view s); + T Decode(std::string_view s); template<> - int Decode(std::string_view s) { + inline int Decode(std::string_view s) { int r; auto e = std::from_chars(s.data(), s.data() + s.size(), r); - //if (e.ec != std::errc()) - // std::terminate(); return r; } template<> - bool Decode(std::string_view s) { - if (s == "1") - return true; - //if (s == "0") - return false; - //std::terminate(); + inline bool Decode(std::string_view s) { + return s == "1"; } +} + +class S2CPacket : public Packet { +public: + virtual ~S2CPacket() = default; + + template + static T Decode(std::string_view s) { + return S2CPacket__detail::Decode(s); + } + }; }