Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOCommodities.h
Go to the documentation of this file.
1/*
2
3OOCommodities.h
4
5Commodity price and quantity manager
6
7Oolite
8Copyright (C) 2004-2013 Giles C Williams and contributors
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23MA 02110-1301, USA.
24
25*/
26
27#import "OOTypes.h"
28
29
30#define MAIN_SYSTEM_MARKET_LIMIT 127
31
32// keys in trade-goods.plist
33static NSString * const kOOCommodityName = @"name";
34static NSString * const kOOCommodityClasses = @"classes";
35static NSString * const kOOCommodityContainer = @"quantity_unit";
36static NSString * const kOOCommodityPeakExport = @"peak_export";
37static NSString * const kOOCommodityPeakImport = @"peak_import";
38static NSString * const kOOCommodityPriceAverage = @"price_average";
39static NSString * const kOOCommodityPriceEconomic = @"price_economic";
40static NSString * const kOOCommodityPriceRandom = @"price_random";
41// next one cannot be set from file - named for compatibility
42static NSString * const kOOCommodityPriceCurrent = @"price";
43static NSString * const kOOCommodityQuantityAverage = @"quantity_average";
44static NSString * const kOOCommodityQuantityEconomic= @"quantity_economic";
45static NSString * const kOOCommodityQuantityRandom = @"quantity_random";
46// next one cannot be set from file - named for compatibility
47static NSString * const kOOCommodityQuantityCurrent = @"quantity";
48static NSString * const kOOCommodityLegalityExport = @"legality_export";
49static NSString * const kOOCommodityLegalityImport = @"legality_import";
50static NSString * const kOOCommodityTrumbleOpinion = @"trumble_opinion";
51static NSString * const kOOCommoditySortOrder = @"sort_order";
52static NSString * const kOOCommodityCapacity = @"capacity";
53static NSString * const kOOCommodityScript = @"market_script";
54static NSString * const kOOCommodityComment = @"comment";
55static NSString * const kOOCommodityShortComment = @"short_comment";
56// next one cannot be set from file - named for compatibility
57static NSString * const kOOCommodityKey = @"key";
58
59
60// keys in secondary market definitions
61static NSString * const kOOCommodityMarketType = @"type";
62static NSString * const kOOCommodityMarketName = @"name";
63static NSString * const kOOCommodityMarketPriceAdder = @"price_adder";
64static NSString * const kOOCommodityMarketPriceMultiplier = @"price_multiplier";
65static NSString * const kOOCommodityMarketPriceRandomiser = @"price_randomiser";
66static NSString * const kOOCommodityMarketQuantityAdder = @"quantity_adder";
67static NSString * const kOOCommodityMarketQuantityMultiplier = @"quantity_multiplier";
68static NSString * const kOOCommodityMarketQuantityRandomiser = @"quantity_randomiser";
69static NSString * const kOOCommodityMarketLegalityExport = @"legality_export";
70static NSString * const kOOCommodityMarketLegalityImport = @"legality_import";
71static NSString * const kOOCommodityMarketCapacity = @"capacity";
72
73// values for "type" in the plist
74static NSString * const kOOCommodityMarketTypeValueDefault = @"default";
75static NSString * const kOOCommodityMarketTypeValueClass = @"class";
76static NSString * const kOOCommodityMarketTypeValueGood = @"good";
77
78
79
81
82@interface OOCommodities: NSObject
83{
84@private
85 NSDictionary *_commodityLists;
86
87
88}
89
90+ (OOCommodityType) legacyCommodityType:(NSUInteger)i;
91
92- (OOCommodityMarket *) generateManifestForPlayer;
93- (OOCommodityMarket *) generateBlankMarket;
94- (OOCommodityMarket *) generateMarketForSystemWithEconomy:(OOEconomyID)economy andScript:(NSString *)scriptName;
95- (OOCommodityMarket *) generateMarketForStation:(StationEntity *)station;
96
97- (OOCreditsQuantity) samplePriceForCommodity:(OOCommodityType)commodity inEconomy:(OOEconomyID)economy withScript:(NSString *)scriptName inSystem:(OOSystemID)system;
98
99- (NSUInteger) count;
100- (NSArray *) goods;
101- (BOOL) goodDefined:(NSString *)key;
102- (NSString *) goodNamed:(NSString *)name;
103- (NSString *) getRandomCommodity;
104- (OOMassUnit) massUnitForGood:(NSString *)good;
105
106
107
108@end
static NSString *const kOOCommodityPriceRandom
static NSString *const kOOCommodityMarketCapacity
static NSString *const kOOCommodityTrumbleOpinion
static NSString *const kOOCommodityMarketLegalityImport
static NSString *const kOOCommodityCapacity
static NSString *const kOOCommodityPriceCurrent
static NSString *const kOOCommodityComment
static NSString *const kOOCommodityMarketPriceRandomiser
static NSString *const kOOCommodityQuantityAverage
static NSString *const kOOCommodityMarketName
static NSString *const kOOCommodityKey
static NSString *const kOOCommodityQuantityRandom
static NSString *const kOOCommodityQuantityEconomic
static NSString *const kOOCommoditySortOrder
static NSString *const kOOCommodityContainer
static NSString *const kOOCommodityMarketQuantityRandomiser
static NSString *const kOOCommodityLegalityImport
static NSString *const kOOCommodityMarketPriceMultiplier
static NSString *const kOOCommodityMarketTypeValueClass
static NSString *const kOOCommodityPriceAverage
static NSString *const kOOCommodityMarketTypeValueGood
static NSString *const kOOCommodityScript
static NSString *const kOOCommodityMarketTypeValueDefault
static NSString *const kOOCommodityMarketType
static NSString *const kOOCommodityName
static NSString *const kOOCommodityPeakExport
static NSString *const kOOCommodityMarketQuantityAdder
static NSString *const kOOCommodityQuantityCurrent
static NSString *const kOOCommodityPriceEconomic
static NSString *const kOOCommodityLegalityExport
static NSString *const kOOCommodityPeakImport
static NSString *const kOOCommodityMarketQuantityMultiplier
static NSString *const kOOCommodityMarketPriceAdder
static NSString *const kOOCommodityClasses
static NSString *const kOOCommodityShortComment
static NSString *const kOOCommodityMarketLegalityExport
unsigned count
NSString * OOCommodityType
Definition OOTypes.h:106
uint64_t OOCreditsQuantity
Definition OOTypes.h:182
int16_t OOSystemID
Definition OOTypes.h:211
OOMassUnit
Definition OOTypes.h:123
uint8_t OOEconomyID
Definition OOTypes.h:207
NSDictionary * _commodityLists