economy.h
author bjarni
Sat, 29 Apr 2006 14:38:21 +0000
branch0.4
changeset 9973 72d7f7f30746
parent 9959 984493ab6fff
permissions -rw-r--r--
(svn r4624) -Backported r4149 from trunk
main reason is that it fixes the load/save issue for OSX 10.3.9, but the other stuff in this commit can't be taken as it's a result of the fix

full commit log entry:
-Codechange: [OSX] rewrite of how universal binaries are compiled

Now OSX stores object files in .OSX and instead of making FAT object files, there are one for each architecture
Each architecture got their own targets to make a non-FAT binary and in the end, lipo will merge them into one binary

It's now possible to select which architectures you want to support by defining OTTD_PPC, OTTD_PPC970 (G5) and/or OTTD_i386
All combos are supported. UNIVERSAL_BINARY and TRIPLE_BINARY can still be used even though it's possible to gain the same result by using the new flags
Making a universal build when you already got part of it compiled (say the PPC part), it will reuse it and only compile the i386 part to save time
Note: in some cases when you switch flags, you risk that openttd is not updated. Delete it and try again. The Makefile can't solve this except if it forces linking each time

This fixes: FS#87 universal binary building borked in 0.4.7
Now universal binaries work on OSX 10.3.9 again

Building universal binaries no longer needs to store flags in Makefile.config as the new design makes it possible to figure everything out automatically
/* $Id$ */

#ifndef ECONOMY_H
#define ECONOMY_H

void ResetPriceBaseMultipliers(void);
void SetPriceBaseMultiplier(uint price, byte factor);

typedef struct {
	// Maximum possible loan
	int32 max_loan;
	int32 max_loan_unround;
	// Economy fluctuation status
	int fluct;
	// Interest
	byte interest_rate;
	byte infl_amount;
	byte infl_amount_pr;
} Economy;

VARDEF Economy _economy;

typedef struct Subsidy {
	byte cargo_type;
	byte age;
	uint16 from;
	uint16 to;
} Subsidy;


enum {
    SCORE_VEHICLES = 0,
    SCORE_STATIONS = 1,
    SCORE_MIN_PROFIT = 2,
    SCORE_MIN_INCOME = 3,
    SCORE_MAX_INCOME = 4,
    SCORE_DELIVERED = 5,
    SCORE_CARGO = 6,
    SCORE_MONEY = 7,
    SCORE_LOAN = 8,
    SCORE_TOTAL = 9, // This must always be the last entry

    NUM_SCORE = 10, // How many scores are there..

    SCORE_MAX = 1000, 	// The max score that can be in the performance history
    					//  the scores together of score_info is allowed to be more!
};

typedef struct ScoreInfo {
    byte id;			// Unique ID of the score
    int needed;			// How much you need to get the perfect score
    int score;			// How much score it will give
} ScoreInfo;

extern const ScoreInfo _score_info[];
extern int _score_part[MAX_PLAYERS][NUM_SCORE];

int UpdateCompanyRatingAndValue(Player *p, bool update);
void UpdatePlayerHouse(Player *p, uint score);


VARDEF Subsidy _subsidies[MAX_PLAYERS];
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode);
void DeleteSubsidyWithIndustry(uint16 index);
void DeleteSubsidyWithStation(uint16 index);

int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, byte cargo_type);
uint MoveGoodsToStation(TileIndex tile, int w, int h, int type, uint amount);

#endif /* ECONOMY_H */