Oolite
Loading...
Searching...
No Matches
OOCommodityMarket.m File Reference
Include dependency graph for OOCommodityMarket.m:

Go to the source code of this file.

Functions

static NSComparisonResult goodsSorter (id a, id b, void *context)

Function Documentation

◆ goodsSorter()

NSComparisonResult goodsSorter ( id a,
id b,
void * context )
static

Definition at line 341 of file OOCommodityMarket.m.

342{
343 NSDictionary* commodityList = (NSDictionary*)context;
344 int v1 = [[commodityList oo_dictionaryForKey:(NSString*)a] oo_intForKey:kOOCommoditySortOrder];
345 int v2 = [[commodityList oo_dictionaryForKey:(NSString*)b] oo_intForKey:kOOCommoditySortOrder];
346
347 if (v1 < v2) {
348 return NSOrderedAscending;
349 } else if (v1 > v2) {
350 return NSOrderedDescending;
351 } else {
352 return NSOrderedSame;
353 }
354}