Skip to content

Commit

Permalink
- Fixed: NPCs that is not walking in multis shown wrong region name a…
Browse files Browse the repository at this point in the history
…fter server reboot.
  • Loading branch information
xwerswoodx committed Oct 23, 2023
1 parent 5dc012e commit a03c39c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
- Fixed: Activated disabled DEFNAME variable for Skills (Issue: #1138)
- Fixed: NPCs that is not walking in multis shown wrong region name after server reboot.
2 changes: 1 addition & 1 deletion src/game/chars/CChar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
18 changes: 18 additions & 0 deletions src/game/items/CItemMulti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit a03c39c

Please sign in to comment.