Since maps may be aliased not only in case they're identical to each other, but just because they use the same "base" (pvp_y_1-1.gat#prontera.gat#), there's many possible bugs there.
saveMap;
lockMap;
allowedMaps;
can't move to any map with name different from baseName, would move to baseName instead;
NPC name cache;
portals (at least in Wx);
party member positions (at least in Wx);
displayed field names (at least in Wx - map, NPC Talk);
etc
Approach like "threat all copies as they would have been the single location" may work with instances (or maybe not), but it isn't suitable for aliased maps at all.
r7399 | bot not creating instance for maps.txt
Moderators: Moderators, Developers
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: r7399 | bot not creating instance for maps.txt
Field-related macro test fails.
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: r7399 | bot not creating instance for maps.txt
Undefined $field causes "random" errors since many things expect it to be defined.
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: r7399 | bot not creating instance for maps.txt
How about we redefine Field->baseName to mean "true field's name, just without instance ID"? Probably nothing (except some user interface) should ever care about which name is being aliased to which.
Tested: portals, NPCs, lockMap.
Tested: portals, NPCs, lockMap.
Code: Select all
Index: src/Field.pm
===================================================================
--- src/Field.pm (revision 8047)
+++ src/Field.pm (working copy)
@@ -380,8 +380,10 @@
# and/or the distance map file.
sub loadByName {
my ($self, $name, $loadDistanceMap) = @_;
- ($self->{baseName}, $self->{instanceID}) = $self->nameToBaseName($name);
- my $file = $self->{baseName} . ".fld";
+ my $baseName;
+ ($baseName, $self->{instanceID}) = $self->nameToBaseName($name);
+ $self->{baseName} = $baseName;
+ my $file = $self->sourceName . ".fld";
if ($Settings::fields_folder) {
$file = File::Spec->catfile($Settings::fields_folder, $file);
@@ -392,6 +394,7 @@
if (-f $file) {
$self->loadFile($file, $loadDistanceMap);
+ $self->{baseName} = $baseName;
$self->{name} = $name;
} else {
FileNotFoundException->throw("No corresponding field file found for field '$name'.");
@@ -402,13 +405,21 @@
sub nameToBaseName {
my ($self, $name) = @_;
- my ($baseName, $instanceID);
+ my ($instanceID);
if ($name =~ /^(\d{3})(\d@.*)/) { # instanced maps, ex: 0021@cata
$instanceID = $1;
$name = $2;
}
+ return ($name, $instanceID);
+}
+
+sub sourceName {
+ my ($self) = @_;
+ my $name = $self->baseName;
+ my $baseName;
+
if ($baseName = $masterServer->{"field_$name"}) {
# Handle server-specific versions of the field from servers.txt
} elsif ($baseName = $mapAlias_lut{"$name"}) {
@@ -421,9 +432,7 @@
$baseName = $name;
}
- return ($baseName, $instanceID);
-
- # tl;dr $name =~ s/^\d{3}(?=\d@)//; return $masterServer->{"field_$name"} || $mapAlias_lut{$name} || $name;
+ return $baseName;
}
1;
Index: src/Interface/Wx/MapViewer.pm
===================================================================
--- src/Interface/Wx/MapViewer.pm (revision 8047)
+++ src/Interface/Wx/MapViewer.pm (working copy)
@@ -463,7 +463,7 @@
sub _loadMapImage {
my $self = shift;
my $field = shift;
- my $name = $field->baseName;
+ my $name = $field->sourceName;
if (-f $self->_map("$name.jpg")) {
return _loadImage($self->_map("$name.jpg"), $self->{zoom});
Re: r7399 | bot not creating instance for maps.txt
Hmm. I think it's OK. "baseName" should just that. or Not?
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: r7399 | bot not creating instance for maps.txt
In r8069 for testing.
Re: r7399 | bot not creating instance for maps.txt
Hi,
Sorry to bringup old subject, but is openkore still support instanced map ?
I tried on 1@mist, and it doesnt work. I need to do manual things:
1. copy the 1@mist.fld to the instanced name (e.g. 0o71@mist.fld)
2. add it in maps.txt
3. change the map name in portals.txt
and it works, but each time I re-enter the new instanced map, I need to do all again.
Thx in advance.
PS. I'm botting in iRO.
Sorry to bringup old subject, but is openkore still support instanced map ?
I tried on 1@mist, and it doesnt work. I need to do manual things:
1. copy the 1@mist.fld to the instanced name (e.g. 0o71@mist.fld)
2. add it in maps.txt
3. change the map name in portals.txt
and it works, but each time I re-enter the new instanced map, I need to do all again.
Thx in advance.
PS. I'm botting in iRO.
Re: r7399 | bot not creating instance for maps.txt
Code: Select all
sub nameToBaseName {
my ($self, $name) = @_;
my ($instanceID);
if ($name =~ /^(\w{3})(\d@.*)/) { # instanced maps, ex: 0021@cata
$instanceID = $1;
$name = $2;
}
return ($name, $instanceID);
}
*sorry for my english is bad
Sorry, my english is very bad !