Trunk (1317), osx

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

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Trunk (1317), osx

Post by Cmdr James »

I am getting an NSRangeException at ResourceManager.m 574 during the startup of oolite (before the load dialog or anything, after the splash screen).

Code: Select all

					[self handleArrayMerging:results forLookupKey:3]; // Index 3 is the role string (EQ_*).

Code: Select all

[startup.exception]: ***** Unhandled exception during startup: NSRangeException (*** -[NSCFArray objectAtIndex:]: index (3) beyond bounds (2)).
This actually occurs at ResourceManager.m 612

Code: Select all

				if ([[[[arrayToProcess objectAtIndex:j] objectAtIndex:k] objectAtIndex:lookupKey] isEqual:
					[[refArray objectAtIndex:i] objectAtIndex:lookupKey]])
where arrayToProcess is an NSArray with 2 entries
j == 0
k ==0
lookupKey == 3

I think this may be related to parsing plists for oxps, but I have not found exactly where yet.

Maybe someone can point me in the right direction?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Does this happen without any OXPs present? This entire method was created to allow merging of array items, in the same way dictionary items are merged. The only use so far with the core game is equipment.plist, where this method will allow overriding default equipment with user defined equipment. The problem is that I did not take into account the possibility of other arrays (oxp ones maybe) being unintentionally merged (duh!). Obviously, if your array has two items and I am trying to lookup the third, it will crash. I'll have to come up with a more appropriate way to check against lookup index, I think. Thanks for reporting this.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

I have changed a bit the code to target equipment.plist only, which was the original intention. It's not very pretty, but it should do the job, at least for now. The way the equipment.plist is structured (an array of arrays) makes it pretty unique in its handling when it comes to merging external oxp equipment.plists. At least now, other arrays should be totally unaffected and not give crashes like the one reported. Any ideas to make the system better are more than welcome, of course.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

I was looking at checking the size of the arrays and merging more carefully, but it all just ended in a nasty infinite loop of some kind, which broke osx (had to hard power off :( )

Most of my work on improving oolite has been looking at factoring out duplicate code, using more inheritance instead of duplication -- but my concern is that it is wasted effort as I cannot commit to svn. I thought about pmming diffs to someone (like you?) and asking if you are happy to commit, but I am not sure if that is a good idea. Moving big chunks of code around makes merging really awkward.

Oh, and your fix does work nicely, thanks :)
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

For SVN access (and joining the project as well, we are always in need of active coders) you would probably want to PM Ahruman, Winston or Giles himself. As for the diffs, these need to be thoroughly tested before commiting, but I would not mind at all having a look at them ;-)
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

Thanks, Ill have a look through some of my stuff, and see if there is anything I am not too worried about sending :)
Post Reply