Changed OOCreditsQuantity to uint64_t.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1274 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2007-12-13 11:53:25 +00:00
parent 1dd0b50f52
commit 4919cb197e
13 changed files with 199 additions and 205 deletions

View File

@ -974,7 +974,7 @@
083325DC09DDBCDE00F5B8E4 /* OOColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOColor.m; sourceTree = "<group>"; };
083DB4D30A70E51E00B419B2 /* OOBrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OOBrain.h; sourceTree = "<group>"; };
083DB4D40A70E51E00B419B2 /* OOBrain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OOBrain.m; sourceTree = "<group>"; };
0865432206B8447D000CA0AB /* OoliteDev.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OoliteDev.app; sourceTree = BUILT_PRODUCTS_DIR; };
0865432206B8447D000CA0AB /* Oolite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Oolite.app; sourceTree = BUILT_PRODUCTS_DIR; };
0878FD2F086EF845004CB752 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1A020E0A0D020AFB00C3F51E /* changedScriptHandlers.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = changedScriptHandlers.plist; sourceTree = "<group>"; };
@ -1003,7 +1003,7 @@
1A2316E90B9CFAD700EF0852 /* missiontext.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = missiontext.plist; sourceTree = "<group>"; };
1A2316EB0B9CFAD700EF0852 /* shipdata.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = shipdata.plist; sourceTree = "<group>"; };
1A2316EC0B9CFAD700EF0852 /* shipyard.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = shipyard.plist; sourceTree = "<group>"; };
1A2316ED0B9CFAD700EF0852 /* speech_pronunciation_guide.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = speech_pronunciation_guide.plist; sourceTree = "<group>"; };
1A2316ED0B9CFAD700EF0852 /* speech_pronunciation_guide.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = speech_pronunciation_guide.plist; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.plist; };
1A2317910B9D022400EF0852 /* buoyAI.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = buoyAI.plist; sourceTree = "<group>"; };
1A2317920B9D022500EF0852 /* collectLootAI.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = collectLootAI.plist; sourceTree = "<group>"; };
1A2317930B9D022500EF0852 /* dockingAI.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = dockingAI.plist; sourceTree = "<group>"; };
@ -1605,7 +1605,7 @@
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
0865432206B8447D000CA0AB /* OoliteDev.app */,
0865432206B8447D000CA0AB /* Oolite.app */,
1A71E6F30BCE340C00CD5C13 /* libpng.a */,
);
name = Products;
@ -2756,7 +2756,7 @@
name = Oolite;
productInstallPath = "$(HOME)/Applications";
productName = Oolite;
productReference = 0865432206B8447D000CA0AB /* OoliteDev.app */;
productReference = 0865432206B8447D000CA0AB /* Oolite.app */;
productType = "com.apple.product-type.application";
};
1A71E6F20BCE340C00CD5C13 /* libpng-custom */ = {

View File

@ -1,70 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<array>
<string>\n</string>
<string> </string>
</array>
<array>
<string>\t</string>
<string> </string>
</array>
<array>
<string>Cruiser</string><!-- must come before ' Cr' -->
<string>[[inpt PHON]]kr1UWz2AXr[[inpt TEXT]]</string>
</array>
<array>
<string> Cr</string>
<string> credits</string>
</array>
<array>
<string> s.</string>
<string> seconds</string>
</array>
<array>
<string>Purse</string>
<string>, Total </string>
</array>
<array>
<string>Mark III</string>
<string>Mach Three</string>
</array>
<array>
<string>Mark II</string>
<string>Mach Two</string>
</array>
<array>
<string>Mark I</string>
<string>Mach One</string>
</array>
<array>
<string>GalCop</string>
<string>galactic police</string>
</array>
<array>
<string>Witchspace</string>
<string>[[inpt PHON]]w1IHCsp2EYs[[inpt TEXT]]</string>
</array>
<array>
<string>Fer-de-Lance</string>
<string>[[inpt PHON]]f1&lt;EY&lt;&lt;AE=dEH=l2UXns[[inpt TEXT]]</string>
</array>
<array>
<string>Sidewinder</string>
<string>[[inpt PHON]]s1AYdw2AYndAX[[inpt TEXT]]</string>
</array>
<array>
<string>Rebel</string>
<string>[[inpt PHON]]rEHbUXl[[inpt TEXT]]</string>
</array>
<array>
<string>Metal fragment</string>
<string>metal [[inpt PHON]]fr1AEgmUHnt[[inpt TEXT]]</string>
</array>
<array>
<string>Ident</string>
<string>Identification</string>
</array>
</array>
</plist>
(
(
"\\n",
" "
),
(
"\\t",
" "
),
(
// must come before ' Cr'
Cruiser,
"[[inpt PHON]]kr1UWz2AXr[[inpt TEXT]]"
),
(
" Cr",
" credits"
),
(
" s.",
" seconds"
),
(
Purse,
", Total "
),
(
"Mark III",
"Mach Three"
),
(
"Mark II",
"Mach Two"
),
(
"Mark I",
"Mach One"
),
(
GalCop,
"[[inpt PHON]]g1AElkUXp[[inpt TEXT]]"
),
(
Witchspace,
"[[inpt PHON]]w1IHCsp2EYs[[inpt TEXT]]"
),
(
"Fer-de-Lance",
"[[inpt PHON]]f1<EY<<AE=dEH=l2UXns[[inpt TEXT]]"
),
(
Sidewinder,
"[[inpt PHON]]s1AYdw2AYndAX[[inpt TEXT]]"
),
(
Rebel,
"[[inpt PHON]]rEHbUXl[[inpt TEXT]]"
),
(
"Metal fragment",
"metal [[inpt PHON]]fr1AEgmUHnt[[inpt TEXT]]"
),
(
Ident,
Identification
)
)

View File

@ -71,7 +71,7 @@
"script.js",
"shipdata.plist",
"shipyard.plist",
"speech_pronounciation_guide.plist",
"speech_pronunciation_guide.plist",
"startextures.plist",
"world-scripts.plist"
);

View File

@ -274,8 +274,8 @@ static PlayerEntity *sSharedPlayer = nil;
[result setObject:player_name forKey:@"player_name"];
[result setObject:[NSNumber numberWithInt:credits] forKey:@"credits"];
[result setObject:[NSNumber numberWithInt:fuel] forKey:@"fuel"];
[result setObject:[NSNumber numberWithUnsignedLongLong:credits] forKey:@"credits"];
[result setObject:[NSNumber numberWithUnsignedInt:fuel] forKey:@"fuel"];
[result setObject:[NSNumber numberWithInt:galaxy_number] forKey:@"galaxy_number"];
@ -667,10 +667,8 @@ static PlayerEntity *sSharedPlayer = nil;
[self addExtraEquipment:@"EQ_CARGO_BAY"];
max_cargo -= max_passengers * 5;
if ([dict objectForKey:@"credits"])
credits = [(NSNumber *)[dict objectForKey:@"credits"] intValue];
if ([dict objectForKey:@"fuel"])
fuel = [(NSNumber *)[dict objectForKey:@"fuel"] intValue];
credits = [dict unsignedLongLongForKey:@"credits" defaultValue:credits];
fuel = [dict unsignedIntForKey:@"fuel" defaultValue:fuel];
if ([dict objectForKey:@"galaxy_number"])
galaxy_number = [(NSNumber *)[dict objectForKey:@"galaxy_number"] intValue];
@ -3422,9 +3420,9 @@ double scoopSoundPlayTime = 0.0;
{
if (!other)
return;
int score = 10 * [other bounty];
int killClass = other->scanClass; // **tgape** change (+line)
int kill_award = 1;
OOCreditsQuantity score = 10 * [other bounty];
OOScanClass killClass = other->scanClass; // **tgape** change (+line)
BOOL killAward = YES;
if ([other isPolice]) // oops, we shot a copper!
legalStatus |= 64;
@ -3437,7 +3435,7 @@ double scoopSoundPlayTime = 0.0;
if (![other hasRole:@"tharglet"]) // okay, we'll count tharglets as proper kills
{
score /= 10; // reduce bounty awarded
kill_award = 0; // don't award a kill
killAward = NO; // don't award a kill
}
}
}
@ -3446,8 +3444,8 @@ double scoopSoundPlayTime = 0.0;
if (score)
{
NSString* bonusMS1 = [NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[bounty-d]"), score / 10];
NSString* bonusMS2 = [NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[total-f-credits]"), 0.1 * credits];
NSString *bonusMS1 = [NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[bounty-d]"), score / 10];
NSString *bonusMS2 = [NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[total-f-credits]"), 0.1 * credits];
if (score > 9)
{
@ -3456,14 +3454,13 @@ double scoopSoundPlayTime = 0.0;
}
}
while (kill_award > 0)
if (killAward)
{
ship_kills++;
kill_award--;
if ((ship_kills % 256) == 0)
{
// congratulations method needs to be delayed a fraction of a second
NSString* roc = ExpandDescriptionForCurrentSystem(@"[right-on-commander]");
NSString *roc = ExpandDescriptionForCurrentSystem(@"[right-on-commander]");
[UNIVERSE addDelayedMessage:roc forCount:4 afterDelay:0.2];
}
}
@ -3538,7 +3535,7 @@ double scoopSoundPlayTime = 0.0;
- (void) getDestroyedBy:(Entity *)whom context:(NSString *)why
{
NSString* scoreMS = [NSString stringWithFormat:@"Score: %.1f Credits",credits/10.0];
NSString *scoreMS = [NSString stringWithFormat:@"Score: %.1f Credits",credits/10.0];
if (![[UNIVERSE gameController] playerFileToLoad])
[[UNIVERSE gameController] setPlayerFileToLoad: save_path]; // make sure we load the correct game
@ -5166,7 +5163,7 @@ static int last_outfitting_index;
// wind the clock forward by 10 minutes plus 10 minutes for every 60 credits spent
double time_adjust = (old_credits > credits)? (old_credits - credits): 0.0;
double time_adjust = (old_credits > credits) ? (old_credits - credits) : 0.0;
ship_clock_adjust += time_adjust + 600.0;
}
}
@ -5181,12 +5178,12 @@ static int last_outfitting_index;
{
// note this doesn't check the availability by tech-level
NSArray *equipdata = [UNIVERSE equipmentdata];
OOCreditsQuantity price_per_unit = [[[equipdata objectAtIndex:index] objectAtIndex:EQUIPMENT_PRICE_INDEX] intValue];
NSString *eq_key = [[equipdata objectAtIndex:index] objectAtIndex:EQUIPMENT_KEY_INDEX];
OOCreditsQuantity price_per_unit = [[equipdata arrayAtIndex:index] unsignedLongLongAtIndex:EQUIPMENT_PRICE_INDEX];
NSString *eq_key = [[equipdata arrayAtIndex:index] stringAtIndex:EQUIPMENT_KEY_INDEX];
NSString *eq_key_damaged = [NSString stringWithFormat:@"%@_DAMAGED", eq_key];
double price = ([eq_key isEqual:@"EQ_FUEL"]) ? ((PLAYER_MAX_FUEL - fuel) * price_per_unit) : (price_per_unit) ;
double price = ([eq_key isEqual:@"EQ_FUEL"]) ? ((PLAYER_MAX_FUEL - fuel) * price_per_unit) : (price_per_unit);
double price_factor = 1.0;
OOCargoQuantity cargo_space = max_cargo - current_cargo;
OOCargoQuantity cargo_space = max_cargo - current_cargo;
OOCreditsQuantity tradeIn = 0;
// repairs cost 50%
@ -5414,7 +5411,7 @@ static int last_outfitting_index;
unsigned i;
for (i = 0; i < [equipdata count]; i++)
{
NSString *w_key = (NSString *)[(NSArray *)[equipdata objectAtIndex:i] objectAtIndex:EQUIPMENT_KEY_INDEX];
NSString *w_key = [[equipdata arrayAtIndex:i] stringAtIndex:EQUIPMENT_KEY_INDEX];
if (([eq_key isEqual:w_key])&&(![self hasExtraEquipment:eq_key]))
{
credits -= price;

View File

@ -1377,7 +1377,7 @@ static NSMutableDictionary* currentShipyard = nil;
// first check you can afford it!
NSDictionary* ship_info = [currentShipyard dictionaryForKey:key];
OOCreditsQuantity price = [ship_info unsignedIntForKey:SHIPYARD_KEY_PRICE];
OOCreditsQuantity price = [ship_info unsignedLongLongForKey:SHIPYARD_KEY_PRICE];
OOCreditsQuantity trade_in = [self tradeInValue];
if (credits + trade_in * 10 < price * 10)

View File

@ -869,10 +869,10 @@
if(!dockedStation) dockedStation = [UNIVERSE station];
// Display the commander's ship.
NSString *shipDesc = [cdr stringForKey:@"ship_desc"];
NSString *shipName = nil;
NSDictionary *shipDict = nil;
NSString *rating;
NSString *shipDesc = [cdr stringForKey:@"ship_desc"];
NSString *shipName = nil;
NSDictionary *shipDict = nil;
NSString *rating = nil;
shipDict = [UNIVERSE getDictionaryForShip:shipDesc];
if(shipDict != nil)
@ -888,13 +888,13 @@
}
// Make a short description of the commander
NSString *legalDesc = nil;
int money;
NSString *legalDesc = nil;
OOCreditsQuantity money;
legalDesc = LegalStatusToString([cdr intForKey:@"legal_status"]);
rating = KillCountToRatingAndKillString([cdr unsignedIntForKey:@"ship_kills"]);
money = [cdr intForKey:@"credits"] / 10;
money = [cdr unsignedLongLongForKey:@"credits"] / 10;
// Nikos - Add some more information in the load game screen (current location, galaxy number and timestamp).
//-------------------------------------------------------------------------------------------------------------------------

View File

@ -6230,7 +6230,7 @@ BOOL class_masslocks(int some_class)
unsigned i;
for (i = 0; i < [[other crew] count]; i++)
{
OOCharacter* rescuee = (OOCharacter*)[[other crew] objectAtIndex:i];
OOCharacter *rescuee = [[other crew] objectAtIndex:i];
if ([rescuee legalStatus])
{
[UNIVERSE addMessage: [NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[scoop-captured-@]"), [rescuee name]] forCount: 4.5];

View File

@ -25,60 +25,60 @@ MA 02110-1301, USA.
*/
#import <Foundation/Foundation.h>
#import "OOTypes.h"
#import "legacy_random.h"
@class OOBrain, Universe;
@interface OOCharacter : NSObject
{
NSString* name;
NSString* shortDescription;
NSString* longDescription;
Random_Seed originSystemSeed;
Random_Seed genSeed;
int legalStatus;
int insuranceCredits;
NSString *name;
NSString *shortDescription;
NSString *longDescription;
Random_Seed originSystemSeed;
Random_Seed genSeed;
int legalStatus;
OOCreditsQuantity insuranceCredits;
OOBrain* brain; // brain of character
OOBrain *brain; // brain of character
NSArray* script_actions;
NSArray *script_actions;
}
- (id) initWithGenSeed:(Random_Seed) g_seed andOriginalSystemSeed:(Random_Seed) s_seed;
- (id) initWithRole:(NSString*) role andOriginalSystemSeed:(Random_Seed) s_seed;
- (id) initWithGenSeed:(Random_Seed)g_seed andOriginalSystemSeed:(Random_Seed)s_seed;
- (id) initWithRole:(NSString *)role andOriginalSystemSeed:(Random_Seed)s_seed;
+ (OOCharacter*) characterWithRole:(NSString*) c_role andOriginalSystem:(Random_Seed) o_seed;
+ (OOCharacter*) randomCharacterWithRole:(NSString*) c_role andOriginalSystem:(Random_Seed) o_seed;
+ (OOCharacter*) characterWithDictionary:(NSDictionary*) c_dict;
+ (OOCharacter *) characterWithRole:(NSString *)c_role andOriginalSystem:(Random_Seed)o_seed;
+ (OOCharacter *) randomCharacterWithRole:(NSString *)c_role andOriginalSystem:(Random_Seed)o_seed;
+ (OOCharacter *) characterWithDictionary:(NSDictionary *)c_dict;
- (NSString*) planetOfOrigin;
- (NSString*) species;
- (void) basicSetUp;
- (BOOL) castInRole:(NSString*) role;
- (BOOL) castInRole:(NSString *)role;
- (NSString*) name;
- (NSString*) shortDescription;
- (NSString*) longDescription;
- (Random_Seed) originSystemSeed;
- (Random_Seed) genSeed;
- (int) legalStatus;
- (int) insuranceCredits;
- (NSArray*) script;
- (OOBrain*) brain;
- (NSString *) name;
- (NSString *) shortDescription;
- (NSString *) longDescription;
- (Random_Seed) originSystemSeed;
- (Random_Seed) genSeed;
- (int) legalStatus;
- (OOCreditsQuantity) insuranceCredits;
- (NSArray *) script;
- (OOBrain *) brain;
- (void) setName: (NSString*) value;
- (void) setShortDescription: (NSString*) value;
- (void) setLongDescription: (NSString*) value;
- (void) setOriginSystemSeed: (Random_Seed) value;
- (void) setGenSeed: (Random_Seed) value;
- (void) setLegalStatus: (int) value;
- (void) setInsuranceCredits: (int) value;
- (void) setScript: (NSArray*) some_actions;
- (void) setName:(NSString *)value;
- (void) setShortDescription:(NSString *)value;
- (void) setLongDescription:(NSString *)value;
- (void) setOriginSystemSeed:(Random_Seed)value;
- (void) setGenSeed:(Random_Seed)value;
- (void) setLegalStatus:(int)value;
- (void) setInsuranceCredits:(OOCreditsQuantity)value;
- (void) setScript:(NSArray *)some_actions;
- (void) setBrain: (OOBrain*) aBrain;
- (void) setBrain:(OOBrain *)aBrain;
- (void) setCharacterFromDictionary:(NSDictionary*) dict;
- (void) setCharacterFromDictionary:(NSDictionary *)dict;
@end

View File

@ -27,14 +27,14 @@ MA 02110-1301, USA.
#import "Universe.h"
#import "OOBrain.h"
#import "OOStringParsing.h"
#import "OOCollectionExtractors.h"
#include "legacy_random.h"
@implementation OOCharacter
- (NSString *) descriptionComponents
{
return [NSString stringWithFormat:@"%@, %@. bounty: %i insurance:%i", [self name], [self shortDescription], [self legalStatus], [self insuranceCredits]];
return [NSString stringWithFormat:@"%@, %@. bounty: %i insurance: %llu", [self name], [self shortDescription], [self legalStatus], [self insuranceCredits]];
}
@ -192,20 +192,20 @@ MA 02110-1301, USA.
}
// if clean - determine insurance level (if any)
[self setInsuranceCredits: 0];
[self setInsuranceCredits:0];
if (legal_index == 0)
{
int insurance_index = gen_rnd_number() & gen_rnd_number() & 0x03;
switch (insurance_index)
{
case 1:
[self setInsuranceCredits: 125];
[self setInsuranceCredits:125];
break;
case 2:
[self setInsuranceCredits: 250];
[self setInsuranceCredits:250];
break;
case 3:
[self setInsuranceCredits: 500];
[self setInsuranceCredits:500];
}
}
@ -216,10 +216,12 @@ MA 02110-1301, USA.
- (BOOL) castInRole:(NSString *) role
{
BOOL specialSetUpDone = NO;
BOOL specialSetUpDone = NO;
NSString *legalDesc;
NSString *legalDesc;
if ([[role lowercaseString] isEqual:@"pirate"])
role = [role lowercaseString];
if ([role isEqual:@"pirate"])
{
// determine legalStatus for a completely random character
int sins = 0x08 | (genSeed.a & genSeed.b);
@ -240,7 +242,7 @@ MA 02110-1301, USA.
specialSetUpDone = YES;
}
if ([[role lowercaseString] isEqual:@"trader"])
if ([role isEqual:@"trader"])
{
legalDesc = @"clean";
[self setLegalStatus: 0]; // clean
@ -249,73 +251,73 @@ MA 02110-1301, USA.
switch (insurance_index)
{
case 0:
[self setInsuranceCredits: 0];
[self setInsuranceCredits:0];
break;
case 1:
[self setInsuranceCredits: 125];
[self setInsuranceCredits:125];
break;
case 2:
[self setInsuranceCredits: 250];
[self setInsuranceCredits:250];
break;
case 3:
[self setInsuranceCredits: 500];
[self setInsuranceCredits:500];
}
specialSetUpDone = YES;
}
if ([[role lowercaseString] isEqual:@"hunter"])
if ([role isEqual:@"hunter"])
{
legalDesc = @"clean";
[self setLegalStatus: 0]; // clean
[self setLegalStatus:0]; // clean
int insurance_index = gen_rnd_number() & 0x03;
if (insurance_index == 3)
[self setInsuranceCredits: 500];
[self setInsuranceCredits:500];
specialSetUpDone = YES;
}
if ([[role lowercaseString] isEqual:@"police"])
if ([role isEqual:@"police"])
{
legalDesc = @"clean";
[self setLegalStatus: 0]; // clean
[self setInsuranceCredits: 125];
[self setLegalStatus:0]; // clean
[self setInsuranceCredits:125];
specialSetUpDone = YES;
}
if ([[role lowercaseString] isEqual:@"miner"])
if ([role isEqual:@"miner"])
{
legalDesc = @"clean";
[self setLegalStatus: 0]; // clean
[self setInsuranceCredits: 25];
[self setLegalStatus:0]; // clean
[self setInsuranceCredits:25];
specialSetUpDone = YES;
}
if ([[role lowercaseString] isEqual:@"passenger"])
if ([role isEqual:@"passenger"])
{
legalDesc = @"clean";
[self setLegalStatus: 0]; // clean
[self setLegalStatus:0]; // clean
int insurance_index = gen_rnd_number() & 0x03;
switch (insurance_index)
{
case 0:
[self setInsuranceCredits: 25];
[self setInsuranceCredits:25];
break;
case 1:
[self setInsuranceCredits: 125];
[self setInsuranceCredits:125];
break;
case 2:
[self setInsuranceCredits: 250];
[self setInsuranceCredits:250];
break;
case 3:
[self setInsuranceCredits: 500];
[self setInsuranceCredits:500];
}
specialSetUpDone = YES;
}
if ([[role lowercaseString] isEqual:@"slave"])
if ([role isEqual:@"slave"])
{
legalDesc = @"clean";
[self setLegalStatus: 0]; // clean
[self setInsuranceCredits: 0];
[self setLegalStatus:0]; // clean
[self setInsuranceCredits:0];
specialSetUpDone = YES;
}
@ -362,7 +364,7 @@ MA 02110-1301, USA.
}
- (int)insuranceCredits
- (OOCreditsQuantity)insuranceCredits
{
return insuranceCredits;
}
@ -422,7 +424,7 @@ MA 02110-1301, USA.
}
- (void)setInsuranceCredits:(int)value
- (void)setInsuranceCredits:(OOCreditsQuantity)value
{
insuranceCredits = value;
}
@ -468,15 +470,14 @@ MA 02110-1301, USA.
[self basicSetUp];
}
if ([dict objectForKey:@"role"]) [self castInRole:[dict objectForKey:@"role"]];
if ([dict objectForKey:@"name"]) [self setName:[dict objectForKey:@"name"]];
if ([dict objectForKey:@"short_description"]) [self setShortDescription:[dict objectForKey:@"short_description"]];
if ([dict objectForKey:@"long_description"]) [self setLongDescription:[dict objectForKey:@"long_description"]];
if ([dict objectForKey:@"legal_status"]) [self setLegalStatus:[[dict objectForKey:@"legal_status"] intValue]];
if ([dict objectForKey:@"bounty"]) [self setLegalStatus:[[dict objectForKey:@"bounty"] intValue]];
if ([dict objectForKey:@"insurance"]) [self setInsuranceCredits:[[dict objectForKey:@"insurance"] intValue]];
if ([dict objectForKey:@"script_actions"]) [self setScript:[dict objectForKey:@"script_actions"]];
if ([dict stringForKey:@"role"]) [self castInRole:[dict stringForKey:@"role"]];
if ([dict stringForKey:@"name"]) [self setName:[dict stringForKey:@"name"]];
if ([dict stringForKey:@"short_description"]) [self setShortDescription:[dict stringForKey:@"short_description"]];
if ([dict stringForKey:@"long_description"]) [self setLongDescription:[dict stringForKey:@"long_description"]];
if ([dict objectForKey:@"legal_status"]) [self setLegalStatus:[dict intForKey:@"legal_status"]];
if ([dict objectForKey:@"bounty"]) [self setLegalStatus:[dict intForKey:@"bounty"]];
if ([dict objectForKey:@"insurance"]) [self setInsuranceCredits:[dict unsignedLongLongForKey:@"insurance"]];
if ([dict arrayForKey:@"script_actions"]) [self setScript:[dict arrayForKey:@"script_actions"]];
}
@end

View File

@ -288,7 +288,7 @@ typedef int32_t OOCargoQuantityDelta;
typedef uint16_t OOFuelQuantity;
typedef uint32_t OOCreditsQuantity;
typedef uint64_t OOCreditsQuantity;
typedef uint16_t OOKeyCode;

View File

@ -390,8 +390,7 @@ static NSComparisonResult comparePrice(NSDictionary *dict1, NSDictionary *dict2,
#ifndef GNUSTEP
//// speech stuff
if (speechArray)
[speechArray autorelease];
[speechArray autorelease];
speechArray = [[ResourceManager arrayFromFilesNamed:@"speech_pronunciation_guide.plist" inFolder:@"Config" andMerge:YES] retain];
////
@ -2951,7 +2950,7 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
if ([itemType isEqual:weapon_key])
{
return [itemData intAtIndex:EQUIPMENT_PRICE_INDEX];
return [itemData unsignedLongLongAtIndex:EQUIPMENT_PRICE_INDEX];
}
}
return 0;
@ -7087,7 +7086,7 @@ static NSComparisonResult comparePrice(NSDictionary *dict1, NSDictionary *dict2,
- (OOCreditsQuantity) tradeInValueForCommanderDictionary:(NSDictionary*) cmdr_dict
{
OOCreditsQuantity result = 0;
OOCreditsQuantity result = 0;
// get basic information about the commander's craft
@ -7107,7 +7106,7 @@ static NSComparisonResult comparePrice(NSDictionary *dict1, NSDictionary *dict2,
// get the basic information about the standard customer model for that craft
NSDictionary *shipyard_info = [shipyard dictionaryForKey:cmdr_ship_desc];
NSDictionary *basic_info = [shipyard_info dictionaryForKey:KEY_STANDARD_EQUIPMENT];
OOCreditsQuantity base_price = [shipyard_info unsignedIntForKey:SHIPYARD_KEY_PRICE];
OOCreditsQuantity base_price = [shipyard_info unsignedLongLongForKey:SHIPYARD_KEY_PRICE];
unsigned base_missiles = [basic_info unsignedIntForKey:KEY_EQUIPMENT_MISSILES];
OOCreditsQuantity base_missiles_value = base_missiles * [self getPriceForWeaponSystemWithKey:@"EQ_MISSILE"] / 10;
NSString *base_fwd_weapon_key = [basic_info stringForKey:KEY_EQUIPMENT_FORWARD_WEAPON];

View File

@ -58,24 +58,25 @@ int munge_checksum(int value)
// cunning price rounding routine:
//
float cunningFee(float value)
double cunningFee(double value)
{
float fee = value;
float superfee = 100000;
int rounded_fee = superfee * floor(0.5 + fee / superfee);
if (!rounded_fee)
rounded_fee = 1;
float ratio = fee / (float)rounded_fee;
while (((ratio < 0.95)||(ratio > 1.05))&&(superfee > 1))
double fee = value;
double superfee = 100000.0;
unsigned long long rounded_fee = superfee * floor(0.5 + fee / superfee);
if (rounded_fee == 0) rounded_fee = 1;
double ratio = fee / (double)rounded_fee;
while ((ratio < 0.95 || ratio > 1.05) && superfee > 1)
{
superfee /= 10;
rounded_fee = superfee * floor(0.5 + fee / superfee);
if (!rounded_fee)
rounded_fee = 1;
ratio = fee / (float)rounded_fee;
if (rounded_fee == 0) rounded_fee = 1;
ratio = fee / (double)rounded_fee;
superfee /= 10.0;
}
if ((ratio > 0.95)&&(ratio < 1.05))
if (ratio > 0.95 && ratio < 1.05)
fee = rounded_fee;
return fee;
}

View File

@ -66,8 +66,7 @@ void clear_checksum();
int munge_checksum(int value);
// cunning price rounding routine:
//
float cunningFee(float value) CONST_FUNC;
double cunningFee(double value);
// an implementation of RANROT
// pseudo random number generator