Changeset - r4293:cbb984a32af5
[Not reviewed]
master
0 32 0
rubidium - 18 years ago 2006-08-16 11:39:55
rubidium@openttd.org
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
-Codechange: store all year related variables that are _not_ stored in a savegame/transported over the network in the same format as _cur_year
32 files changed with 211 insertions and 203 deletions:
0 comments (0 inline, 0 general)
aircraft_cmd.c
Show inline comments
 
@@ -353,25 +353,25 @@ int32 CmdBuildAircraft(TileIndex tile, u
 
			// to ensure v->u.air.pos has been given a value
 
			assert(v->u.air.pos != MAX_ELEMENTS);
 
		}
 

	
 
		v->u.air.state = HANGAR;
 
		v->u.air.previous_pos = v->u.air.pos;
 
		v->u.air.targetairport = GetStationIndex(tile);
 
		v->next = u;
 

	
 
		v->service_interval = _patches.servint_aircraft;
 

	
 
		v->date_of_last_service = _date;
 
		v->build_year = u->build_year = _cur_year;
 
		v->build_year = u->build_year = _cur_year - BASE_YEAR;
 

	
 
		v->cur_image = u->cur_image = 0xEA0;
 

	
 
		v->random_bits = VehicleRandomBits();
 
		u->random_bits = VehicleRandomBits();
 

	
 
		VehiclePositionChanged(v);
 
		VehiclePositionChanged(u);
 

	
 
		// Aircraft with 3 vehicles (chopper)?
 
		if (v->subtype == 0) {
 
			w = vl[2];
aircraft_gui.c
Show inline comments
 
@@ -57,25 +57,25 @@ void DrawAircraftPurchaseInfo(int x, int
 
		SetDParam(1, AircraftDefaultCargoCapacity(cargo, engine_number));
 
		SetDParam(2, STR_9842_REFITTABLE);
 
		DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
 
	}
 
	y += 10;
 

	
 
	/* Running cost */
 
	SetDParam(0, avi->running_cost * _price.aircraft_running >> 8);
 
	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 
	y += 10;
 

	
 
	/* Design date - Life length */
 
	SetDParam(0, BASE_YEAR + ymd.year);
 
	SetDParam(0, ymd.year);
 
	SetDParam(1, e->lifelength);
 
	DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
 
	y += 10;
 

	
 
	/* Reliability */
 
	SetDParam(0, e->reliability * 100 >> 16);
 
	DrawString(x, y, STR_PURCHASE_INFO_RELIABILITY, 0);
 
	y += 10;
 

	
 
	/* Additional text from NewGRF */
 
	// XXX 227 will become a calculated width...
 
	y += ShowAdditionalText(x, y, 227, engine_number);
bridge.h
Show inline comments
 
@@ -3,25 +3,25 @@
 
/** @file bridge.h Header file for bridges */
 

	
 
#ifndef BRIDGE_H
 
#define BRIDGE_H
 

	
 
enum {
 
	MAX_BRIDGES = 13
 
};
 

	
 
/** Struct containing information about a single bridge type
 
 */
 
typedef struct Bridge {
 
	byte avail_year;     ///< the year in which the bridge becomes available
 
	Year avail_year;     ///< the year in which the bridge becomes available
 
	byte min_length;     ///< the minimum length of the bridge (not counting start and end tile)
 
	byte max_length;     ///< the maximum length of the bridge (not counting start and end tile)
 
	uint16 price;        ///< the relative price of the bridge
 
	uint16 speed;        ///< maximum travel speed
 
	PalSpriteID sprite;  ///< the sprite which is used in the GUI (possibly with a recolor sprite)
 
	StringID material;   ///< the string that contains the bridge description
 
	PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
 
	byte flags;          ///< bit 0 set: disable drawing of far pillars.
 
} Bridge;
 

	
 
extern const Bridge orig_bridge[MAX_BRIDGES];
 
extern Bridge _bridge[MAX_BRIDGES];
currency.c
Show inline comments
 
@@ -72,31 +72,31 @@ const StringID _currency_string_list[] =
 
assert_compile(lengthof(_currency_specs) + 1 == lengthof(_currency_string_list));
 

	
 

	
 
// get a mask of the allowed currencies depending on the year
 
uint GetMaskOfAllowedCurrencies(void)
 
{
 
	uint mask = 0;
 
	uint i;
 

	
 
	for (i = 0; i != lengthof(_currency_specs); i++) {
 
		uint16 to_euro = _currency_specs[i].to_euro;
 

	
 
		if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && BASE_YEAR + _cur_year >= to_euro) continue;
 
		if (to_euro == CF_ISEURO && BASE_YEAR + _cur_year < 2000) continue;
 
		if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && _cur_year >= to_euro) continue;
 
		if (to_euro == CF_ISEURO && _cur_year < 2000) continue;
 
		mask |= (1 << i);
 
	}
 
	mask |= (1 << CUSTOM_CURRENCY_ID); // always allow custom currency
 
	return mask;
 
}
 

	
 

	
 
void CheckSwitchToEuro(void)
 
{
 
	if (_currency_specs[_opt.currency].to_euro != CF_NOEURO &&
 
			_currency_specs[_opt.currency].to_euro != CF_ISEURO &&
 
			BASE_YEAR + _cur_year >= _currency_specs[_opt.currency].to_euro) {
 
			_cur_year >= _currency_specs[_opt.currency].to_euro) {
 
		_opt.currency = 2; // this is the index of euro above.
 
		AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL, 0, NT_ECONOMY, 0), 0, 0);
 
	}
 
}
 

	
date.c
Show inline comments
 
@@ -79,74 +79,75 @@ void ConvertDateToYMD(Date date, YearMon
 

	
 
	yr *= 4;
 

	
 
	if (rem >= 366) {
 
		rem--;
 
		do {
 
			rem -= 365;
 
			yr++;
 
		} while (rem >= 365);
 
		if (rem >= 31 + 28) rem++;
 
	}
 

	
 
	ymd->year = yr;
 
	ymd->year = BASE_YEAR + yr;
 

	
 
	x = _month_date_from_year_day[rem];
 
	ymd->month = x >> 5;
 
	ymd->day = x & 0x1F;
 
}
 

	
 
/**
 
 * Converts a tupe of Year, Month and Day to a Date.
 
 * @param year  is a number between 0..?
 
 * @param month is a number between 0..11
 
 * @param day   is a number between 1..31
 
 */
 
Date ConvertYMDToDate(Year year, Month month, Day day)
 
{
 
	uint rem;
 
	uint yr = year - BASE_YEAR;
 

	
 
	/* day in the year */
 
	rem = _accum_days_for_month[month] + day - 1;
 

	
 
	/* remove feb 29 from year 1,2,3 */
 
	if (year & 3) rem += (year & 3) * 365 + (rem < 31 + 29);
 
	if (yr & 3) rem += (yr & 3) * 365 + (rem < 31 + 29);
 

	
 
	/* base date. */
 
	return (year >> 2) * (365 + 365 + 365 + 366) + rem;
 
	return (yr >> 2) * (365 + 365 + 365 + 366) + rem;
 
}
 

	
 
/**
 
 * Convert a date on the form:
 
 * 1920 - 2090 (MAX_YEAR_END_REAL)
 
 * 192001 - 209012
 
 * 19200101 - 20901231
 
 * or if > 2090 and below 65536, treat it as a daycount.
 
 * @return -1 if no conversion was possible
 
 */
 
Date ConvertIntDate(uint date)
 
{
 
	Year  year;
 
	Month month = 0;
 
	Day   day   = 1;
 

	
 
	if (IS_INT_INSIDE(date, 1920, MAX_YEAR + 1)) {
 
		year = date - 1920;
 
		year = date;
 
	} else if (IS_INT_INSIDE(date, 192001, 209012 + 1)) {
 
		month = date % 100 - 1;
 
		year = date / 100 - 1920;
 
		year = date / 100;
 
	} else if (IS_INT_INSIDE(date, 19200101, 20901231 + 1)) {
 
		day = date % 100; date /= 100;
 
		month = date % 100 - 1;
 
		year = date / 100 - 1920;
 
		year = date / 100;
 
	} else if (IS_INT_INSIDE(date, 2091, 65536)) {
 
		return date;
 
	} else {
 
		return (Date)-1;
 
	}
 

	
 
	/* invalid ranges? */
 
	if (month >= 12 || !IS_INT_INSIDE(day, 1, 31 + 1)) return (Date)-1;
 

	
 
	return ConvertYMDToDate(year, month, day);
 
}
 

	
 
@@ -273,28 +274,28 @@ void IncreaseDate(void)
 

	
 
	/* yes, call various yearly loops */
 
	PlayersYearlyLoop();
 
	TrainsYearlyLoop();
 
	RoadVehiclesYearlyLoop();
 
	AircraftYearlyLoop();
 
	ShipsYearlyLoop();
 
#ifdef ENABLE_NETWORK
 
	if (_network_server) NetworkServerYearlyLoop();
 
#endif /* ENABLE_NETWORK */
 

	
 
	/* check if we reached end of the game */
 
	if (_cur_year == _patches.ending_year - MAX_YEAR) {
 
	if (_cur_year == _patches.ending_year) {
 
			ShowEndGameChart();
 
	/* check if we reached the maximum year, decrement dates by a year */
 
	} else if (BASE_YEAR + _cur_year == MAX_YEAR + 1) {
 
	} else if (_cur_year == MAX_YEAR + 1) {
 
		Vehicle *v;
 

	
 
		_cur_year--;
 
		_date -= 365;
 
		FOR_ALL_VEHICLES(v) {
 
			v->date_of_last_service -= 365;
 
		}
 

	
 
		/* Because the _date wraps here, and text-messages expire by game-days, we have to clean out
 
		 *  all of them if the date is set back, else those messages will hang for ever */
 
		InitTextMessage();
 
	}
disaster_cmd.c
Show inline comments
 
@@ -942,51 +942,48 @@ static void Disaster7_Init(void)
 

	
 
static DisasterInitProc * const _disaster_initprocs[] = {
 
	Disaster0_Init,
 
	Disaster1_Init,
 
	Disaster2_Init,
 
	Disaster3_Init,
 
	Disaster4_Init,
 
	Disaster5_Init,
 
	Disaster6_Init,
 
	Disaster7_Init,
 
};
 

	
 
#define MK(a, b) { (a) - BASE_YEAR, (b) - BASE_YEAR }
 
static const struct {
 
	byte min;
 
	byte max;
 
	Year min;
 
	Year max;
 
} _dis_years[] = {
 
	MK(1930, 1955),
 
	MK(1940, 1970),
 
	MK(1960, 1990),
 
	MK(1970, 2000),
 
	MK(2000, 2100),
 
	MK(1940, 1965),
 
	MK(1975, 2010),
 
	MK(1950, 1985)
 
	{ 1930, 1955 },
 
	{ 1940, 1970 },
 
	{ 1960, 1990 },
 
	{ 1970, 2000 },
 
	{ 2000, 2100 },
 
	{ 1940, 1965 },
 
	{ 1975, 2010 },
 
	{ 1950, 1985 }
 
};
 
#undef MK
 

	
 

	
 
static void DoDisaster(void)
 
{
 
	byte buf[lengthof(_dis_years)];
 
	byte year = _cur_year;
 
	uint i;
 
	uint j;
 

	
 
	j = 0;
 
	for (i = 0; i != lengthof(_dis_years); i++) {
 
		if (year >= _dis_years[i].min && year < _dis_years[i].max) buf[j++] = i;
 
		if (_cur_year >= _dis_years[i].min && _cur_year < _dis_years[i].max) buf[j++] = i;
 
	}
 

	
 
	if (j == 0) return;
 

	
 
	_disaster_initprocs[buf[RandomRange(j)]]();
 
}
 

	
 

	
 
static void ResetDisasterDelay(void)
 
{
 
	_disaster_delay = GB(Random(), 0, 9) + 730;
 
}
economy.c
Show inline comments
 
@@ -1385,25 +1385,25 @@ int LoadUnloadVehicle(Vehicle *v)
 
		if (u->current_order.flags & OF_UNLOAD) continue;
 

	
 
		/* update stats */
 
		ge->days_since_pickup = 0;
 
		switch (u->type) {
 
			case VEH_Train: t = u->u.rail.cached_max_speed; break;
 
			case VEH_Road:  t = u->max_speed / 2;           break;
 
			default:        t = u->max_speed;               break;
 
		}
 

	
 
		// if last speed is 0, we treat that as if no vehicle has ever visited the station.
 
		ge->last_speed = min(t, 255);
 
		ge->last_age = _cur_year - v->build_year;
 
		ge->last_age = (_cur_year - BASE_YEAR) - v->build_year;
 

	
 
		// If there's goods waiting at the station, and the vehicle
 
		//  has capacity for it, load it on the vehicle.
 
		count = GB(ge->waiting_acceptance, 0, 12);
 
		if (count != 0 &&
 
				(cap = v->cargo_cap - v->cargo_count) != 0) {
 
			int cargoshare;
 
			int feeder_profit_share;
 

	
 
			if (v->cargo_count == 0)
 
				TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO);
 

	
 
@@ -1473,25 +1473,25 @@ int LoadUnloadVehicle(Vehicle *v)
 

	
 
			ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, -profit);
 
		}
 
	}
 

	
 
	_current_player = old_player;
 
	return result;
 
}
 

	
 
void PlayersMonthlyLoop(void)
 
{
 
	PlayersGenStatistics();
 
	if (_patches.inflation && BASE_YEAR + _cur_year < MAX_YEAR)
 
	if (_patches.inflation && _cur_year < MAX_YEAR)
 
		AddInflation();
 
	PlayersPayInterest();
 
	// Reset the _current_player flag
 
	_current_player = OWNER_NONE;
 
	HandleEconomyFluctuations();
 
	SubsidyMonthlyHandler();
 
}
 

	
 
static void DoAcquireCompany(Player *p)
 
{
 
	Player *owner;
 
	int i,pi;
 
@@ -1537,25 +1537,25 @@ extern int GetAmountOwnedBy(Player *p, b
 
int32 CmdBuyShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 
{
 
	Player *p;
 
	int64 cost;
 

	
 
	/* Check if buying shares is allowed (protection against modified clients */
 
	if (p1 >= MAX_PLAYERS || !_patches.allow_shares) return CMD_ERROR;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_OTHER);
 
	p = GetPlayer(p1);
 

	
 
	/* Protect new companies from hostile takeovers */
 
	if (_cur_year - p->inaugurated_year < 6) return_cmd_error(STR_7080_PROTECTED);
 
	if ((_cur_year - BASE_YEAR) - p->inaugurated_year < 6) return_cmd_error(STR_7080_PROTECTED);
 

	
 
	/* Those lines are here for network-protection (clients can be slow) */
 
	if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) return 0;
 

	
 
	/* We can not buy out a real player (temporarily). TODO: well, enable it obviously */
 
	if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai) return 0;
 

	
 
	cost = CalculateCompanyValue(p) >> 2;
 
	if (flags & DC_EXEC) {
 
		PlayerID* b = p->share_owners;
 
		int i;
 

	
engine.c
Show inline comments
 
@@ -229,25 +229,25 @@ static PlayerID GetBestPlayer(PlayerID p
 
		if (best_player == OWNER_SPECTATOR) return OWNER_SPECTATOR;
 

	
 
		SETBIT(mask, best_player);
 
	} while (--pp != 0);
 

	
 
	return best_player;
 
}
 

	
 
void EnginesDailyLoop(void)
 
{
 
	EngineID i;
 

	
 
	if (_cur_year >= 130) return;
 
	if (_cur_year >= 2050) return;
 

	
 
	for (i = 0; i != lengthof(_engines); i++) {
 
		Engine *e = &_engines[i];
 

	
 
		if (e->flags & ENGINE_INTRODUCING) {
 
			if (e->flags & ENGINE_PREVIEWING) {
 
				if (e->preview_player != 0xFF && !--e->preview_wait) {
 
					e->flags &= ~ENGINE_PREVIEWING;
 
					DeleteWindowById(WC_ENGINE_PREVIEW, i);
 
					e->preview_player++;
 
				}
 
			} else if (e->preview_player != 0xFF) {
 
@@ -350,25 +350,25 @@ static void NewVehicleAvailable(Engine *
 
		AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_ROADAVAIL), 0, 0);
 
	} else if (index < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) {
 
		AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_SHIPAVAIL), 0, 0);
 
	} else {
 
		AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_AIRCRAFTAVAIL), 0, 0);
 
	}
 
}
 

	
 
void EnginesMonthlyLoop(void)
 
{
 
	Engine *e;
 

	
 
	if (_cur_year < 130) {
 
	if (_cur_year < 2050) {
 
		for (e = _engines; e != endof(_engines); e++) {
 
			// Age the vehicle
 
			if (e->flags & ENGINE_AVAILABLE && e->age != 0xFFFF) {
 
				e->age++;
 
				CalcEngineReliability(e);
 
			}
 

	
 
			if (!(e->flags & ENGINE_AVAILABLE) && _date >= (e->intro_date + 365)) {
 
				// Introduce it to all players
 
				NewVehicleAvailable(e);
 
			} else if (!(e->flags & (ENGINE_AVAILABLE|ENGINE_INTRODUCING)) && _date >= e->intro_date) {
 
				// Introduction date has passed.. show introducing dialog to one player.
graph_gui.c
Show inline comments
 
@@ -21,25 +21,25 @@ static uint _legend_cargobits;
 

	
 
/************************/
 
/* GENERIC GRAPH DRAWER */
 
/************************/
 

	
 
enum {GRAPH_NUM = 16};
 

	
 
typedef struct GraphDrawer {
 
	uint sel; // bitmask of the players *excluded* (e.g. 11111111 means that no players are shown)
 
	byte num_dataset;
 
	byte num_on_x_axis;
 
	byte month;
 
	byte year;
 
	Year year;
 
	bool include_neg;
 
	byte num_vert_lines;
 
	uint16 unk61A;
 
	uint16 unk61C;
 
	int left, top;
 
	uint height;
 
	StringID format_str_y_axis;
 
	byte color_3, color_2, bg_line_color;
 
	byte colors[GRAPH_NUM];
 
	uint64 cost[GRAPH_NUM][24]; // last 2 years
 
} GraphDrawer;
 

	
 
@@ -142,25 +142,25 @@ static void DrawGraph(const GraphDrawer 
 
		SetDParam(0, gw->format_str_y_axis);
 
		SetDParam64(1, (int64)tmp);
 
		tmp -= (value >> 3);
 
		DrawStringRightAligned(x, y, STR_0170, gw->color_3);
 
		y += gw->height >> 3;
 
	} while (--i);
 

	
 
	/* draw strings on the x axis */
 
	if (gw->month != 0xFF) {
 
		x = gw->left + 44;
 
		y = gw->top + gw->height + 1;
 
		j = gw->month;
 
		k = BASE_YEAR + gw->year;
 
		k = gw->year;
 
		i = gw->num_on_x_axis;assert(i>0);
 
		do {
 
			SetDParam(2, k);
 
			SetDParam(0, j + STR_0162_JAN);
 
			SetDParam(1, j + STR_0162_JAN + 2);
 
			DrawString(x, y, j == 0 ? STR_016F : STR_016E, gw->color_3);
 

	
 
			j += 3;
 
			if (j >= 12) {
 
				j = 0;
 
				k++;
 
			}
industry_cmd.c
Show inline comments
 
@@ -1321,25 +1321,25 @@ static void DoCreateNewIndustry(Industry
 
	i->counter = GB(r, 0, 12);
 
	i->cargo_waiting[0] = 0;
 
	i->cargo_waiting[1] = 0;
 
	i->last_mo_production[0] = 0;
 
	i->last_mo_production[1] = 0;
 
	i->last_mo_transported[0] = 0;
 
	i->last_mo_transported[1] = 0;
 
	i->pct_transported[0] = 0;
 
	i->pct_transported[1] = 0;
 
	i->total_transported[0] = 0;
 
	i->total_transported[1] = 0;
 
	i->was_cargo_delivered = false;
 
	i->last_prod_year = _cur_year;
 
	i->last_prod_year = _cur_year - BASE_YEAR;
 
	i->total_production[0] = i->production_rate[0] * 8;
 
	i->total_production[1] = i->production_rate[1] * 8;
 

	
 
	if (!_generating_world) i->total_production[0] = i->total_production[1] = 0;
 

	
 
	i->prod_level = 0x10;
 

	
 
	do {
 
		TileIndex cur_tile = tile + ToTileIndexDiff(it->ti);
 

	
 
		if (it->gfx != 0xFF) {
 
			byte size;
 
@@ -1522,25 +1522,25 @@ void GenerateIndustries(void)
 
/* Change industry production or do closure */
 
static void ExtChangeIndustryProduction(Industry *i)
 
{
 
	bool closeit = true;
 
	int j;
 
	const IndustrySpec *indspec = GetIndustrySpec(i->type);
 

	
 
	switch (_industry_close_mode[i->type]) {
 
		case INDUSTRYLIFE_NOT_CLOSABLE:
 
			return;
 

	
 
		case INDUSTRYLIFE_CLOSABLE:
 
			if ((byte)(_cur_year - i->last_prod_year) < 5 || !CHANCE16(1, 180))
 
			if ((byte)((_cur_year - BASE_YEAR) - i->last_prod_year) < 5 || !CHANCE16(1, 180))
 
				closeit = false;
 
			break;
 

	
 
		default: /* INDUSTRY_PRODUCTION */
 
			for (j = 0; j < 2 && i->produced_cargo[j] != CT_INVALID; j++){
 
				uint32 r = Random();
 
				int old, new, percent;
 
				int mag;
 

	
 
				new = old = i->production_rate[j];
 
				if (CHANCE16I(20, 1024, r))
 
					new -= ((RandomRange(50) + 10) * old) >> 8;
 
@@ -1585,40 +1585,40 @@ static void ExtChangeIndustryProduction(
 
		);
 
	}
 
}
 

	
 

	
 
static void UpdateIndustryStatistics(Industry *i)
 
{
 
	byte pct;
 

	
 
	if (i->produced_cargo[0] != CT_INVALID) {
 
		pct = 0;
 
		if (i->last_mo_production[0] != 0) {
 
			i->last_prod_year = _cur_year;
 
			i->last_prod_year = _cur_year - BASE_YEAR;
 
			pct = min(i->last_mo_transported[0] * 256 / i->last_mo_production[0],255);
 
		}
 
		i->pct_transported[0] = pct;
 

	
 
		i->total_production[0] = i->last_mo_production[0];
 
		i->last_mo_production[0] = 0;
 

	
 
		i->total_transported[0] = i->last_mo_transported[0];
 
		i->last_mo_transported[0] = 0;
 
	}
 

	
 
	if (i->produced_cargo[1] != CT_INVALID) {
 
		pct = 0;
 
		if (i->last_mo_production[1] != 0) {
 
			i->last_prod_year = _cur_year;
 
			i->last_prod_year = _cur_year - BASE_YEAR;
 
			pct = min(i->last_mo_transported[1] * 256 / i->last_mo_production[1],255);
 
		}
 
		i->pct_transported[1] = pct;
 

	
 
		i->total_production[1] = i->last_mo_production[1];
 
		i->last_mo_production[1] = 0;
 

	
 
		i->total_transported[1] = i->last_mo_transported[1];
 
		i->last_mo_transported[1] = 0;
 
	}
 

	
 

	
 
@@ -1712,25 +1712,25 @@ static void ChangeIndustryProduction(Ind
 
						i->prod_level >>= 1;
 
						i->production_rate[0] = (i->production_rate[0] + 1) >> 1;
 
						i->production_rate[1] = (i->production_rate[1] + 1) >> 1;
 

	
 
						str = indspec->production_down_text;
 
					}
 
				}
 
			}
 
			break;
 

	
 
		case INDUSTRYLIFE_CLOSABLE:
 
			/* maybe close */
 
			if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1,2)) {
 
			if ( (byte)((_cur_year - BASE_YEAR) - i->last_prod_year) >= 5 && CHANCE16(1,2)) {
 
				i->prod_level = 0;
 
				str = indspec->closure_text;
 
			}
 
			break;
 
	}
 

	
 
	if (str != STR_NULL) {
 
		SetDParam(0, i->index);
 
		AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
 
	}
 
}
 

	
misc_gui.c
Show inline comments
 
@@ -1668,25 +1668,25 @@ static int32 ClickChangeClimateCheat(int
 
	MarkWholeScreenDirty();
 
	return _opt.landscape;
 
}
 

	
 
extern void EnginesMonthlyLoop(void);
 

	
 
// p2 1 (increase) or -1 (decrease)
 
static int32 ClickChangeDateCheat(int32 p1, int32 p2)
 
{
 
	YearMonthDay ymd;
 
	ConvertDateToYMD(_date, &ymd);
 

	
 
	if ((BASE_YEAR + ymd.year == MIN_YEAR && p2 == -1) || (BASE_YEAR + ymd.year == MAX_YEAR && p2 == 1)) return _cur_year;
 
	if ((ymd.year == MIN_YEAR && p2 == -1) || (ymd.year == MAX_YEAR && p2 == 1)) return _cur_year;
 

	
 
	SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day));
 
	EnginesMonthlyLoop();
 
	SetWindowDirty(FindWindowById(WC_STATUS_BAR, 0));
 
	return _cur_year;
 
}
 

	
 
static int32 ClickAllowConvrail(int32 p1, int32 p2)
 
{
 
	Vehicle *v;
 
	SB(_railtypes[RAILTYPE_ELECTRIC].powered_railtypes, RAILTYPE_RAIL, 1, p1);
 

	
network.h
Show inline comments
 
@@ -197,25 +197,25 @@ VARDEF uint16 _network_udp_broadcast;
 

	
 
VARDEF byte _network_lan_internet;
 

	
 
VARDEF bool _network_advertise;
 
VARDEF bool _network_need_advertise;
 
VARDEF uint32 _network_last_advertise_frame;
 
VARDEF uint8 _network_advertise_retries;
 

	
 
VARDEF bool _network_autoclean_companies;
 
VARDEF uint8 _network_autoclean_unprotected; // Remove a company after X months
 
VARDEF uint8 _network_autoclean_protected;   // Unprotect a company after X months
 

	
 
VARDEF uint16 _network_restart_game_year;    // If this year is reached, the server automaticly restarts
 
VARDEF Year _network_restart_game_year;      // If this year is reached, the server automaticly restarts
 

	
 
NetworkGameList *NetworkQueryServer(const char* host, unsigned short port, bool game_info);
 

	
 
byte NetworkSpectatorCount(void);
 

	
 
VARDEF char *_network_host_list[10];
 
VARDEF char *_network_ban_list[25];
 

	
 
void ParseConnectionString(const char **player, const char **port, char *connection_string);
 
void NetworkUpdateClientInfo(uint16 client_index);
 
void NetworkAddServer(const char *b);
 
void NetworkRebuildHostList(void);
network_server.c
Show inline comments
 
@@ -1199,25 +1199,25 @@ void NetworkPopulateCompanyInfo(void)
 
		ttd_strlcpy(password, _network_player_info[p->index].password, sizeof(password));
 
		months_empty = _network_player_info[p->index].months_empty;
 
		memset(&_network_player_info[p->index], 0, sizeof(NetworkPlayerInfo));
 
		_network_player_info[p->index].months_empty = months_empty;
 
		ttd_strlcpy(_network_player_info[p->index].password, password, sizeof(_network_player_info[p->index].password));
 

	
 
		// Grap the company name
 
		SetDParam(0, p->name_1);
 
		SetDParam(1, p->name_2);
 
		GetString(_network_player_info[p->index].company_name, STR_JUST_STRING);
 

	
 
		// Check the income
 
		if (_cur_year - 1 == p->inaugurated_year) {
 
		if (_cur_year - 1 == BASE_YEAR + p->inaugurated_year) {
 
			// The player is here just 1 year, so display [2], else display[1]
 
			for (i = 0; i < 13; i++) {
 
				_network_player_info[p->index].income -= p->yearly_expenses[2][i];
 
			}
 
		} else {
 
			for (i = 0; i < 13; i++) {
 
				_network_player_info[p->index].income -= p->yearly_expenses[1][i];
 
			}
 
		}
 

	
 
		// Set some general stuff
 
		_network_player_info[p->index].inaugurated_year = p->inaugurated_year;
 
@@ -1304,26 +1304,26 @@ void NetworkUpdateClientInfo(uint16 clie
 
	if (ci == NULL) return;
 

	
 
	FOR_ALL_CLIENTS(cs) {
 
		SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, ci);
 
	}
 
}
 

	
 
extern void SwitchMode(int new_mode);
 

	
 
/* Check if we want to restart the map */
 
static void NetworkCheckRestartMap(void)
 
{
 
	if (_network_restart_game_year != 0 && BASE_YEAR + _cur_year >= _network_restart_game_year) {
 
		DEBUG(net, 0)("Auto-restarting map. Year %d reached.", BASE_YEAR + _cur_year);
 
	if (_network_restart_game_year != 0 && _cur_year >= _network_restart_game_year) {
 
		DEBUG(net, 0)("Auto-restarting map. Year %d reached.", _cur_year);
 

	
 
		_random_seeds[0][0] = Random();
 
		_random_seeds[0][1] = InteractiveRandom();
 

	
 
		SwitchMode(SM_NEWGAME);
 
	}
 
}
 

	
 
/* Check if the server has autoclean_companies activated
 
    Two things happen:
 
      1) If a company is not protected, it is closed after 1 year (for example)
 
      2) If a company is protected, protection is disabled after 3 years (for example)
newgrf.c
Show inline comments
 
@@ -14,24 +14,25 @@
 
#include "station.h"
 
#include "sprite.h"
 
#include "newgrf.h"
 
#include "variables.h"
 
#include "string.h"
 
#include "table/strings.h"
 
#include "bridge.h"
 
#include "economy.h"
 
#include "newgrf_engine.h"
 
#include "vehicle.h"
 
#include "newgrf_text.h"
 
#include "table/sprites.h"
 
#include "date.h"
 

	
 
#include "newgrf_spritegroup.h"
 

	
 
/* TTDPatch extended GRF format codec
 
 * (c) Petr Baudis 2004 (GPL'd)
 
 * Changes by Florian octo Forster are (c) by the OpenTTD development team.
 
 *
 
 * Contains portions of documentation by TTDPatch team.
 
 * Thanks especially to Josef Drexler for the documentation as well as a lot
 
 * of help at #tycoon. Also thanks to Michael Blunck for is GRF files which
 
 * served as subject to the initial testing of this codec. */
 

	
 
@@ -997,25 +998,25 @@ static bool StationChangeInfo(uint stid,
 
	*bufp = buf;
 
	return ret;
 
}
 

	
 
static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int len)
 
{
 
	byte *buf = *bufp;
 
	int i;
 
	bool ret = false;
 

	
 
	switch (prop) {
 
		case 0x08: /* Year of availability */
 
			FOR_EACH_OBJECT _bridge[brid + i].avail_year = grf_load_byte(&buf);
 
			FOR_EACH_OBJECT _bridge[brid + i].avail_year = BASE_YEAR + grf_load_byte(&buf);
 
			break;
 

	
 
		case 0x09: /* Minimum length */
 
			FOR_EACH_OBJECT _bridge[brid + i].min_length = grf_load_byte(&buf);
 
			break;
 

	
 
		case 0x0A: /* Maximum length */
 
			FOR_EACH_OBJECT _bridge[brid + i].max_length = grf_load_byte(&buf);
 
			break;
 

	
 
		case 0x0B: /* Cost factor */
 
			FOR_EACH_OBJECT _bridge[brid + i].price = grf_load_byte(&buf);
 
@@ -1050,24 +1051,28 @@ static bool BridgeChangeInfo(uint brid, 
 
					}
 

	
 
					for (sprite = 0; sprite < 32; sprite++)
 
						bridge->sprite_table[tableid][sprite] = grf_load_dword(&buf);
 
				}
 
			}
 
			break;
 

	
 
		case 0x0E: /* Flags; bit 0 - disable far pillars */
 
			FOR_EACH_OBJECT _bridge[brid + i].flags = grf_load_byte(&buf);
 
			break;
 

	
 
		case 0x0F: /* Long year -- must be set after property 8 */
 
			FOR_EACH_OBJECT _bridge[brid + i].avail_year = grf_load_word(&buf);
 
			break;
 

	
 
		default:
 
			ret = true;
 
	}
 

	
 
	*bufp = buf;
 
	return ret;
 
}
 

	
 
static bool GlobalVarChangeInfo(uint gvid, int numinfo, int prop, byte **bufp, int len)
 
{
 
	byte *buf = *bufp;
 
	int i;
newgrf_engine.c
Show inline comments
 
@@ -544,25 +544,25 @@ static uint32 GetGRFParameter(EngineID e
 

	
 

	
 
static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
 
{
 
	const Vehicle *v = GRV(object);
 

	
 
	if (v == NULL) {
 
		/* Vehicle does not exist, so we're in a purchase list */
 
		switch (variable) {
 
			case 0x43: return _current_player; /* Owner information */
 
			case 0x46: return 0;               /* Motion counter */
 
			case 0x48: return GetVehicleTypeInfo(object->u.vehicle.self_type); /* Vehicle Type Info */
 
			case 0xC4: return _cur_year;       /* Build year */
 
			case 0xC4: return clamp(_cur_year, BASE_YEAR, MAX_YEAR) - BASE_YEAR; /* Build year */
 
			case 0xDA: return INVALID_VEHICLE; /* Next vehicle */
 
			case 0x7F: return GetGRFParameter(object->u.vehicle.self_type, parameter); /* Read GRF parameter */
 
		}
 

	
 
		*available = false;
 
		return -1;
 
	}
 

	
 
	/* Calculated vehicle parameters */
 
	switch (variable) {
 
		case 0x40: /* Get length of consist */
 
		case 0x41: /* Get length of same consecutive wagons */
newgrf_spritegroup.c
Show inline comments
 
@@ -67,25 +67,25 @@ void InitializeSpriteGroupPool(void)
 
{
 
	CleanPool(&_spritegroup_pool);
 

	
 
	_spritegroup_count = 0;
 
}
 

	
 

	
 
static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
 
{
 
	/* Return common variables */
 
	switch (variable) {
 
		case 0x00: return _date;
 
		case 0x01: return _cur_year;
 
		case 0x01: return clamp(_cur_year, BASE_YEAR, MAX_YEAR) - BASE_YEAR;
 
		case 0x02: return _cur_month;
 
		case 0x03: return _opt.landscape;
 
		case 0x09: return _date_fract;
 
		case 0x0A: return _tick_counter;
 
		case 0x0C: return object->callback;
 
		case 0x10: return object->callback_param1;
 
		case 0x11: return 0;
 
		case 0x18: return object->callback_param2;
 
		case 0x1A: return -1;
 
		case 0x1B: return GB(_display_opt, 0, 6);
 
		case 0x1C: return object->last_value;
 
		case 0x20: return _opt.landscape == LT_HILLY ? _opt.snow_line : 0xFF;
news_gui.c
Show inline comments
 
@@ -249,25 +249,25 @@ void AddNewsItem(StringID string, uint32
 
	if (_oldest_news == _latest_news && _news_items[_oldest_news].string_id != 0)
 
		_oldest_news = increaseIndex(_oldest_news); // but make sure we're not overflowing here
 

	
 
	// add news to _latest_news
 
	ni = &_news_items[_latest_news];
 
	memset(ni, 0, sizeof(*ni));
 

	
 
	ni->string_id = string;
 
	ni->display_mode = (byte)flags;
 
	ni->flags = (byte)(flags >> 8) | NF_NOEXPIRE;
 

	
 
	// show this news message in color?
 
	if (_date >= ConvertIntDate(_patches.colored_news_year))
 
	if (_cur_year >= _patches.colored_news_year)
 
		ni->flags |= NF_INCOLOR;
 

	
 
	ni->type = (byte)(flags >> 16);
 
	ni->callback = (byte)(flags >> 24);
 
	ni->data_a = data_a;
 
	ni->data_b = data_b;
 
	ni->date = _date;
 
	COPY_OUT_DPARAM(ni->params, 0, lengthof(ni->params));
 

	
 
	w = FindWindowById(WC_MESSAGE_HISTORY, 0);
 
	if (w == NULL) return;
 
	SetWindowDirty(w);
openttd.c
Show inline comments
 
@@ -307,25 +307,25 @@ static void LoadIntroGame(void)
 

	
 
#if defined(UNIX) && !defined(__MORPHOS__)
 
extern void DedicatedFork(void);
 
#endif
 

	
 
int ttd_main(int argc, char *argv[])
 
{
 
	MyGetOptData mgo;
 
	int i;
 
	const char *optformat;
 
	char musicdriver[16], sounddriver[16], videodriver[16];
 
	int resolution[2] = {0,0};
 
	uint startyear = -1;
 
	Year startyear = INVALID_YEAR;
 

	
 
	bool dedicated = false;
 
	bool network   = false;
 
	char *network_conn = NULL;
 

	
 
	musicdriver[0] = sounddriver[0] = videodriver[0] = 0;
 

	
 
	_game_mode = GM_MENU;
 
	_switch_mode = SM_MENU;
 
	_switch_mode_errorstr = INVALID_STRING_ID;
 
	_dedicated_forks = false;
 
	_config_file = NULL;
 
@@ -399,25 +399,25 @@ int ttd_main(int argc, char *argv[])
 
		DedicatedFork();
 
#endif
 

	
 
	LoadFromConfig();
 
	CheckConfig();
 
	LoadFromHighScore();
 

	
 
	// override config?
 
	if (musicdriver[0]) ttd_strlcpy(_ini_musicdriver, musicdriver, sizeof(_ini_musicdriver));
 
	if (sounddriver[0]) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver));
 
	if (videodriver[0]) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver));
 
	if (resolution[0]) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; }
 
	if (startyear != (uint)-1) _patches_newgame.starting_year = startyear;
 
	if (startyear != INVALID_YEAR) _patches_newgame.starting_year = startyear;
 

	
 
	if (_dedicated_forks && !dedicated) _dedicated_forks = false;
 

	
 
	// enumerate language files
 
	InitializeLanguagePacks();
 

	
 
	// initialize screenshot formats
 
	InitializeScreenshotFormats();
 

	
 
	// initialize airport state machines
 
	InitializeAirports();
 

	
openttd.h
Show inline comments
 
@@ -43,25 +43,30 @@ typedef byte OrderID;
 
typedef byte CargoID;
 
typedef byte LandscapeID;
 
typedef uint16 StringID;
 
typedef uint32 SpriteID;    ///< The number of a sprite, without mapping bits and colortables
 
typedef uint32 PalSpriteID; ///< The number of a sprite plus all the mapping bits and colortables
 
typedef uint32 CursorID;
 
typedef uint16 EngineID; ///< All enginenumbers should be of this type
 
typedef uint16 UnitID;   ///< All unitnumber stuff is of this type (or anyway, should be)
 

	
 
typedef uint32 WindowNumber;
 
typedef byte WindowClass;
 

	
 
typedef uint8  Year;
 
enum {
 
	INVALID_YEAR = -1,
 
	INVALID_DATE = (uint16)-1,
 
};
 

	
 
typedef int16  Year;
 
typedef uint16 Date;
 

	
 

	
 
enum GameModes {
 
	GM_MENU,
 
	GM_NORMAL,
 
	GM_EDITOR
 
};
 

	
 
enum SwitchModes {
 
	SM_NONE = 0,
 
	SM_NEWGAME = 1,
player_gui.c
Show inline comments
 
@@ -37,26 +37,26 @@ static void DrawPlayerEconomyStats(const
 
		/* draw categories */
 
		DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, 0);
 
		for (i = 0; i != 13; i++)
 
			DrawString(2, 27 + i*10, STR_7011_CONSTRUCTION + i, 0);
 
		DrawStringRightAligned(111, 27 + 10*13 + 2, STR_7020_TOTAL, 0);
 

	
 
		/* draw the price columns */
 
		year = _cur_year - 2;
 
		j = 3;
 
		x = 215;
 
		tbl = p->yearly_expenses + 2;
 
		do {
 
			if (year >= p->inaugurated_year) {
 
				SetDParam(0, BASE_YEAR + year);
 
			if (year >= BASE_YEAR + p->inaugurated_year) {
 
				SetDParam(0, year);
 
				DrawStringCenterUnderline(x-17, 15, STR_7010, 0);
 
				sum = 0;
 
				for (i = 0; i != 13; i++) {
 
					/* draw one row in the price column */
 
					cost = (*tbl)[i];
 
					if (cost != 0) {
 
						sum += cost;
 

	
 
						str = STR_701E;
 
						if (cost < 0) { cost = -cost; str++; }
 
						SetDParam64(0, cost);
 
						DrawStringRightAligned(x, 27+i*10, str, 0);
players.c
Show inline comments
 
@@ -481,25 +481,25 @@ Player *DoStartupNewPlayer(bool is_ai)
 
	p->player_color = GeneratePlayerColor();
 
	_player_colors[p->index] = p->player_color;
 
	p->name_1 = STR_SV_UNNAMED;
 
	p->is_active = true;
 

	
 
	p->money64 = p->player_money = p->current_loan = 100000;
 

	
 
	p->is_ai = is_ai;
 
	p->ai.state = 5; /* AIS_WANT_NEW_ROUTE */
 
	p->share_owners[0] = p->share_owners[1] = p->share_owners[2] = p->share_owners[3] = OWNER_SPECTATOR;
 

	
 
	p->avail_railtypes = GetPlayerRailtypes(p->index);
 
	p->inaugurated_year = _cur_year;
 
	p->inaugurated_year = _cur_year - BASE_YEAR;
 
	p->face = Random();
 

	
 
	/* Engine renewal settings */
 
	p->engine_renew_list = NULL;
 
	p->renew_keep_length = false;
 
	p->engine_renew = false;
 
	p->engine_renew_months = -6;
 
	p->engine_renew_money = 100000;
 

	
 
	GeneratePresidentName(p);
 

	
 
	InvalidateWindow(WC_GRAPH_LEGEND, 0);
roadveh_cmd.c
Show inline comments
 
@@ -175,25 +175,25 @@ int32 CmdBuildRoadVeh(TileIndex tile, ui
 

	
 
		e = GetEngine(p1);
 
		v->reliability = e->reliability;
 
		v->reliability_spd_dec = e->reliability_spd_dec;
 
		v->max_age = e->lifelength * 366;
 
		_new_vehicle_id = v->index;
 

	
 
		v->string_id = STR_SV_ROADVEH_NAME;
 

	
 
		v->service_interval = _patches.servint_roadveh;
 

	
 
		v->date_of_last_service = _date;
 
		v->build_year = _cur_year;
 
		v->build_year = _cur_year - BASE_YEAR;
 

	
 
		v->type = VEH_Road;
 
		v->cur_image = 0xC15;
 
		v->random_bits = VehicleRandomBits();
 

	
 
		VehiclePositionChanged(v);
 

	
 
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 
		RebuildVehicleLists();
 
		InvalidateWindow(WC_COMPANY, v->owner);
 
		if (IsLocalPlayer())
 
			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road); // updates the replace Road window
roadveh_gui.c
Show inline comments
 
@@ -45,25 +45,25 @@ void DrawRoadVehPurchaseInfo(int x, int 
 
	SetDParam(0, rvi->running_cost * _price.roadveh_running >> 8);
 
	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 
	y += 10;
 

	
 
	/* Cargo type + capacity */
 
	SetDParam(0, _cargoc.names_long[rvi->cargo_type]);
 
	SetDParam(1, rvi->capacity);
 
	SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
 
	DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
 
	y += 10;
 

	
 
	/* Design date - Life length */
 
	SetDParam(0, BASE_YEAR + ymd.year);
 
	SetDParam(0, ymd.year);
 
	SetDParam(1, e->lifelength);
 
	DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
 
	y += 10;
 

	
 
	/* Reliability */
 
	SetDParam(0, e->reliability * 100 >> 16);
 
	DrawString(x, y, STR_PURCHASE_INFO_RELIABILITY, 0);
 
	y += 10;
 

	
 
	/* Additional text from NewGRF */
 
	// XXX 227 will become a calculated width...
 
	y += ShowAdditionalText(x, y, 227, engine_number);
settings.c
Show inline comments
 
@@ -1197,25 +1197,25 @@ static const SettingDescGlobVarList _net
 
	 SDTG_VAR("server_port",         SLE_UINT16, S, 0, _network_server_port,          NETWORK_DEFAULT_PORT, 0, 65535,STR_NULL, NULL),
 
	SDTG_BOOL("server_advertise",                S, 0, _network_advertise,            false,       STR_NULL, NULL),
 
	 SDTG_VAR("lan_internet",         SLE_UINT8, S, 0, _network_lan_internet,           0, 0,    1,STR_NULL, NULL),
 
	 SDTG_STR("player_name",           SLE_STRB, S, 0, _network_player_name,          NULL,        STR_NULL, NULL),
 
	 SDTG_STR("server_password",       SLE_STRB, S, 0, _network_server_password,      NULL,        STR_NULL, NULL),
 
	 SDTG_STR("rcon_password",         SLE_STRB, S, 0, _network_rcon_password,        NULL,        STR_NULL, NULL),
 
	 SDTG_STR("server_name",           SLE_STRB, S, 0, _network_server_name,          NULL,        STR_NULL, NULL),
 
	 SDTG_STR("connect_to_ip",         SLE_STRB, S, 0, _network_default_ip,           NULL,        STR_NULL, NULL),
 
	 SDTG_STR("network_id",            SLE_STRB, S, 0, _network_unique_id,            NULL,        STR_NULL, NULL),
 
	SDTG_BOOL("autoclean_companies",             S, 0, _network_autoclean_companies,  false,       STR_NULL, NULL),
 
	 SDTG_VAR("autoclean_unprotected",SLE_UINT8, S, 0, _network_autoclean_unprotected,12, 0,  60,  STR_NULL, NULL),
 
	 SDTG_VAR("autoclean_protected",  SLE_UINT8, S, 0, _network_autoclean_protected,  36, 0, 180,  STR_NULL, NULL),
 
	 SDTG_VAR("restart_game_year",   SLE_UINT16, S,D0, _network_restart_game_year,    0, MIN_YEAR, MAX_YEAR, STR_NULL, NULL),
 
	 SDTG_VAR("restart_game_year",    SLE_INT16, S,D0, _network_restart_game_year,    0, MIN_YEAR, MAX_YEAR, STR_NULL, NULL),
 
	 SDTG_END()
 
};
 
#endif /* ENABLE_NETWORK */
 

	
 
static const SettingDesc _gameopt_settings[] = {
 
	/* In version 4 a new difficulty setting has been added to the difficulty settings,
 
	 * town attitude towards demolishing. Needs special handling because some dimwit thought
 
	 * it funny to have the GameDifficulty struct be an array while it is a struct of
 
	 * same-sized members
 
	 * XXX - To save file-space and since values are never bigger than about 10? only
 
	 * save the first 16 bits in the savegame. Question is why the values are still int32
 
	 * and why not byte for example? */
 
@@ -1311,27 +1311,27 @@ const SettingDesc _patch_settings[] = {
 
	 SDT_VAR(Patches, station_spread,SLE_UINT8,0, 0, 12, 4,64,STR_CONFIG_PATCHES_STATION_SPREAD,     InvalidateStationBuildWindow),
 
	SDT_BOOL(Patches, serviceathelipad,        0, 0,  true,   STR_CONFIG_PATCHES_SERVICEATHELIPAD,   NULL),
 
	SDT_BOOL(Patches, modified_catchment,      0, 0,  true,   STR_CONFIG_PATCHES_CATCHMENT,          NULL),
 

	
 
	/***************************************************************************/
 
	/* Economy section of the GUI-configure patches window */
 
	SDT_BOOL(Patches, inflation,                  0, 0,  true,            STR_CONFIG_PATCHES_INFLATION,        NULL),
 
	SDT_BOOL(Patches, build_rawmaterial_ind,      0, 0, false,            STR_CONFIG_PATCHES_BUILDXTRAIND,     NULL),
 
	SDT_BOOL(Patches, multiple_industry_per_town, 0, 0, false,            STR_CONFIG_PATCHES_MULTIPINDTOWN,    NULL),
 
	SDT_BOOL(Patches, same_industry_close,        0, 0, false,            STR_CONFIG_PATCHES_SAMEINDCLOSE,     NULL),
 
	SDT_BOOL(Patches, bribe,                      0, 0,  true,            STR_CONFIG_PATCHES_BRIBE,            NULL),
 
	 SDT_VAR(Patches, snow_line_height,SLE_UINT8, 0, 0,     7,   2,   13, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT,  NULL),
 
	 SDT_VAR(Patches, colored_news_year,SLE_UINT, 0,NC,  2000, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,NULL),
 
	 SDT_VAR(Patches, starting_year,    SLE_UINT, 0,NC,  1950, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_STARTING_YEAR,NULL),
 
	 SDT_VAR(Patches, ending_year,      SLE_UINT,0,NC|NO,2051, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_ENDING_YEAR,  NULL),
 
	 SDT_VAR(Patches, colored_news_year,SLE_FILE_U32 | SLE_VAR_I16, 0,NC,  2000, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,NULL),
 
	 SDT_VAR(Patches, starting_year,    SLE_FILE_U32 | SLE_VAR_I16, 0,NC,  1950, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_STARTING_YEAR,NULL),
 
	 SDT_VAR(Patches, ending_year,      SLE_FILE_U32 | SLE_VAR_I16,0,NC|NO,2051, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_ENDING_YEAR,  NULL),
 
	SDT_BOOL(Patches, smooth_economy,             0, 0,  true,            STR_CONFIG_PATCHES_SMOOTH_ECONOMY,   NULL),
 
	SDT_BOOL(Patches, allow_shares,               0, 0,  true,            STR_CONFIG_PATCHES_ALLOW_SHARES,     NULL),
 

	
 
	/***************************************************************************/
 
	/* AI section of the GUI-configure patches window */
 
	SDT_BOOL(Patches, ainew_active,           0, 0, false, STR_CONFIG_PATCHES_AINEW_ACTIVE,      AiNew_PatchActive_Warning),
 
	SDT_BOOL(Patches, ai_in_multiplayer,      0, 0, false, STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER, Ai_In_Multiplayer_Warning),
 
	SDT_BOOL(Patches, ai_disable_veh_train,   0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_TRAINS,  NULL),
 
	SDT_BOOL(Patches, ai_disable_veh_roadveh, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH, NULL),
 
	SDT_BOOL(Patches, ai_disable_veh_aircraft,0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,NULL),
 
	SDT_BOOL(Patches, ai_disable_veh_ship,    0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_SHIPS,   NULL),
 

	
ship_cmd.c
Show inline comments
 
@@ -892,25 +892,25 @@ int32 CmdBuildShip(TileIndex tile, uint3
 

	
 
		e = GetEngine(p1);
 
		v->reliability = e->reliability;
 
		v->reliability_spd_dec = e->reliability_spd_dec;
 
		v->max_age = e->lifelength * 366;
 
		_new_vehicle_id = v->index;
 

	
 
		v->string_id = STR_SV_SHIP_NAME;
 
		v->u.ship.state = 0x80;
 

	
 
		v->service_interval = _patches.servint_ships;
 
		v->date_of_last_service = _date;
 
		v->build_year = _cur_year;
 
		v->build_year = _cur_year - BASE_YEAR;
 
		v->cur_image = 0x0E5E;
 
		v->type = VEH_Ship;
 
		v->random_bits = VehicleRandomBits();
 

	
 
		VehiclePositionChanged(v);
 

	
 
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 
		RebuildVehicleLists();
 
		InvalidateWindow(WC_COMPANY, v->owner);
 
		if (IsLocalPlayer())
 
			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Ship); // updates the replace Ship window
 
	}
ship_gui.c
Show inline comments
 
@@ -45,25 +45,25 @@ void DrawShipPurchaseInfo(int x, int y, 
 
	SetDParam(2, svi->refittable ? STR_9842_REFITTABLE : STR_EMPTY);
 
	DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
 
	y += 10;
 

	
 
	/* Running cost */
 
	SetDParam(0, svi->running_cost * _price.ship_running >> 8);
 
	DrawString(x,y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 
	y += 10;
 

	
 
	/* Design date - Life length */
 
	e = GetEngine(engine_number);
 
	ConvertDateToYMD(e->intro_date, &ymd);
 
	SetDParam(0, BASE_YEAR + ymd.year);
 
	SetDParam(0, ymd.year);
 
	SetDParam(1, e->lifelength);
 
	DrawString(x,y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
 
	y += 10;
 

	
 
	/* Reliability */
 
	SetDParam(0, e->reliability * 100 >> 16);
 
	DrawString(x,y, STR_PURCHASE_INFO_RELIABILITY, 0);
 
	y += 10;
 

	
 
	/* Additional text from NewGRF */
 
	// XXX 227 will become a calculated width...
 
	y += ShowAdditionalText(x, y, 227, engine_number);
strings.c
Show inline comments
 
@@ -330,46 +330,46 @@ static char *FormatYmdString(char *buff,
 
{
 
	const char *src;
 
	YearMonthDay ymd;
 

	
 
	ConvertDateToYMD(date, &ymd);
 

	
 
	for (src = GetStringPtr(ymd.day + STR_01AC_1ST - 1); (*buff++ = *src++) != '\0';) {}
 
	buff[-1] = ' ';
 

	
 
	for (src = GetStringPtr(STR_0162_JAN + ymd.month); (*buff++ = *src++) != '\0';) {}
 
	buff[-1] = ' ';
 

	
 
	return FormatNoCommaNumber(buff, BASE_YEAR + ymd.year);
 
	return FormatNoCommaNumber(buff, ymd.year);
 
}
 

	
 
static char *FormatMonthAndYear(char *buff, Date date)
 
{
 
	const char *src;
 
	YearMonthDay ymd;
 

	
 
	ConvertDateToYMD(date, &ymd);
 

	
 
	for (src = GetStringPtr(STR_MONTH_JAN + ymd.month); (*buff++ = *src++) != '\0';) {}
 
	buff[-1] = ' ';
 

	
 
	return FormatNoCommaNumber(buff, BASE_YEAR + ymd.year);
 
	return FormatNoCommaNumber(buff, ymd.year);
 
}
 

	
 
static char *FormatTinyDate(char *buff, Date date)
 
{
 
	YearMonthDay ymd;
 

	
 
	ConvertDateToYMD(date, &ymd);
 
	buff += sprintf(buff, " %02i-%02i-%04i", ymd.day, ymd.month + 1, BASE_YEAR + ymd.year);
 
	buff += sprintf(buff, " %02i-%02i-%04i", ymd.day, ymd.month + 1, ymd.year);
 

	
 
	return buff;
 
}
 

	
 
static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, int64 number, bool compact)
 
{
 
	const char *s;
 
	char c;
 
	char buf[40], *p;
 
	int j;
 

	
 
	// multiply by exchange rate
table/town_land.h
Show inline comments
 
@@ -2010,138 +2010,138 @@ static const uint16 _housetype_remove_ra
 
	  60,  60,  80,  80, 230, 230,  80,  80,
 
	 110, 110, 160, 160, 160, 160, 105, 105,
 
	 135, 135, 200, 200, 200, 200,  80,  80,
 
	  80,  30,  95, 200,  80,  95,  95, 140,
 
	 140,  95, 150, 200,  90,  50,  75,  75,
 
	  75,  75, 130,  80,  80, 130,  45,  45,
 
	 130, 130, 130,  70,  65,  95,
 
};
 
assert_compile(lengthof(_housetype_remove_ratingmod) == HOUSE_MAX);
 

	
 

	
 
typedef struct {
 
	byte min,max;
 
	Year min, max;
 
} HousetypeYear;
 

	
 
static const HousetypeYear _housetype_years[] = {
 
	{43, 255},
 
	{37, 255},
 
	{48, 255},
 
	{0,  255},
 
	{55, 255},
 
	{55, 255},
 
	{0,  255},
 
	{39, 255},
 
	{39, 255},
 
	{25, 255},
 
	{25, 255},
 
	{0, 255},
 
	{15, 255},
 
	{31, 255},
 
	{10, 40},
 
	{10, 40},
 
	{10, 40},
 
	{57, 255},
 
	{63, 255},
 
	{65, 255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  31},
 
	{0,  32},
 
	{11, 255},
 
	{15, 255},
 
	{43, 255},
 
	{0,  35},
 
	{53, 255},
 
	{0,  255},
 
	{38, 255},
 
	{38, 255},
 
	{38, 255},
 
	{38, 255},
 
	{80, 255},
 
	{0,  40},
 
	{0,  40},
 
	{25, 255},
 
	{63, 255},
 
	{63, 255},
 
	{63, 255},
 
	{63, 255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  43},
 
	{0,  43},
 
	{46, 255},
 
	{46, 255},
 
	{50, 255},
 
	{50, 255},
 
	{54, 255},
 
	{54, 255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  40},
 
	{0,  40},
 
	{52, 255},
 
	{52, 255},
 
	{52, 255},
 
	{52, 255},
 
	{43, 255},
 
	{43, 255},
 
	{58, 255},
 
	{58, 255},
 
	{47, 255},
 
	{47, 255},
 
	{47, 255},
 
	{47, 255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{53, 255},
 
	{42, 255},
 
	{64, 255},
 
	{64, 255},
 
	{0,  255},
 
	{73, 255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{0,  255},
 
	{ 1963, MAX_YEAR },
 
	{ 1957, MAX_YEAR },
 
	{ 1968, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{ 1975, MAX_YEAR },
 
	{ 1975, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{ 1959, MAX_YEAR },
 
	{ 1959, MAX_YEAR },
 
	{ 1945, MAX_YEAR },
 
	{ 1945, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{ 1935, MAX_YEAR },
 
	{ 1951, MAX_YEAR },
 
	{ 1930,     1960 },
 
	{ 1930,     1960 },
 
	{ 1930,     1960 },
 
	{ 1977, MAX_YEAR },
 
	{ 1983, MAX_YEAR },
 
	{ 1985, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0,     1951 },
 
	{    0,     1952 },
 
	{ 1941, MAX_YEAR },
 
	{ 1945, MAX_YEAR },
 
	{ 1963, MAX_YEAR },
 
	{    0,     1955 },
 
	{ 1973, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{ 1958, MAX_YEAR },
 
	{ 1958, MAX_YEAR },
 
	{ 1958, MAX_YEAR },
 
	{ 1958, MAX_YEAR },
 
	{ 1950, MAX_YEAR },
 
	{    0,     1960 },
 
	{    0,     1960 },
 
	{ 1945, MAX_YEAR },
 
	{ 1983, MAX_YEAR },
 
	{ 1983, MAX_YEAR },
 
	{ 1983, MAX_YEAR },
 
	{ 1983, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0,     1963 },
 
	{    0,     1963 },
 
	{ 1966, MAX_YEAR },
 
	{ 1966, MAX_YEAR },
 
	{ 1970, MAX_YEAR },
 
	{ 1970, MAX_YEAR },
 
	{ 1974, MAX_YEAR },
 
	{ 1974, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0,     1960 },
 
	{    0,     1960 },
 
	{ 1972, MAX_YEAR },
 
	{ 1972, MAX_YEAR },
 
	{ 1972, MAX_YEAR },
 
	{ 1972, MAX_YEAR },
 
	{ 1963, MAX_YEAR },
 
	{ 1963, MAX_YEAR },
 
	{ 1978, MAX_YEAR },
 
	{ 1978, MAX_YEAR },
 
	{ 1967, MAX_YEAR },
 
	{ 1967, MAX_YEAR },
 
	{ 1967, MAX_YEAR },
 
	{ 1967, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{ 1973, MAX_YEAR },
 
	{ 1962, MAX_YEAR },
 
	{ 1984, MAX_YEAR },
 
	{ 1984, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{ 1993, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
	{    0, MAX_YEAR },
 
};
 
assert_compile(lengthof(_housetype_years) == HOUSE_MAX);
 

	
 
static const byte _housetype_cargo_passengers[] = {
 
	8, 8, 8, 2, 10,10,4, 6,
 
	6, 2, 2, 2, 2, 8, 6, 6,
 
	6, 10,6, 6, 4, 4, 4, 4,
 
	3, 3, 3, 7, 8, 6, 8, 8,
 
	4, 4, 4, 4, 8, 3, 3, 8,
 
	8, 8, 8, 8, 5, 5, 3, 3,
 
	3, 3, 8, 8, 9, 9,10, 10,
 
	2, 2, 3, 3, 2, 2, 3, 3,
train_cmd.c
Show inline comments
 
@@ -614,25 +614,25 @@ static int32 CmdBuildRailWagon(EngineID 
 
			} else {
 
				SetFreeWagon(v);
 
			}
 

	
 
			v->cargo_type = rvi->cargo_type;
 
			v->cargo_subtype = 0;
 
			v->cargo_cap = rvi->capacity;
 
			v->value = value;
 
//			v->day_counter = 0;
 

	
 
			v->u.rail.railtype = GetEngine(engine)->railtype;
 

	
 
			v->build_year = _cur_year;
 
			v->build_year = _cur_year - BASE_YEAR;
 
			v->type = VEH_Train;
 
			v->cur_image = 0xAC2;
 
			v->random_bits = VehicleRandomBits();
 

	
 
			AddArticulatedParts(vl);
 

	
 
			_new_vehicle_id = v->index;
 

	
 
			VehiclePositionChanged(v);
 
			TrainConsistChanged(GetFirstVehicleInChain(v));
 

	
 
			InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 
@@ -774,25 +774,25 @@ int32 CmdBuildRailVehicle(TileIndex tile
 
			v->engine_type = p1;
 

	
 
			v->reliability = e->reliability;
 
			v->reliability_spd_dec = e->reliability_spd_dec;
 
			v->max_age = e->lifelength * 366;
 

	
 
			v->string_id = STR_SV_TRAIN_NAME;
 
			v->u.rail.railtype = e->railtype;
 
			_new_vehicle_id = v->index;
 

	
 
			v->service_interval = _patches.servint_trains;
 
			v->date_of_last_service = _date;
 
			v->build_year = _cur_year;
 
			v->build_year = _cur_year - BASE_YEAR;
 
			v->type = VEH_Train;
 
			v->cur_image = 0xAC2;
 
			v->random_bits = VehicleRandomBits();
 

	
 
			v->subtype = 0;
 
			SetFrontEngine(v);
 
			SetTrainEngine(v);
 

	
 
			VehiclePositionChanged(v);
 

	
 
			if (rvi->flags & RVI_MULTIHEAD) {
 
				SetMultiheaded(v);
train_gui.c
Show inline comments
 
@@ -64,25 +64,25 @@ void DrawTrainEnginePurchaseInfo(int x, 
 
	/* Cargo type + capacity, or N/A */
 
	SetDParam(0, STR_8838_N_A);
 
	SetDParam(2, STR_EMPTY);
 
	if (rvi->capacity != 0) {
 
		SetDParam(0, _cargoc.names_long[rvi->cargo_type]);
 
		SetDParam(1, rvi->capacity << multihead);
 
		SetDParam(2, STR_9842_REFITTABLE);
 
	}
 
	DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
 
	y += 10;
 

	
 
	/* Design date - Life length */
 
	SetDParam(0, BASE_YEAR + ymd.year);
 
	SetDParam(0, ymd.year);
 
	SetDParam(1, e->lifelength);
 
	DrawString(x,y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
 
	y += 10;
 

	
 
	/* Reliability */
 
	SetDParam(0, e->reliability * 100 >> 16);
 
	DrawString(x,y, STR_PURCHASE_INFO_RELIABILITY, 0);
 
	y += 10;
 

	
 
	/* Additional text from NewGRF */
 
	// XXX 227 will become a calculated width...
 
	y += ShowAdditionalText(x, y, 227, engine_number);
tunnelbridge_cmd.c
Show inline comments
 
@@ -29,44 +29,44 @@
 
#include "yapf/yapf.h"
 
#include "date.h"
 

	
 
#include "table/bridge_land.h"
 

	
 
extern const byte _track_sloped_sprites[14];
 
extern const SpriteID _water_shore_sprites[15];
 

	
 
extern void DrawCanalWater(TileIndex tile);
 

	
 
const Bridge orig_bridge[] = {
 
/*
 
	   year of availablity
 
	   |  minimum length
 
	   |  |   maximum length
 
	   |  |   |    price
 
	   |  |   |    |    maximum speed
 
	   |  |   |    |    |  sprite to use in GUI                string with description
 
	   |  |   |    |    |  |                                   |                            */
 
	{  0, 0, 16,  80,  32, 0xA24                             , STR_5012_WOODEN             , NULL, 0 },
 
	{  0, 0,  2, 112,  48, 0xA26 | PALETTE_TO_STRUCT_RED     , STR_5013_CONCRETE           , NULL, 0 },
 
	{ 10, 0,  5, 144,  64, 0xA25                             , STR_500F_GIRDER_STEEL       , NULL, 0 },
 
	{  0, 2, 10, 168,  80, 0xA22 | PALETTE_TO_STRUCT_CONCRETE, STR_5011_SUSPENSION_CONCRETE, NULL, 0 },
 
	{ 10, 3, 16, 185,  96, 0xA22                             , STR_500E_SUSPENSION_STEEL   , NULL, 0 },
 
	{ 10, 3, 16, 192, 112, 0xA22 | PALETTE_TO_STRUCT_YELLOW  , STR_500E_SUSPENSION_STEEL   , NULL, 0 },
 
	{ 10, 3,  7, 224, 160, 0xA23                             , STR_5010_CANTILEVER_STEEL   , NULL, 0 },
 
	{ 10, 3,  8, 232, 208, 0xA23 | PALETTE_TO_STRUCT_BROWN   , STR_5010_CANTILEVER_STEEL   , NULL, 0 },
 
	{ 10, 3,  9, 248, 240, 0xA23 | PALETTE_TO_STRUCT_RED     , STR_5010_CANTILEVER_STEEL   , NULL, 0 },
 
	{ 10, 0,  2, 240, 256, 0xA27                             , STR_500F_GIRDER_STEEL       , NULL, 0 },
 
	{ 75, 2, 16, 255, 320, 0xA28                             , STR_5014_TUBULAR_STEEL      , NULL, 0 },
 
	{ 85, 2, 32, 380, 512, 0xA28 | PALETTE_TO_STRUCT_YELLOW  , STR_5014_TUBULAR_STEEL      , NULL, 0 },
 
	{ 90, 2, 32, 510, 608, 0xA28 | PALETTE_TO_STRUCT_GREY    , STR_BRIDGE_TUBULAR_SILICON  , NULL, 0 }
 
	     year of availablity
 
	     |  minimum length
 
	     |  |   maximum length
 
	     |  |   |    price
 
	     |  |   |    |    maximum speed
 
	     |  |   |    |    |  sprite to use in GUI                string with description
 
	     |  |   |    |    |  |                                   |                            */
 
	{    0, 0, 16,  80,  32, 0xA24                             , STR_5012_WOODEN             , NULL, 0 },
 
	{    0, 0,  2, 112,  48, 0xA26 | PALETTE_TO_STRUCT_RED     , STR_5013_CONCRETE           , NULL, 0 },
 
	{ 1930, 0,  5, 144,  64, 0xA25                             , STR_500F_GIRDER_STEEL       , NULL, 0 },
 
	{    0, 2, 10, 168,  80, 0xA22 | PALETTE_TO_STRUCT_CONCRETE, STR_5011_SUSPENSION_CONCRETE, NULL, 0 },
 
	{ 1930, 3, 16, 185,  96, 0xA22                             , STR_500E_SUSPENSION_STEEL   , NULL, 0 },
 
	{ 1930, 3, 16, 192, 112, 0xA22 | PALETTE_TO_STRUCT_YELLOW  , STR_500E_SUSPENSION_STEEL   , NULL, 0 },
 
	{ 1930, 3,  7, 224, 160, 0xA23                             , STR_5010_CANTILEVER_STEEL   , NULL, 0 },
 
	{ 1930, 3,  8, 232, 208, 0xA23 | PALETTE_TO_STRUCT_BROWN   , STR_5010_CANTILEVER_STEEL   , NULL, 0 },
 
	{ 1930, 3,  9, 248, 240, 0xA23 | PALETTE_TO_STRUCT_RED     , STR_5010_CANTILEVER_STEEL   , NULL, 0 },
 
	{ 1930, 0,  2, 240, 256, 0xA27                             , STR_500F_GIRDER_STEEL       , NULL, 0 },
 
	{ 1995, 2, 16, 255, 320, 0xA28                             , STR_5014_TUBULAR_STEEL      , NULL, 0 },
 
	{ 2005, 2, 32, 380, 512, 0xA28 | PALETTE_TO_STRUCT_YELLOW  , STR_5014_TUBULAR_STEEL      , NULL, 0 },
 
	{ 2010, 2, 32, 510, 608, 0xA28 | PALETTE_TO_STRUCT_GREY    , STR_BRIDGE_TUBULAR_SILICON  , NULL, 0 }
 
};
 

	
 
Bridge _bridge[MAX_BRIDGES];
 

	
 

	
 
// calculate the price factor for building a long bridge.
 
// basically the cost delta is 1,1, 1, 2,2, 3,3,3, 4,4,4,4, 5,5,5,5,5, 6,6,6,6,6,6,  7,7,7,7,7,7,7,  8,8,8,8,8,8,8,8,
 
int CalcBridgeLenCostFactor(int x)
 
{
 
	int n;
 
	int r;
 

	
variables.h
Show inline comments
 
@@ -138,27 +138,27 @@ typedef struct Patches {
 
	int32 autorenew_money;
 

	
 
	byte pf_maxdepth;				// maximum recursion depth when searching for a train route for new pathfinder
 
	uint16 pf_maxlength;		// maximum length when searching for a train route for new pathfinder
 

	
 

	
 
	bool bridge_pillars;		// show bridge pillars for high bridges
 

	
 
	bool ai_disable_veh_train;		// disable types for AI
 
	bool ai_disable_veh_roadveh;		// disable types for AI
 
	bool ai_disable_veh_aircraft;		// disable types for AI
 
	bool ai_disable_veh_ship;		// disable types for AI
 
	uint32 starting_year;		// starting date
 
	uint32 ending_year;		// end of the game (just show highscore)
 
	uint32 colored_news_year; // when does newspaper become colored?
 
	Year starting_year;				// starting date
 
	Year ending_year;					// end of the game (just show highscore)
 
	Year colored_news_year;		// when does newspaper become colored?
 

	
 
	bool keep_all_autosave;		// name the autosave in a different way.
 
	bool autosave_on_exit;		// save an autosave when you quit the game, but do not ask "Do you really want to quit?"
 
	byte max_num_autosaves;		// controls how many autosavegames are made before the game starts to overwrite (names them 0 to max_num_autosaves - 1)
 
	bool extra_dynamite;			// extra dynamite
 

	
 
	bool never_expire_vehicles; // never expire vehicles
 
	byte extend_vehicle_life;	// extend vehicle life by this many years
 

	
 
	bool auto_euro;						// automatically switch to euro in 2002
 
	bool serviceathelipad;	// service helicopters at helipads automatically (no need to send to depot)
 
	bool smooth_economy;		// smooth economy
0 comments (0 inline, 0 general)