Fixed a problem with anyRole method not selecting weighted roles correctly. Fixed a bug where market commodities list was not generated correctly. Fixed a possible memory leak (elimination of 'OOTexture' may not respond to '-release' and 'OORoleSet' may not respond to '-release' warnings).

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1168 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Nikos Barkas 2007-09-10 05:57:06 +00:00
parent 4ffb4ab24b
commit ab372e5568
3 changed files with 8 additions and 6 deletions

View File

@ -49,6 +49,8 @@ MA 02110-1301, USA.
#import "OOPListParsing.h"
#import "OOCollectionExtractors.h"
#import "OOConstToString.h"
#import "OOTexture.h" // Required to properly release missionBackgroundTexture.
#import "OORoleSet.h" // Required to properly release roleSet.
#import "OOScript.h"
#import "HeadUpDisplay.h"

View File

@ -212,7 +212,7 @@ SOFTWARE.
selected = randf() * _totalProb;
prob = 0.0f;
for (roleEnum = [_rolesAndProbabilities objectEnumerator]; (role = [roleEnum nextObject]); )
for (roleEnum = [_rolesAndProbabilities keyEnumerator]; (role = [roleEnum nextObject]); )
{
prob += [_rolesAndProbabilities floatForKey:role];
if (selected <= prob) break;

View File

@ -6219,15 +6219,15 @@ static BOOL MaintainLinkedLists(Universe* uni)
- (NSArray *) commodityDataForEconomy:(OOEconomyID) economy andStation:(StationEntity *)some_station andRandomFactor:(int) random_factor
{
NSString *station_roles = nil;
NSMutableArray *ourEconomy = nil;
NSString *stationRole = nil;
NSMutableArray *ourEconomy = nil;
unsigned i;
station_roles = [[self currentSystemData] stringForKey:@"market"];
NSString *stationRole = [some_station primaryRole];
stationRole = [[self currentSystemData] stringForKey:@"market"];
if (stationRole == nil) stationRole = [some_station primaryRole];
if ([commoditylists arrayForKey:stationRole] == nil) stationRole = @"default";
ourEconomy = [NSMutableArray arrayWithArray:[commoditylists arrayForKey:station_roles]];
ourEconomy = [NSMutableArray arrayWithArray:[commoditylists arrayForKey:stationRole]];
for (i = 0; i < [ourEconomy count]; i++)
{