diff --git a/Changelog.txt b/Changelog.txt index 8071dce1b..74a91da8b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3419,4 +3419,5 @@ Additionally, the problem of zig-zag issue following in the South direction has https://github.com/Sphereserver/Source/commit/26039d2ef9a121d52b561ce02cdae6d1e4624ccc https://github.com/Sphereserver/Source/commit/f26b39b9b40fba76660c36d57baa8387d3613272 https://github.com/Sphereserver/Source/commit/722606c54f17e3c9d8e6095fffcaa3b528c4783a -- Fixed: Activated disabled DEFNAME variable for Skills (Issue: #1138) \ No newline at end of file +- Fixed: Activated disabled DEFNAME variable for Skills (Issue: #1138) +- Fixed: NPCs that is not walking in multis shown wrong region name after server reboot. \ No newline at end of file diff --git a/src/game/chars/CChar.h b/src/game/chars/CChar.h index b3c85975c..e585cf80e 100644 --- a/src/game/chars/CChar.h +++ b/src/game/chars/CChar.h @@ -456,7 +456,6 @@ public: void StatFlag_Mod(uint64 uiStatFlag, bool fMod) noexcept; private: CRegion * CheckValidMove( CPointMap & ptDest, dword * pdwBlockFlags, DIR_TYPE dir, height_t * ClimbHeight, bool fPathFinding = false ) const; void FixClimbHeight(); - bool MoveToRegion( CRegionWorld * pNewArea, bool fAllowReject); bool MoveToRoom( CRegion * pNewRoom, bool fAllowReject); bool IsVerticalSpace( const CPointMap& ptDest, bool fForceMount = false ) const; @@ -465,6 +464,7 @@ public: void StatFlag_Mod(uint64 uiStatFlag, bool fMod) noexcept; virtual const CObjBaseTemplate* GetTopLevelObj() const override; bool IsSwimming() const; + bool MoveToRegion(CRegionWorld* pNewArea, bool fAllowReject); bool MoveToRegionReTest( dword dwType ); bool MoveToChar(const CPointMap& pt, bool fStanding = true, bool fCheckLocation = true, bool fForceFix = false, bool fAllowReject = true); diff --git a/src/game/items/CItemMulti.cpp b/src/game/items/CItemMulti.cpp index e64a7a60e..6d6cace1d 100644 --- a/src/game/items/CItemMulti.cpp +++ b/src/game/items/CItemMulti.cpp @@ -239,6 +239,24 @@ bool CItemMulti::MultiRealizeRegion() m_pRegion->SetName(pszTemp); m_pRegion->_pMultiLink = this; + //We have to update the Characters if not moving around like Player Vendors. + //Otherwise, when you reboot server, the region.name of the characters returns as Region name instead of multis. + CWorldSearch Area(m_pRegion->m_pt, Multi_GetDistanceMax()); + Area.SetSearchSquare(true); + for (;;) + { + CChar* pChar = Area.GetChar(); + if (pChar == nullptr) //Invalid char? Ignore. + { + break; + } + if (pChar->m_pArea == m_pRegion) //If it's already in house region, ignore him/her. + { + continue; + } + pChar->MoveToRegion(m_pRegion, false); //Move the character to house region. + } + return m_pRegion->RealizeRegion(); }