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 Oct 27, 2024
1 parent bc188b9 commit 0a48b13
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 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
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 0a48b13

Please sign in to comment.