Skip to content

Commit

Permalink
Fix compile errors from merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Desdaemon committed Nov 1, 2024
1 parent bc188b9 commit 97b51ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/game_playerother.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -79,4 +79,4 @@ inline int Game_PlayerOther::GetOpacity() const {
return std::floor(opacity);
}

#endif
#endif
5 changes: 3 additions & 2 deletions src/multiplayer/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ namespace S2C {
static void BuildParams(Game_Pictures::Params& p, const PL& v) {
p.position_x = Decode<int>(v.at(2));
p.position_y = Decode<int>(v.at(3));
p.magnify = Decode<int>(v.at(8));
p.magnify_width = Decode<int>(v.at(8));
p.magnify_height = Decode<int>(v.at(8));
p.top_trans = Decode<int>(v.at(9));
p.bottom_trans = Decode<int>(v.at(10));
p.red = Decode<int>(v.at(11));
Expand Down Expand Up @@ -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);
}
Expand Down
30 changes: 16 additions & 14 deletions src/multiplayer/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,32 @@ class C2SPacket : public Packet {
std::string m_name;
};

class S2CPacket : public Packet {
public:
virtual ~S2CPacket() = default;

namespace S2CPacket__detail {
template<typename T>
static T Decode(std::string_view s);
T Decode(std::string_view s);

template<>
int Decode(std::string_view s) {
inline int Decode<int>(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<bool>(std::string_view s) {
return s == "1";
}
}

class S2CPacket : public Packet {
public:
virtual ~S2CPacket() = default;

template<typename T>
static T Decode(std::string_view s) {
return S2CPacket__detail::Decode<T>(s);
}

};

}
Expand Down

0 comments on commit 97b51ac

Please sign in to comment.