From 82f3ff9fb6a92bfadb5143deeb9ef0cc80c11c11 Mon Sep 17 00:00:00 2001 From: Aleos Date: Mon, 15 Jun 2020 16:53:42 -0400 Subject: [PATCH] Fixes IM_CHAR instances to persist relog (#5088) * Fixes #3132. * Fixes IM_CHAR instances not persisting relogs. Thanks to @ghTravis! --- src/map/pc.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 41a4eacf3e..0bc2285d61 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -1908,6 +1908,14 @@ void pc_reg_received(struct map_session_data *sd) } channel_autojoin(sd); + + // Restore IM_CHAR instance to the player + for (const auto &instance : instances) { + if (instance.second->mode == IM_CHAR && instance.second->owner_id == sd->status.char_id) { + sd->instance_id = instance.first; + break; + } + } } static int pc_calc_skillpoint(struct map_session_data* sd)