From 42bdb8ada356178f8eea17c438416c0c6e8c33a5 Mon Sep 17 00:00:00 2001 From: Noahrav <96999986+noahrav@users.noreply.github.com> Date: Wed, 30 Oct 2024 04:42:16 +0100 Subject: [PATCH 1/2] fix: syntax error (#37) Co-authored-by: Noahrav --- src/multiplayer/packet.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/multiplayer/packet.h b/src/multiplayer/packet.h index ac06637b4..1c69ace71 100644 --- a/src/multiplayer/packet.h +++ b/src/multiplayer/packet.h @@ -65,7 +65,7 @@ class S2CPacket : public Packet { static T Decode(std::string_view s); template<> - int Decode(std::string_view s) { + 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()) @@ -74,7 +74,7 @@ class S2CPacket : public Packet { } template<> - bool Decode(std::string_view s) { + bool Decode(std::string_view s) { if (s == "1") return true; //if (s == "0") From 65922703a900f55d860bf60448143784c3981d6f Mon Sep 17 00:00:00 2001 From: Viet Dinh <36768030+Desdaemon@users.noreply.github.com> Date: Tue, 29 Oct 2024 23:46:24 -0400 Subject: [PATCH 2/2] Assign battleanims to correct DrawableList (#50) Prevents lifetime issues with multipler battleanims --- src/battle_animation.cpp | 2 +- src/multiplayer/game_multiplayer.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/battle_animation.cpp b/src/battle_animation.cpp index 00cf44beb..4bbf56995 100644 --- a/src/battle_animation.cpp +++ b/src/battle_animation.cpp @@ -36,7 +36,7 @@ #include "spriteset_map.h" BattleAnimation::BattleAnimation(const lcf::rpg::Animation& anim, bool only_sound, int cutoff, bool synced, bool multiplayer) : - Sprite(multiplayer ? Drawable::Flags::Shared : Drawable::Flags::Default), animation(anim), only_sound(only_sound), synced(synced), multiplayer(multiplayer) + animation(anim), only_sound(only_sound), synced(synced), multiplayer(multiplayer) { num_frames = GetRealFrames() * 2; if (cutoff >= 0 && cutoff < num_frames) { diff --git a/src/multiplayer/game_multiplayer.cpp b/src/multiplayer/game_multiplayer.cpp index 2e163caad..a9cc636e5 100644 --- a/src/multiplayer/game_multiplayer.cpp +++ b/src/multiplayer/game_multiplayer.cpp @@ -416,7 +416,12 @@ void Game_Multiplayer::InitConnection() { if (players.find(p.id) == players.end()) return; const lcf::rpg::Animation* anim = lcf::ReaderUtil::GetElement(lcf::Data::animations, p.anim_id); if (anim) { + auto scene_map = Scene::Find(Scene::SceneType::Map); + if (!scene_map) return; + auto old_list = &DrawableMgr::GetLocalList(); + DrawableMgr::SetLocalList(&scene_map->GetDrawableList()); players[p.id].battle_animation.reset(new BattleAnimationMap(*anim, *players[p.id].ch, false, true, true)); + DrawableMgr::SetLocalList(old_list); } else { players[p.id].battle_animation.reset(); }