Instanced Map support

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Message
Author
pl4y8oy
Human
Human
Posts: 48
Joined: 21 Dec 2012, 07:48
Noob?: Yes

Instanced Map support

#1 Post by pl4y8oy »

Hi Guys,

I understand Openkore already support instanced map. but is seem only support instanced name with additional 3digits name (ie: 0011@cata), while this kind of instance name is not supported: 0qs1@mist , 0oa1@mist , 0o71@mist

Please correct me if I'm wrong.

I check the source code, seem this part of the code need to be update :
(Field.pm)

Code: Select all

# Map a field name to its field file's base name.
sub nameToBaseName {
	my ($self, $name) = @_;
	
	my ($instanceID);

	if ($name =~ /^(\d{3})(\d@.*)/) { # instanced maps, ex: 0021@cata
		$instanceID = $1;
		$name = $2;
	}

	return ($name, $instanceID);
}
Please let me know if my understanding is correct
I'm planning to change

Code: Select all

if ($name =~ /^(\d{3})(\d@.*)/)
to

Code: Select all

if ($name =~ /^(\d..)(\d@.*)/)
PS: I have developer experience, but not perl :)

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: Instanced Map support

#2 Post by kLabMouse »

pl4y8oy wrote:Hi Guys,

I understand Openkore already support instanced map. but is seem only support instanced name with additional 3digits name (ie: 0011@cata), while this kind of instance name is not supported: 0qs1@mist , 0oa1@mist , 0o71@mist

PS: I have developer experience, but not perl :)
Why not allow any 4 letters including Numbers?

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: Instanced Map support

#3 Post by Technology »

kLabMouse wrote:
pl4y8oy wrote:Hi Guys,

I understand Openkore already support instanced map. but is seem only support instanced name with additional 3digits name (ie: 0011@cata), while this kind of instance name is not supported: 0qs1@mist , 0oa1@mist , 0o71@mist

PS: I have developer experience, but not perl :)
Why not allow any 4 letters including Numbers?
Hmm didn't know that there could be letters in it at the time of writing, could probably use the word character class shorthand for this \w (short for [A-Za-z0-9_]).
Although I'm not 100% sure that would be strict enough (thats why it was done with \d before, since only such ID's seemed to occur back then).
However I believe the @ warrants the map being an instance.
Anyhow, if our model doesn't fit reality then our model needs to change, and for sanity a few unit test could be added.

Code: Select all

$name =~ /^(\w{3})(\d@.*)/
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

Post Reply