Changeset - r1019:90da3857ff29
[Not reviewed]
master
0 20 0
tron - 19 years ago 2005-01-15 08:58:31
tron@openttd.org
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
20 files changed with 114 insertions and 114 deletions:
0 comments (0 inline, 0 general)
aircraft_cmd.c
Show inline comments
 
@@ -508,15 +508,15 @@ static void CheckIfAircraftNeedsService(
 
	}
 
}
 

	
 
void InvalidateAircraftWindows(Vehicle *v)
 
{
 
	Order *o;
 
	
 

	
 
	InvalidateWindow(WC_AIRCRAFT_LIST, v->owner);
 
	
 

	
 
	for ( o = v->schedule_ptr; o->type != OT_NOTHING; o++, i++) {
 
		if (o->type == OT_GOTO_STATION ) {
 
			InvalidateWindow(WC_AIRCRAFT_LIST, o->station << 16 | v->owner);
 
		}
 
	}
 
}
 
@@ -545,13 +545,13 @@ void OnNewDay_Aircraft(Vehicle *v)
 
	v->profit_this_year -= cost >> 8;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_AIRCRAFT_RUN);
 
	SubtractMoneyFromPlayerFract(v->owner, cost);
 

	
 
	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 
	
 

	
 
	InvalidateAircraftWindows(v);
 
}
 

	
 
void AircraftYearlyLoop()
 
{
 
	Vehicle *v;
 
@@ -1711,16 +1711,16 @@ static bool FreeTerminal(Vehicle *v, byt
 
	return false;
 
}
 

	
 
static int GetNumTerminals(const AirportFTAClass *Airport)
 
{
 
	int i, num = 0;
 
	
 

	
 
	for (i = Airport->terminals[0]; i > 0; i--)
 
		num += Airport->terminals[i];
 
		
 

	
 
	return num;
 
}
 

	
 
static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *Airport)
 
{
 
	AirportFTA *temp;
 
@@ -1770,16 +1770,16 @@ static bool AirportFindFreeTerminal(Vehi
 
	return FreeTerminal(v, 0, GetNumTerminals(Airport));
 
}
 

	
 
static int GetNumHelipads(const AirportFTAClass *Airport)
 
{
 
	int i, num = 0;
 
	
 

	
 
	for (i = Airport->helipads[0]; i > 0; i--)
 
		num += Airport->helipads[i];
 
		
 

	
 
	return num;
 
}
 

	
 

	
 
static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *Airport)
 
{
 
@@ -1879,13 +1879,13 @@ void Aircraft_Tick(Vehicle *v)
 
	}
 
}
 

	
 
void UpdateOilRig( void )
 
{
 
	Station *st;
 
	
 

	
 
	FOR_ALL_STATIONS(st) {
 
		if (st->airport_type == 5) st->airport_type = AT_OILRIG;
 
	}
 
}
 

	
 
// need to be called to load aircraft from old version
aircraft_gui.c
Show inline comments
 
@@ -201,38 +201,38 @@ static void ShowBuildAircraftWindow(uint
 
		w->caption_color = _local_player;
 
	}
 
}
 

	
 
#define MAX_REFIT 0xFF
 

	
 
const byte _aircraft_refit_normal[] = { 
 
const byte _aircraft_refit_normal[] = {
 
	CT_PASSENGERS,
 
	CT_MAIL,
 
	CT_GOODS,
 
	CT_VALUABLES,
 
	MAX_REFIT 
 
	MAX_REFIT
 
};
 

	
 
const byte _aircraft_refit_arctic[] = { 
 
const byte _aircraft_refit_arctic[] = {
 
	CT_PASSENGERS,
 
	CT_MAIL,
 
	CT_GOODS,
 
	CT_FOOD,
 
	MAX_REFIT 
 
	MAX_REFIT
 
};
 

	
 
const byte _aircraft_refit_desert[] = { 
 
const byte _aircraft_refit_desert[] = {
 
	CT_PASSENGERS,
 
	CT_MAIL,
 
	CT_FRUIT,
 
	CT_GOODS,
 
	CT_DIAMONDS,
 
	MAX_REFIT 
 
	MAX_REFIT
 
};
 

	
 
const byte _aircraft_refit_candy[] = { 
 
const byte _aircraft_refit_candy[] = {
 
	CT_PASSENGERS,
 
	CT_SUGAR,
 
	CT_TOYS,
 
	CT_CANDY,
 
	CT_COLA,
 
	CT_COTTON_CANDY,
airport.c
Show inline comments
 
@@ -23,80 +23,80 @@ static byte AirportTestFTA(const Airport
 
static byte AirportBlockToString(uint32 block);*/
 

	
 
void InitializeAirports()
 
{
 
	// country airport
 
	CountryAirport = malloc(sizeof(AirportFTAClass));
 
	
 

	
 
	AirportFTAClass_Constructor(
 
		CountryAirport, 
 
		_airport_terminal_country, 
 
		NULL, 
 
		16, 
 
		ALL, 
 
		_airport_fta_country, 
 
		_airport_depots_country, 
 
		CountryAirport,
 
		_airport_terminal_country,
 
		NULL,
 
		16,
 
		ALL,
 
		_airport_fta_country,
 
		_airport_depots_country,
 
		lengthof(_airport_depots_country)
 
	);
 

	
 
	// city airport
 
	CityAirport = malloc(sizeof(AirportFTAClass));
 
	
 

	
 
	AirportFTAClass_Constructor(
 
		CityAirport, 
 
		_airport_terminal_city, 
 
		NULL, 
 
		19, 
 
		ALL, 
 
		_airport_fta_city, 
 
		_airport_depots_city, 
 
		CityAirport,
 
		_airport_terminal_city,
 
		NULL,
 
		19,
 
		ALL,
 
		_airport_fta_city,
 
		_airport_depots_city,
 
		lengthof(_airport_depots_city)
 
	);
 

	
 
	// metropolitan airport
 
	MetropolitanAirport = malloc(sizeof(AirportFTAClass));
 
	
 

	
 
	AirportFTAClass_Constructor(
 
		MetropolitanAirport, 
 
		_airport_terminal_metropolitan, 
 
		NULL, 
 
		20, 
 
		ALL, 
 
		_airport_fta_metropolitan, 
 
		_airport_depots_metropolitan, 
 
		MetropolitanAirport,
 
		_airport_terminal_metropolitan,
 
		NULL,
 
		20,
 
		ALL,
 
		_airport_fta_metropolitan,
 
		_airport_depots_metropolitan,
 
		lengthof(_airport_depots_metropolitan)
 
	);
 

	
 
	// international airport
 
	InternationalAirport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
 
	
 

	
 
	AirportFTAClass_Constructor(
 
		InternationalAirport, 
 
		_airport_terminal_international, 
 
		_airport_helipad_international, 
 
		37, 
 
		ALL, 
 
		_airport_fta_international, 
 
		_airport_depots_international, 
 
		InternationalAirport,
 
		_airport_terminal_international,
 
		_airport_helipad_international,
 
		37,
 
		ALL,
 
		_airport_fta_international,
 
		_airport_depots_international,
 
		lengthof(_airport_depots_international)
 
	);
 

	
 
	// heliport, oilrig
 
	Heliport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
 
	
 

	
 
	AirportFTAClass_Constructor(
 
		Heliport, 
 
		NULL, 
 
		_airport_helipad_heliport_oilrig, 
 
		7, 
 
		HELICOPTERS_ONLY, 
 
		_airport_fta_heliport_oilrig, 
 
		NULL, 
 
		Heliport,
 
		NULL,
 
		_airport_helipad_heliport_oilrig,
 
		7,
 
		HELICOPTERS_ONLY,
 
		_airport_fta_heliport_oilrig,
 
		NULL,
 
		0
 
	);
 
	
 

	
 
	Oilrig = Heliport;  // exactly the same structure for heliport/oilrig, so share state machine
 
}
 

	
 
void UnInitializeAirports()
 
{
 
	AirportFTAClass_Destructor(CountryAirport);
 
@@ -115,38 +115,38 @@ static void AirportFTAClass_Constructor(
 
	byte nofterminals, nofhelipads;
 
	byte nofterminalgroups = 0;
 
	byte nofhelipadgroups = 0;
 
	const byte * curr;
 
	int i;
 
	nofterminals = nofhelipads = 0;
 
	
 

	
 
	//now we read the number of terminals we have
 
	if (terminals != NULL) {
 
		i = terminals[0];
 
		nofterminalgroups = i;
 
		curr = terminals;
 
		while (i-- > 0) {
 
			curr++;
 
			assert(*curr != 0);	//we don't want to have an empty group
 
			nofterminals += *curr;
 
		}
 
	
 

	
 
	}
 
	Airport->terminals = terminals;
 

	
 
	//read helipads	
 
	//read helipads
 
	if (helipads != NULL) {
 
		i = helipads[0];
 
		nofhelipadgroups = i;
 
		curr = helipads;
 
		while (i-- > 0) {
 
			curr++;
 
			assert(*curr != 0); //no empty groups please
 
			nofhelipads += *curr;
 
		}
 
	
 

	
 
	}
 
	Airport->helipads = helipads;
 

	
 
	// if there are more terminals than 6, internal variables have to be changed, so don't allow that
 
	// same goes for helipads
 
	if (nofterminals > MAX_TERMINALS) { printf("Currently only maximum of %2d terminals are supported (you wanted %2d)\n", MAX_TERMINALS, nofterminals);}
airport_gui.c
Show inline comments
 
@@ -66,13 +66,13 @@ static void BuildAirToolbWndProc(Window 
 
		break;
 

	
 
	case WE_CLICK:
 
		if (e->click.widget - 3 >= 0)
 
			_build_air_button_proc[e->click.widget - 3](w);
 
		break;
 
		
 

	
 
	case WE_KEYPRESS: {
 
		switch (e->keypress.keycode) {
 
			case '1': BuildAirClick_Airport(w); break;
 
			case '2': BuildAirClick_Demolish(w); break;
 
			case 'l': BuildAirClick_Landscaping(w); break;
 
			default:
console_cmds.c
Show inline comments
 
@@ -214,42 +214,42 @@ DEF_CONSOLE_CMD(ConScanFiles)
 
	const FiosItem *item;
 
	int pos = 0;
 
	_iconsole_var* result;
 

	
 

	
 
	result = IConsoleVarAlloc(ICONSOLE_VAR_STRING);
 
	
 

	
 
	if (argc <= 1) {
 
		IConsoleVarSetString(result, "0");
 
		return result; // return an zero
 
	}
 

	
 
	/* Build the file-list */
 
	BuildFileList();
 

	
 
	/* As long as we have files */
 
	while (pos < _fios_num) {
 
		item = _fios_list + pos;
 
		pos++;		
 
		pos++;
 
		if (strcmp(argv[1], "..") == 0) {
 
			if (item->type == FIOS_TYPE_PARENT) {
 
				// huh we are searching for the parent directory
 
				char buffer[10];
 
				sprintf(buffer, "%d", pos);
 
				IConsoleVarSetString(result, buffer);
 
				return result;
 
			}
 
		} else 
 
		} else
 
			// file records ?
 
			if (item->type == FIOS_TYPE_FILE) {
 
				if (strcmp(argv[1], item->name) == 0) {
 
					char buffer[10];
 
					sprintf(buffer, "%d", pos);
 
					IConsoleVarSetString(result, buffer);
 
					return result;
 
				}			
 
				}
 
			}
 
	}
 

	
 
	/* Destroy the file list */
 
	FiosFreeSavegameList();
 

	
dock_gui.c
Show inline comments
 
@@ -115,23 +115,23 @@ static void BuildDocksToolbWndProc(Windo
 
		DrawWindowWidgets(w);
 
		break;
 

	
 
	case WE_CLICK: {
 
		if (e->click.widget - 3 >= 0 && e->click.widget != 5) _build_docks_button_proc[e->click.widget - 3](w);
 
	} break;
 
	
 

	
 
	case WE_KEYPRESS: {
 
		switch(e->keypress.keycode) {
 
			case '1': BuildDocksClick_Canal(w); break;
 
			case '2': BuildDocksClick_Lock(w); break;
 
			case '3': BuildDocksClick_Demolish(w); break;
 
			case '4': BuildDocksClick_Depot(w); break;
 
			case '5': BuildDocksClick_Dock(w); break;
 
			case '6': BuildDocksClick_Buoy(w); break;
 
			case 'l': BuildDocksClick_Landscaping(w); break;
 
			default: 
 
			default:
 
				return;
 
		}
 
	} break;
 

	
 
	case WE_PLACE_OBJ:
 
		_place_proc(e->place.tile);
economy.c
Show inline comments
 
@@ -103,13 +103,13 @@ int64 CalculateCompanyValue(Player *p) {
 
				value += v->value * 3 >> 1;
 
			}
 
		}
 
	}
 

	
 
	value += p->money64 - p->current_loan; // add real money value
 
	
 

	
 
	return max(value, 1);
 
}
 

	
 
// if update is set to true, the economy is updated with this score
 
//  (also the house is updated, should only be true in the on-tick event)
 
int UpdateCompanyRatingAndValue(Player *p, bool update)
 
@@ -1529,14 +1529,14 @@ int32 CmdBuyShareInCompany(int x, int y,
 
	int64 cost;
 
	byte *b;
 
	int i;
 

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

	
 

	
 
	if (_cur_year - p->inaugurated_year < 6) {
 
		_error_message = STR_7080_PROTECTED;
 
		return CMD_ERROR;
 
	}
 

	
 
	/* Check if buying shares is allowed (protection against modified clients */
 
@@ -1547,13 +1547,13 @@ int32 CmdBuyShareInCompany(int x, int y,
 
	if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0)
 
		return 0;
 

	
 
	/* We can not buy out a real player in networking */
 
	if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 1 && !p->is_ai)
 
		return 0;
 
	
 

	
 
	cost = CalculateCompanyValue(p) >> 2;
 
	if (flags & DC_EXEC) {
 
		b = p->share_owners;
 
		while (*b != 0xFF) b++; /* share owners is guaranteed to contain at least one 0xFF */
 
		*b = _current_player;
 

	
 
@@ -1578,13 +1578,13 @@ int32 CmdSellShareInCompany(int x, int y
 
	SET_EXPENSES_TYPE(EXPENSES_OTHER);
 
	p = DEREF_PLAYER(p1);
 

	
 
	/* Check if selling shares is allowed (protection against modified clients */
 
	if (!_patches.allow_shares)
 
		return CMD_ERROR;
 
		
 

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

	
 
	/* adjust it a little to make it less profitable to sell and buy */
 
	cost = CalculateCompanyValue(p) >> 2;
industry_cmd.c
Show inline comments
 
@@ -1373,14 +1373,14 @@ static bool CheckIfTooCloseToIndustry(ui
 

	
 
	FOR_ALL_INDUSTRIES(i) {
 
		// check if an industry that accepts the same goods is nearby
 
		if (i->xy != 0 &&
 
				(GetTileDist1D(tile, i->xy) <= 14) &&
 
				spec->accepts_cargo[0] != 0xFF &&
 
				spec->accepts_cargo[0] == i->accepts_cargo[0] && 
 
				!(_game_mode == GM_EDITOR && 
 
				spec->accepts_cargo[0] == i->accepts_cargo[0] &&
 
				!(_game_mode == GM_EDITOR &&
 
					_patches.same_industry_close &&
 
					_patches.multiple_industry_per_town)) {
 
				_error_message = STR_INDUSTRY_TOO_CLOSE;
 
				return false;
 
				}
 

	
industry_gui.c
Show inline comments
 
@@ -330,13 +330,13 @@ static void IndustryViewWndProc(Window *
 

	
 
	case WE_CLICK: {
 
		Industry *i;
 

	
 
		switch(e->click.widget) {
 
		case 5: {
 
			int line; 
 
			int line;
 
			int x;
 
			byte b;
 

	
 
			i = GetIndustry(w->window_number);
 

	
 
			// We should only work in editor
 
@@ -347,41 +347,41 @@ static void IndustryViewWndProc(Window *
 
			if (i->accepts_cargo[0] != CT_INVALID)
 
				return;
 

	
 
			x = e->click.pt.x;
 
			line = (e->click.pt.y - 127) / 10;
 
			if (e->click.pt.y >= 127 && IS_INT_INSIDE(line, 0, 2) && i->produced_cargo[line]) {
 
				if (IS_INT_INSIDE(x, 5, 25) ) { 
 
				if (IS_INT_INSIDE(x, 5, 25) ) {
 
					// clicked buttons
 
					if (x < 15) {				
 
					if (x < 15) {
 
						// decrease
 
						i->production_rate[line] /= 2;
 
						if (i->production_rate[line] < 4)
 
							i->production_rate[line] = 4;
 
					} else {
 
						// increase
 
						b = i->production_rate[line] * 2;
 
						if (i->production_rate[line] >= 128) 
 
						if (i->production_rate[line] >= 128)
 
							b=255;
 
						i->production_rate[line] = b;
 
					}
 
					UpdateIndustryProduction(i);
 
					SetWindowDirty(w);
 
					w->flags4 |= 5 << WF_TIMEOUT_SHL;
 
					WP(w,vp2_d).data_2 = line+1;
 
					WP(w,vp2_d).data_3 = (x < 15 ? 1 : 2);
 
				} else if (IS_INT_INSIDE(x, 34, 160)) {
 
					// clicked the text
 
					WP(w,vp2_d).data_1 = line;
 
					SetDParam(0, i->production_rate[line] * 8);
 
					ShowQueryString(STR_CONFIG_PATCHES_INT32, 
 
							STR_CONFIG_GAME_PRODUCTION, 
 
							10, 100, w->window_class, 
 
					ShowQueryString(STR_CONFIG_PATCHES_INT32,
 
							STR_CONFIG_GAME_PRODUCTION,
 
							10, 100, w->window_class,
 
							w->window_number);
 
				}
 
			}	
 
			}
 
			}
 
			break;
 
		case 6:
 
			i = GetIndustry(w->window_number);
 
			ScrollMainWindowToTile(i->xy + TILE_XY(1,1));
 
			break;
main_gui.c
Show inline comments
 
@@ -1095,13 +1095,13 @@ static void AskResetLandscapeWndProc(Win
 
			DeleteWindow(w);
 
			break;
 
		case 4:
 
			DeleteWindow(w);
 
			DeleteWindowByClass(WC_INDUSTRY_VIEW);
 
			DeleteWindowByClass(WC_TOWN_VIEW);
 
			DeleteWindowByClass(WC_LAND_INFO);			
 
			DeleteWindowByClass(WC_LAND_INFO);
 

	
 
			if (mode) { // reset landscape
 
				ResetLandscape();
 
			} else { // make random landscape
 
				SndPlayFx(SND_15_BEEP);
 
				_switch_mode = SM_GENRANDLAND;
 
@@ -1261,13 +1261,13 @@ static const int8 _multi_terraform_coord
 

	
 
static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
 
{
 
	switch(e->event) {
 
	case WE_PAINT:
 
		// XXX - lighthouse button is widget 11!! Don't forget when changing
 
		w->widget[11].tooltips = (_opt.landscape == LT_DESERT) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE; 
 
		w->widget[11].tooltips = (_opt.landscape == LT_DESERT) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE;
 
		DrawWindowWidgets(w);
 

	
 
		{
 
			int n = _terraform_size * _terraform_size;
 
			const int8 *coords = &_multi_terraform_coords[0][0];
 

	
 
@@ -2424,13 +2424,13 @@ void ShowVitalWindows(void)
 

	
 
	if (_networking) { // if networking, disable fast-forward button
 
		SETBIT(w->disabled_state, 1);
 
		if (!_network_server) // if not server, disable pause button
 
			SETBIT(w->disabled_state, 0);
 
	}
 
	
 

	
 
	PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_normal_desc)
 

	
 
	_main_status_desc.top = _screen.height - 12;
 
	w = AllocateWindowDesc(&_main_status_desc);
 
	CLRBITS(w->flags4, WF_WHITE_BORDER_MASK);
 

	
network_gui.c
Show inline comments
 
@@ -722,15 +722,15 @@ static void NetworkLobbyWindowWndProc(Wi
 

	
 
			DoDrawString(_network_player_info[index].company_name, 13, y, 2);
 
			if(_network_player_info[index].use_password != 0)
 
				DrawSprite(SPR_LOCK, 120, y);
 

	
 
			/* If the company's income was positive puts a green dot else a red dot */
 
			if ((_network_player_info[index].income) > 0) 
 
			if ((_network_player_info[index].income) > 0)
 
				income = true;
 
			DrawSprite(SPR_BLOT | (income?0x30d8000:0x30b8000), 130, y); 
 
			DrawSprite(SPR_BLOT | (income?0x30d8000:0x30b8000), 130, y);
 

	
 
			pos++;
 
			y += NET_PRC__SIZE_OF_ROW_COMPANY;
 
			if (pos >= w->vscroll.cap)
 
				break;
 
		}
network_udp.c
Show inline comments
 
@@ -171,14 +171,14 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIEN
 

	
 
                /* Send 1 if there is a passord for the company else send 0 */
 
		if (_network_player_info[player->index].password[0] != '\0') {
 
			NetworkSend_uint8 (p, 1);
 
		} else {
 
			NetworkSend_uint8 (p, 0);
 
		}		
 
		
 
		}
 

	
 
		for (i = 0; i < NETWORK_VEHICLE_TYPES; i++)
 
			NetworkSend_uint16(packet, _network_player_info[player->index].num_vehicle[i]);
 

	
 
		for (i = 0; i < NETWORK_STATION_TYPES; i++)
 
			NetworkSend_uint16(packet, _network_player_info[player->index].num_station[i]);
 

	
order_gui.c
Show inline comments
 
@@ -48,13 +48,13 @@ static void DrawOrdersWindow(Window *w)
 
		1 << 5 |   //delete
 
		1 << 6 |   //non-stop
 
		1 << 7 |   //go-to
 
		1 << 8 |   //full load
 
		1 << 9     //unload
 
		);
 
		
 

	
 
	//disable non-stop for non-trains
 
	if (v->type != VEH_Train) {
 
		w->disabled_state |= 1 << 6;
 
	}
 

	
 
	shared_schedule = IsScheduleShared(v) != NULL;
 
@@ -432,13 +432,13 @@ static void OrdersWndProc(Window *w, Win
 
			OrderClick_Delete(w, v);
 
			break;
 

	
 
		case 6: /* non stop button */
 
			OrderClick_Nonstop(w, v);
 
			break;
 
			
 

	
 
		case 7: /* goto button */
 
			OrderClick_Goto(w, v);
 
			break;
 

	
 
		case 8: /* full load button */
 
			OrderClick_FullLoad(w, v);
 
@@ -447,21 +447,21 @@ static void OrdersWndProc(Window *w, Win
 
		case 9: /* unload button */
 
			OrderClick_Unload(w, v);
 
			break;
 

	
 
		}
 
	} break;
 
	
 

	
 
	case WE_KEYPRESS: {
 
		Vehicle *v = GetVehicle(w->window_number);
 
		uint i;
 

	
 
		for(i = 0; i < lengthof(_order_keycodes); i++) {
 
			if (e->keypress.keycode == _order_keycodes[i]) {
 
				e->keypress.cont = false;
 
				//see if the button is disabled 
 
				//see if the button is disabled
 
				if (!(HASBIT(w->disabled_state, (i + 4)))) {
 
					_order_button_proc[i](w, v);
 
				}
 
				break;
 
			}
 
		}
 
@@ -558,13 +558,13 @@ void ShowOrdersWindow(Vehicle *v)
 
	VehicleID veh = v->index;
 

	
 
	DeleteWindowById(WC_VEHICLE_ORDERS, veh);
 
	DeleteWindowById(WC_VEHICLE_DETAILS, veh);
 

	
 
	_alloc_wnd_parent_num = veh;
 
	
 

	
 
	w = AllocateWindowDesc( (v->owner == _local_player) ? &_orders_desc : &_other_orders_desc);
 

	
 
	w->window_number = veh;
 
	w->caption_color = v->owner;
 
	w->vscroll.cap = 6;
 
	WP(w,order_d).sel = -1;
player_gui.c
Show inline comments
 
@@ -830,16 +830,16 @@ static void HighScoreWndProc(Window *w, 
 
				DoDrawString(hs[i].company, x + 71, y + 140 + (i * 55), colour);
 
				SetDParam(0, hs[i].title);
 
				SetDParam(1, hs[i].score);
 
				DrawString(x + 71, y + 160 + (i * 55), STR_HIGHSCORE_STATS, colour);
 
			}
 
		}
 
	} break;	
 
	} break;
 

	
 
	case WE_CLICK: /* Onclick get back all hidden windows */
 
		if (_game_mode != GM_MENU && !_networking)				
 
		if (_game_mode != GM_MENU && !_networking)
 
			ShowVitalWindows();
 

	
 
		DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
 
		DeleteWindow(w);
 
		break;
 
	}
players.c
Show inline comments
 
@@ -749,17 +749,17 @@ StringID EndGameGetPerformanceTitleFromV
 
static CheatHasBeenUsed(void)
 
{
 
	const Cheat* cht = (Cheat*) &_cheats;
 
	const Cheat* cht_last = &cht[sizeof(_cheats) / sizeof(Cheat)];
 

	
 
	for (; cht != cht_last; cht++) {
 
		if (cht->been_used) 
 
		if (cht->been_used)
 
			return true;
 
	}
 

	
 
	return false;	
 
	return false;
 
}
 

	
 
/* Save the highscore for the player */
 
int8 SaveHighScoreValue(const Player *p)
 
{
 
	HighScore *hs = _highscore_table[_opt.diff_level];
 
@@ -771,13 +771,13 @@ int8 SaveHighScoreValue(const Player *p)
 
		return -1;
 

	
 
	for (i = 0; i < lengthof(_highscore_table[0]); i++) {
 
		/* You are in the TOP5. Move all values one down and save us there */
 
		if (hs[i].score <= score) {
 
			byte buf[sizeof(hs[i].company)];
 
			
 

	
 
			// move all elements one down starting from the replaced one
 
			memmove(&hs[i + 1], &hs[i], sizeof(HighScore) * (lengthof(_highscore_table[0]) - i - 1));
 
			SetDParam(0, p->president_name_1);
 
			SetDParam(1, p->president_name_2);
 
			SetDParam(2, p->name_1);
 
			SetDParam(3, p->name_2);
 
@@ -835,13 +835,13 @@ int8 SaveHighScoreValueNetwork(void)
 

	
 
			ttd_strlcpy(hs->company, buf, sizeof(buf));
 
			hs->score = (*p_cur)->old_economy[0].performance_history;
 
			hs->title = EndGameGetPerformanceTitleFromValue(hs->score);
 

	
 
			// get the ranking of the local player
 
			if ((*p_cur)->index == (int8)_local_player) 
 
			if ((*p_cur)->index == (int8)_local_player)
 
				player = i;
 

	
 
			p_cur++;
 
		}
 
	}
 

	
 
@@ -871,13 +871,13 @@ void SaveToHighScore(void)
 
		}
 
		fclose(fp);
 
	}
 
}
 

	
 
/* Initialize the highscore table to 0 and if any file exists, load in values */
 
void LoadFromHighScore(void) 
 
void LoadFromHighScore(void)
 
{
 
	FILE *fp = fopen(_highscore_file, "r");
 

	
 
	memset(_highscore_table, 0, sizeof(_highscore_table));
 

	
 
	if (fp != NULL) {
 
@@ -893,13 +893,13 @@ void LoadFromHighScore(void)
 
				fread(&hs->score, sizeof(hs->score), 1, fp);
 
				fread(&hs->title, sizeof(hs->title), 1, fp);
 
			}
 
		}
 
		fclose(fp);
 
	}
 
	
 

	
 
	/* Initialize end of game variable (when to show highscore chart) */
 
	 _patches.ending_date = 2051;
 
}
 

	
 
// Save/load of players
 
static const byte _player_desc[] = {
spritecache.c
Show inline comments
 
@@ -765,13 +765,13 @@ static bool CheckMD5Digest(const MD5File
 
	} else {
 
		if (warn) printf("MD5 of %s is ****INCORRECT**** - File Corrupt.\n", file.filename);
 
		return false;
 
	};
 
}
 

	
 
/* Calculate and check the MD5 hash of the supplied filename. 
 
/* Calculate and check the MD5 hash of the supplied filename.
 
 * returns true if the checksum is correct */
 
static bool FileMD5(const MD5File file, bool warn)
 
{
 
	FILE *f;
 
	char buf[MAX_PATH];
 

	
 
@@ -798,23 +798,23 @@ static bool FileMD5(const MD5File file, 
 
		while ( (len = fread (buffer, 1, 1024, f)) )
 
			md5_append(&filemd5state, buffer, len);
 

	
 
		if (ferror(f))
 
			if (warn) printf ("Error Reading from %s \n", buf);
 
		fclose(f);
 
  
 

	
 
		md5_finish(&filemd5state, digest);
 
	  return CheckMD5Digest(file, digest, warn);
 
	} else { // file not found
 
		return false;
 
	}	
 
	}
 
}
 

	
 
/* Checks, if either the Windows files exist (TRG1R.GRF) or the DOS files (TRG1.GRF)
 
 * by comparing the MD5 checksums of the files. _use_dos_palette is set accordingly.
 
 * If neither are found, Windows palette is assumed. 
 
 * If neither are found, Windows palette is assumed.
 
 *
 
 * (Note: Also checks sample.cat for corruption) */
 
void CheckExternalFiles()
 
{
 
	int i;
 
	int dos=0, win=0; // count of files from this version
table/namegen.h
Show inline comments
 
@@ -1929,13 +1929,13 @@ static const char *name_norwegian_1[] = 
 
	"Ved",
 
	"Vest",
 
	"Vesle",
 
	"Vik",
 
	"Våg"
 
};
 
	
 

	
 
static const char *name_norwegian_2[] = {
 
	"aker",
 
	"anger",
 
	"bakken",
 
	"bekk",
 
	"berg",
 
@@ -1999,13 +1999,13 @@ static const char *name_norwegian_2[] = 
 
	"vik",
 
	"voll",
 
	"våg",
 
	"um",
 
	"åsen"
 
};
 
	
 

	
 
static const char *name_norwegian_real[] = {
 
	"Alta",
 
	"Arendal",
 
	"Askim",
 
	"Bergen",
 
	"Bodø",
town.h
Show inline comments
 
@@ -119,13 +119,13 @@ enum {
 
	RATING_ROAD_DOWN_STEP = -50,
 
	RATING_ROAD_MINIMUM = -100,
 
	RATING_HOUSE_MINIMUM = RATING_MINIMUM,
 

	
 
	RATING_BRIBE_UP_STEP = 200,
 
	RATING_BRIBE_MAXIMUM = 800,
 
	RATING_BRIBE_DOWN_TO = -50 					// XXX SHOULD BE SOMETHING LOWER?	
 
	RATING_BRIBE_DOWN_TO = -50 					// XXX SHOULD BE SOMETHING LOWER?
 
};
 

	
 
bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type);
 

	
 
VARDEF Town _towns[70];
 
VARDEF uint _towns_size;
train_gui.c
Show inline comments
 
@@ -355,21 +355,21 @@ static void DrawTrainDepotWindow(Window 
 
				--num < 0 && num >= -w->vscroll.cap) {
 

	
 
			DrawTrainImage(v, x+21, y, w->hscroll.cap, w->hscroll.pos, WP(w,traindepot_d).sel);
 
			/* Draw the train number */
 
			SetDParam(0, v->unitnumber);
 
			DrawString(x, y, (v->max_age - 366 < v->age) ? STR_00E3 : STR_00E2, 0);
 
			
 

	
 
			/*Draw the train counter */
 
			i = 0;
 
			u = v;
 
			do i++; while ( (u=u->next) != NULL);		//Determine length of train
 
			SetDParam(0, i);				//Set the counter
 
			i = (w->hscroll.cap * 29) + (x + 26);		//Calculate position of text according to window size
 
			DrawStringCentered(i, y+5, STR_TINY_BLACK, 0);	//Draw the counter
 
			
 

	
 
			/* Draw the pretty flag */
 
			DrawSprite(v->vehstatus&VS_STOPPED ? 0xC12 : 0xC13, x+15, y);
 

	
 
			y += 14;
 
		}
 
	}
 
@@ -381,13 +381,13 @@ static void DrawTrainDepotWindow(Window 
 
				v->tile == (TileIndex)tile &&
 
				v->u.rail.track == 0x80 &&
 
				--num < 0 && num >= -w->vscroll.cap) {
 

	
 
			DrawTrainImage(v, x+50, y, w->hscroll.cap - 1, 0, WP(w,traindepot_d).sel);
 
			DrawString(x, y+2, STR_8816, 0);
 
			
 

	
 
			/*Draw the train counter */
 
			i = 0;
 
			u = v;
 
			do i++; while ( (u=u->next) != NULL);		//Determine length of train
 
			SetDParam(0, i);				//Set the counter
 
			i = (w->hscroll.cap * 29) + (x + 26);		//Calculate position of text according to window size
window.c
Show inline comments
 
@@ -101,16 +101,16 @@ void DispatchMouseWheelEvent(Window *w, 
 
{
 
	const Widget *wi1 = &w->widget[widget];
 
	const Widget *wi2 = &w->widget[widget + 1];
 
	Scrollbar *sb;
 

	
 
	/* The listbox can only scroll if scrolling was done on the scrollbar itself,
 
	 * or on the listbox (and the next item is (must be) the scrollbar) 
 
	 * or on the listbox (and the next item is (must be) the scrollbar)
 
	 * XXX - should be rewritten as a widget-dependent scroller but that's
 
	 * not happening until someone rewrites the whole widget-code */
 
	if ((sb = &w->vscroll,  wi1->type == WWT_SCROLLBAR)  || (sb = &w->vscroll2, wi1->type == WWT_SCROLL2BAR)  || 
 
	if ((sb = &w->vscroll,  wi1->type == WWT_SCROLLBAR)  || (sb = &w->vscroll2, wi1->type == WWT_SCROLL2BAR)  ||
 
			(sb = &w->vscroll2, wi2->type == WWT_SCROLL2BAR) || (sb = &w->vscroll, wi2->type == WWT_SCROLLBAR) ) {
 

	
 
		if (sb->count > sb->cap) {
 
			int pos = clamp(sb->pos + wheel, 0, sb->count - sb->cap);
 
			if (pos != sb->pos) {
 
				sb->pos = pos;
0 comments (0 inline, 0 general)