Interesting dockings

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

Moderators: winston, another_commander, Getafix

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

Interesting dockings

Post by Eric Walch »

I just investigated a very interesting bug. On docking I was suddenly in the middle of the station seeing the sky. The docking was not noted correctly. The only key that worked was the launch key.

This bug must be there at least since Oolite 1.72 as Screet already reported it than playing cataclism.oxp. In that time I had it also one time. Yesterday I had it constantly. After successively removing all oxps I ended up with one very simple one:

Code: Select all

this.shipWillDockWithStation = function()
{
    if(player.ship.docked) log(this.name, "Player is docked")
}
This were the only lines used in the oxp. No other oxp's loaded. I launched as a Jameson and redocked:

Code: Select all

[dataCache.rebuild.pathsChanged] ResourceManager.m:413: Cache is stale (search paths have changed). Rebuilding from scratch.
[shipData.load.begin] OOShipRegistry.m:278: Loading ship data...
[script.load.world.listAll] ResourceManager.m:893: Loaded 7 world scripts: "erics_JStest" 1.00, "oolite-cloaking-device" 1.74, "oolite-constrictor-hunt" 1.74, "oolite-nova" 1.74, "oolite-thargoid-plans" 1.74, "oolite-trumbles" 1.74, "ups_test" 1.00
[debugOXP.load.success] OODebugController.m:91: Debug OXP loaded successfully.
[cache.profile] OOCacheManager.m:469: Time to prepare cache data: 0.000388658 seconds.
[cache.profile] OOCacheManager.m:594: Time to serialize cache: 0.0209964 seconds. Time to write data: 0.0429662 seconds.
[general.error.inconsistentState] PlayerEntity.m:7186: ***** ERROR: status is STATUS_DOCKING, but dockedStation is nil; treating as not docked. This is an internal error, please report it.
[general.error.inconsistentState] PlayerEntity.m:7195: ***** ERROR: status is STATUS_IN_FLIGHT, not STATUS_DOCKED, but dockedStation is not nil; treating as docked. This is an internal error, please report it.
 
Test was with 1.74, but yesterday I had the identical problem with 1.73 and there were similar reports for 1.72 in the past.
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 »

The same but now with

Code: Select all

this.shipWillDockWithStation = function()
{
    if(player.ship.docked) log(this.name, "Player is docked")
    else log(this.name, "Player is not docked")
}
Log:

Code: Select all

[general.error.inconsistentState] PlayerEntity.m:7190: ***** ERROR: status is STATUS_DOCKING, but dockedStation is nil; treating as not docked. This is an internal error, please report it.
[erics_JStest] OOJSGlobal.m:197: Player is not docked
[general.error.inconsistentState] PlayerEntity.m:7199: ***** ERROR: status is STATUS_IN_FLIGHT, not STATUS_DOCKED, but dockedStation is not nil; treating as docked. This is an internal error, please report it.


Strange as according to the code then the handler triggers:

Code: Select all

- (void) enterDock:(StationEntity *)station
{
	if ([self status] == STATUS_DEAD)
		return;
	
	[self setStatus:STATUS_DOCKING];
	[self doScriptEvent:@"shipWillDockWithStation" withArgument:station];
So status is STATUS_DOCKING , and when I look in the player.ship.docked definition:

Code: Select all

- (BOOL) isDocked
{
	BOOL isDockedStatus = NO;
	
	switch ([self status])
	{
		case STATUS_DOCKED:
		case STATUS_DOCKING:
        case STATUS_START_GAME:
            isDockedStatus = YES;
            break;   
		case STATUS_EFFECT:
it stated that STATUS_DOCKING also should result in a true value. Still the log is for a false value. I'm confused.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6633
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

The problem is that dockedStation is set in -enterDock after the event shipWillDockWithStation has been executed. A possible fix could be to put the line

Code: Select all

dockedStation = station;
before setting STATUS_DOCKING, but I have not tested this and I am not sure if it breaks anything, but it could be an idea to get us started.
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 »

another_commander wrote:
The problem is that dockedStation is set in -enterDock after the event shipWillDockWithStation has been executed. A possible fix could be to put the line

Code: Select all

dockedStation = station;
before setting STATUS_DOCKING, but I have not tested this and I am not sure if it breaks anything, but it could be an idea to get us started.
Just found that line also and also moved it to a point before calling the handler. At least the sanity check is not disturbing things now and I can dock. At first sight I see no problem with moving this forward.
Post Reply