Planetary system renaming bug

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Planetary system renaming bug

Post by Thargoid »

Just noticed a little omission when planetary systems are renamed using a name key in a suitable planetinfo.plist.

It works fine for the name as it appears to Javascript and to the in-flight messages and F5 screen, but to legacy script methods (%H and %I especially) and so the mission (F5-F5) screen you still get the original system name being used.

A cosmetic issue, but one that's been overlooked so far I think.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Planetary system renaming bug

Post by Eric Walch »

Thargoid wrote:
A cosmetic issue, but one that's been overlooked so far I think.
It just does what the wiki says: planet.info

But yes. I just added a warning in the wiki that renaming is not a good option.

---
And this inconsistency after renaming makes things quite realistic. A lot of African countries have been renamed themselves since I left school. I still use the old names for a lot of them.

Also news bulletins use sometimes the new, sometimes the old names.

I remember having two guests at home from former Breslau (Polen) at home in the early eighties. This town was renamed into Wrocłav after WWII. The girls (Teachers) claimed to never have heard from the old name Breslau, while Dutch TV at that time mainly used the old, pre WWII name. But maybe Dutch TV only used the old name because they did not know how to pronounce the new name (something like Wrotzwaf, when I remember right).

So when renaming towns and countries in one generation is difficult, renaming worlds will certainly be.
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

Re: Planetary system renaming bug

Post by Lestradae »

Eric Walch wrote:
... I just added a warning in the wiki that renaming is not a good option.

And this inconsistency after renaming makes things quite realistic. A lot of African countries have been renamed themselves since I left school. I still use the old names for a lot of them.

Also news bulletins use sometimes the new, sometimes the old names.

So when renaming towns and countries in one generation is difficult, renaming worlds will certainly be.
Why not, instead of adding a warning about this ... unintended feature ... onto the wiki, just change this behaviour to a more wanted and consistent one?

Wondering sometimes :wink:

L
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Planetary system renaming bug

Post by Eric Walch »

Lestradae wrote:
Why not, instead of adding a warning about this ... unintended feature ... onto the wiki, just change this behaviour to a more wanted and consistent one?
This inconsistency with renaming the system has been in Oolite forever. I don't know if it really was thought through that renaming should be possible. Names are listed everywhere in documentation and a lot of old style scripting has planet names hard-coded in the oxp. e.g. Random Hits or Galactic Navy sends you to a lot of fixed planet names. This would fail when the name changed.

With JS this is less of a problem. Since the last UPS release I also added a few fixed destinations, but I only stored the planet number in my code and ask Oolite for the system name when I need it.

It seemed very sensible to warn others on the wiki that changing names could cause several inconsistencies. Not only between oxp's but even within Oolite itself. And fixing this problem is probably time consuming as it will need fixing on many places in the code.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Kaks corrected an update error, when you changed the name or system properties... they where not updated until the f5 short range map was entered... for the trunk version at least

Could this might be related and might already be fixed ?..

Cheers Frame...
Bounty Scanner
Number 935
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

I don't think so, although I will of course double-check. The new name was showing up fine in-flight on messages from JS scripting, and on the docked main (F5) screen the system name at the top was the new one.

But when you go into the mission summary screen (F5-F5) the short info mesages for OXPs like Random Hits (which I think is using the %I and/or %N substitutions) was still using the old name.

So for me it's a difference between the data accessible by JS and legacy, and that for me classes it as a bug, albeit a rather cosmetic one.

And I'm not really talking about gameplay inconsistencies (ie being told by an OXP to go to a system that no longer exists as it's name is changed), but that using different scripting functions/methods I'm getting different results that should be the same.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

A man's work is never done... ;)

I'll have a look when my new 'improved' work schedule allows, hopefully by Friday evening at the latest!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
A man's work is never done... ;)
Main problem is that not every function that displays names looks if there is an override for the name. A lot of the places that need the system name just generate the name from the seedvalue, like the one in "OOStringParsing.m" that is used to expand strings:

Code: Select all

NSString *ExpandDescriptionsWithLocalsForSystemSeed(NSString *text, Random_Seed seed, NSDictionary *locals)
{

   // ....deletions

	[partial	replaceOccurrencesOfString:@"%H"
				withString:[UNIVERSE generateSystemName:seed]
				options:NSLiteralSearch range:NSMakeRange(0, [partial length])];
	
	[partial	replaceOccurrencesOfString:@"%I"
				withString:[NSString stringWithFormat:@"%@ian",[UNIVERSE generateSystemName:seed]]
								   options:NSLiteralSearch range:NSMakeRange(0, [partial length])];
	
Only the function: (NSDictionary *) generateSystemData:(Random_Seed) s_seed in universe.m is checking for the presence of any of the three possible override keys.

Code: Select all

	NSString *name = [self generateSystemName:s_seed];
	NSString *inhabitants = [self generateSystemInhabitants:s_seed plural:YES];
	NSString *description = DescriptionForSystem(s_seed);
	
	NSString *override_key = [self keyForPlanetOverridesForSystemSeed:s_seed inGalaxySeed:galaxy_seed];
	
	// check at this point
	// for scripted overrides for this planet
	NSDictionary *overrides = nil;
	
	overrides = [planetInfo dictionaryForKey:PLANETINFO_UNIVERSAL_KEY];
	if (overrides != nil)  [systemdata addEntriesFromDictionary:overrides];
	overrides = [planetInfo dictionaryForKey:override_key];
	if (overrides != nil)  [systemdata addEntriesFromDictionary:overrides];
	overrides = [localPlanetInfoOverrides dictionaryForKey:override_key];
	if (overrides != nil)  [systemdata addEntriesFromDictionary:overrides];

	cachedResult = [systemdata copy];
	[systemdata release];
	
	return cachedResult;
When Ahruman added all kind of system properties in JS, like government, population and so on he didn't add name as property for the JS programming system. He probably had good reasons for leaving this out as there are lurking all kinds of problems for doing this right.
e.g. on the long range screen you see the new name on the lower left of the screen when you click on the planet, but the search for the new name will find nothing. Searching for the old name will find it and put the old name on screen.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Eric Walch wrote:
e.g. on the long range screen you see the new name on the lower left of the screen when you click on the planet, but the search for the new name will find nothing. Searching for the old name will find it and put the old name on screen.
On my system searching for the new name finds the planet? The only screen where I see the old name is the mission summary screen (F5-F5).
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Thargoid wrote:
On my system searching for the new name finds the planet?
I noticed three override situations in the code. I only tested it with changing the name with JS with the System.info.name="myCustomName". Maybe there is even difference by overriding with the planetInfo.plist?
The only screen where I see the old name is the mission summary screen (F5-F5).
You mean the Ship's Manifest screen? I never had any systemname on that screen at all. (Only in the contract and mission messages)
Last edited by Eric Walch on Tue May 12, 2009 9:24 pm, edited 1 time in total.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Ran a quick test

When the planet was renamed from via the planetinfo.plist file... it all works as intended. (don't know about %i and %h)

If the name is changed on the fly by a JS script, or via the debug console, then it does not work... and since planetinfo.plist is "executed" at or after or before each hyperspace jump. then a name set in the planetinfo.plist file will rename the system at each hyperspace jump, thus overriding any name set via a java script.

also i would like to clarify that this is not a bug.. but intended behaviour since
Oolite Wiki wrote:

Code: Select all

Name

The name of the planet.

Example:

Code: Select all

<key>name</key> 
<string>The planet's name</string>
Warning: This name is only used at the "Short Range Chart" (F6) and the "Data Screen" (F7). On the "Long Range Screen" you still will see the old name. And also %I and %H will refer to the original name. e.g the docking computer and all kind of other stuff uses these codes with original names..
The reasons for this could be that it simply affects to much...
Bounty Scanner
Number 935
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

I think that wiki comment is very recent, presumably the one Eric said he was going to add since I've flagged this up. And the new text is wrong, you see the change on the long range and main info screens too.

And I'm talking about a planetinfo.plist change not a js one for the name. As I said everything's working except the mission summary screen.

Set a system name with planetinfo and then go to its main station with Random Hits installed. See the name you get on the main info screen when docked (F5) - that should be the new one. Now go to the mission summary screen (F5 again) and see which system's bounty hunter's guild is giving you its rating (scripted via the %N method iirc).

User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Thargoid wrote:
I think that wiki comment is very recent, presumably the one Eric said he was going to add since I've flagged this up.
Actually I added that comment already a few months ago as I assumed that fixing would never happen.

%H is also used when using the docking computer. The station broadcasts than its old name. Same as vipers that are fining you.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Fair enuff :)

But the long-range screen comment isn't right, it's only usages of %I, %H and %N that get it wrong. I don't normally use the docking computer that way (I normally just skip the flight bit) so haven't seen that example of the problem.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Thargoid wrote:
I think that wiki comment is very recent, presumably the one Eric said he was going to add since I've flagged this up. And the new text is wrong, you see the change on the long range and main info screens too.

And I'm talking about a planetinfo.plist change not a js one for the name. As I said everything's working except the mission summary screen.

Set a system name with planetinfo and then go to its main station with Random Hits installed. See the name you get on the main info screen when docked (F5) - that should be the new one. Now go to the mission summary screen (F5 again) and see which system's bounty hunter's guild is giving you its rating (scripted via the %N method iirc).

Oh..

I can confirm that on the long range chart, when set in planetinfo.plist the name is changed there too, and works with the find function..

But not when you are changing the name via a Java script or debug console..

The behaviour should really be the same.

Cheers Frame..
Bounty Scanner
Number 935
Post Reply