Go Back   RunUO - Ultima Online Emulation > RunUO > Modification Suggestions

Modification Suggestions This is where you can suggest a modifcation to RunUO!

Reply
 
Thread Tools Display Modes
Old 06-26-2006, 12:31 PM   #1 (permalink)
Forum Expert
 
Join Date: Feb 2004
Age: 27
Posts: 1,834
Default Core: Item.cs OnMapChange

The mobile got a public virtual void OnMapChange( Map oldMap )
but the item doesn't remember the old map in OnMapChange().
So I'd like to have that changed to something working like in the Mobile.cs, if possible.
Kamuflaro is offline   Reply With Quote
Old 06-26-2006, 01:53 PM   #2 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Quote:
Originally Posted by Kamuflaro
The mobile got a public virtual void OnMapChange( Map oldMap )
but the item doesn't remember the old map in OnMapChange().
So I'd like to have that changed to something working like in the Mobile.cs, if possible.
The Item doesn't have a public Map property so it really doesn't matter, at least I don't remeber it having one.
Phantom is offline   Reply With Quote
Old 06-26-2006, 02:10 PM   #3 (permalink)
Forum Expert
 
Join Date: Feb 2004
Age: 27
Posts: 1,834
Default

In the Item class:
Code:
		[CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
		public Map Map
		{
			get
			{
				return m_Map;
			}
			set
			{
				if ( m_Map != value )
				{
					Map old = m_Map;

					if ( m_Map != null && m_Parent == null )
					{
						m_Map.OnLeave( this );
						SendRemovePacket();
					}

					List<Item> items = LookupItems();

					if ( items != null )
					{
						for ( int i = 0; i < items.Count; ++i )
							items[i].Map = value;
					}

					m_Map = value;

					if ( m_Map != null && m_Parent == null )
						m_Map.OnEnter( this );

					Delta( ItemDelta.Update );

					this.OnMapChange();

					if ( old == null || old == Map.Internal )
						InvalidateProperties();
				}
			}
		}
You see the OnMapChange is called, but when it is called it is too late to do anything on the map where it came from, because you don't know from which map it was removed.
Kamuflaro is offline   Reply With Quote
Old 06-26-2006, 05:58 PM   #4 (permalink)
Newbie
 
Join Date: Jun 2006
Posts: 94
Default

this.OnMapChange( old );

wouldn't work?
Kamron is offline   Reply With Quote
Old 06-26-2006, 06:41 PM   #5 (permalink)
Forum Expert
 
Join Date: Feb 2004
Age: 27
Posts: 1,834
Default

no... to get it working is the idea :P
Kamuflaro is offline   Reply With Quote
Old 07-03-2006, 05:25 PM   #6 (permalink)
Newbie
 
Join Date: Jun 2006
Posts: 94
Default

My point was to rewrite the OnMapChange function to say

public virtual void OnMapChange( Map oldmap )
{
blah blah
}

Then where it says
this.OnMapChange();
in the Map property, change it to
this.OnMapChange( old );

And you are done.
Kamron is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5