Fixed potential crash bug with prematurely removing objects from sectors.
Deprecated BaseMulti.RefreshComponents. Dynamically changing BaseMulti.ItemID will now perform any needed sector updates.
This commit is contained in:
parent
ab2a22c178
commit
3d09d84101
2 changed files with 175 additions and 201 deletions
|
|
@ -34,17 +34,37 @@ namespace Server.Items
|
|||
{
|
||||
}
|
||||
|
||||
public override int ItemID {
|
||||
get {
|
||||
return base.ItemID;
|
||||
}
|
||||
set {
|
||||
if ( base.ItemID != value ) {
|
||||
Map facet = ( this.Parent == null ? this.Map : null );
|
||||
|
||||
if ( facet != null ) {
|
||||
facet.OnLeave( this );
|
||||
}
|
||||
|
||||
base.ItemID = value;
|
||||
|
||||
if ( facet != null ) {
|
||||
facet.OnEnter( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete( "Replace with calls to OnLeave and OnEnter surrounding component invalidation.", true )]
|
||||
public virtual void RefreshComponents()
|
||||
{
|
||||
if ( Parent != null )
|
||||
return;
|
||||
if ( this.Parent == null ) {
|
||||
Map facet = this.Map;
|
||||
|
||||
Map map = Map;
|
||||
|
||||
if ( map != null )
|
||||
{
|
||||
map.OnLeave( this );
|
||||
map.OnEnter( this );
|
||||
if ( facet != null ) {
|
||||
facet.OnLeave( this );
|
||||
facet.OnEnter( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue