(svn r1520) Trim 134 (!) lines with trailing whitespace ):

pull/155/head
tron 20 years ago
parent cd6904c36b
commit dd6db73069

@ -511,9 +511,9 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
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);
@ -548,7 +548,7 @@ void OnNewDay_Aircraft(Vehicle *v)
SubtractMoneyFromPlayerFract(v->owner, cost);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateAircraftWindows(v);
}
@ -1714,10 +1714,10 @@ static bool FreeTerminal(Vehicle *v, byte i, byte last_terminal)
static int GetNumTerminals(const AirportFTAClass *Airport)
{
int i, num = 0;
for (i = Airport->terminals[0]; i > 0; i--)
num += Airport->terminals[i];
return num;
}
@ -1773,10 +1773,10 @@ static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *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;
}
@ -1882,7 +1882,7 @@ void Aircraft_Tick(Vehicle *v)
void UpdateOilRig( void )
{
Station *st;
FOR_ALL_STATIONS(st) {
if (st->airport_type == 5) st->airport_type = AT_OILRIG;
}

@ -204,32 +204,32 @@ static void ShowBuildAircraftWindow(uint tile)
#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,

@ -26,74 +26,74 @@ 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
}
@ -118,7 +118,7 @@ static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
const byte * curr;
int i;
nofterminals = nofhelipads = 0;
//now we read the number of terminals we have
if (terminals != NULL) {
i = terminals[0];
@ -129,11 +129,11 @@ static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
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;
@ -143,7 +143,7 @@ static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
assert(*curr != 0); //no empty groups please
nofhelipads += *curr;
}
}
Airport->helipads = helipads;

@ -69,7 +69,7 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
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;

@ -217,7 +217,7 @@ DEF_CONSOLE_CMD(ConScanFiles)
result = IConsoleVarAlloc(ICONSOLE_VAR_STRING);
if (argc <= 1) {
IConsoleVarSetString(result, "0");
return result; // return an zero
@ -229,7 +229,7 @@ DEF_CONSOLE_CMD(ConScanFiles)
/* 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
@ -238,7 +238,7 @@ DEF_CONSOLE_CMD(ConScanFiles)
IConsoleVarSetString(result, buffer);
return result;
}
} else
} else
// file records ?
if (item->type == FIOS_TYPE_FILE) {
if (strcmp(argv[1], item->name) == 0) {
@ -246,7 +246,7 @@ DEF_CONSOLE_CMD(ConScanFiles)
sprintf(buffer, "%d", pos);
IConsoleVarSetString(result, buffer);
return result;
}
}
}
}

@ -118,7 +118,7 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
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;
@ -128,7 +128,7 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
case '5': BuildDocksClick_Dock(w); break;
case '6': BuildDocksClick_Buoy(w); break;
case 'l': BuildDocksClick_Landscaping(w); break;
default:
default:
return;
}
} break;

@ -106,7 +106,7 @@ int64 CalculateCompanyValue(Player *p) {
}
value += p->money64 - p->current_loan; // add real money value
return max(value, 1);
}
@ -1532,8 +1532,8 @@ int32 CmdBuyShareInCompany(int x, int y, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_OTHER);
p = DEREF_PLAYER(p1);
if (_cur_year - p->inaugurated_year < 6) {
_error_message = STR_7080_PROTECTED;
return CMD_ERROR;
@ -1550,7 +1550,7 @@ int32 CmdBuyShareInCompany(int x, int y, uint32 flags, uint32 p1, uint32 p2)
/* 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;
@ -1581,7 +1581,7 @@ int32 CmdSellShareInCompany(int x, int y, uint32 flags, uint32 p1, uint32 p2)
/* 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;

@ -1376,8 +1376,8 @@ static bool CheckIfTooCloseToIndustry(uint tile, int type)
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;

@ -333,7 +333,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
switch(e->click.widget) {
case 5: {
int line;
int line;
int x;
byte b;
@ -350,9 +350,9 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
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)
@ -360,7 +360,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
} 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;
}
@ -373,12 +373,12 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
// 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:

@ -1098,7 +1098,7 @@ static void AskResetLandscapeWndProc(Window *w, WindowEvent *e)
DeleteWindow(w);
DeleteWindowByClass(WC_INDUSTRY_VIEW);
DeleteWindowByClass(WC_TOWN_VIEW);
DeleteWindowByClass(WC_LAND_INFO);
DeleteWindowByClass(WC_LAND_INFO);
if (mode) { // reset landscape
ResetLandscape();
@ -1264,7 +1264,7 @@ 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);
{
@ -2427,7 +2427,7 @@ void ShowVitalWindows(void)
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;

@ -725,9 +725,9 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
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;

@ -174,8 +174,8 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_DETAIL_INFO)
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]);

@ -51,7 +51,7 @@ static void DrawOrdersWindow(Window *w)
1 << 8 | //full load
1 << 9 //unload
);
//disable non-stop for non-trains
if (v->type != VEH_Train) {
w->disabled_state |= 1 << 6;
@ -435,7 +435,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
case 6: /* non stop button */
OrderClick_Nonstop(w, v);
break;
case 7: /* goto button */
OrderClick_Goto(w, v);
break;
@ -450,7 +450,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
}
} break;
case WE_KEYPRESS: {
Vehicle *v = GetVehicle(w->window_number);
uint i;
@ -458,7 +458,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
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);
}
@ -561,7 +561,7 @@ void ShowOrdersWindow(Vehicle *v)
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;

@ -833,10 +833,10 @@ static void HighScoreWndProc(Window *w, WindowEvent *e)
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);

@ -752,11 +752,11 @@ static CheatHasBeenUsed(void)
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 */
@ -774,7 +774,7 @@ int8 SaveHighScoreValue(const Player *p)
/* 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);
@ -838,7 +838,7 @@ int8 SaveHighScoreValueNetwork(void)
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++;
@ -874,7 +874,7 @@ void SaveToHighScore(void)
}
/* 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");
@ -896,7 +896,7 @@ void LoadFromHighScore(void)
}
fclose(fp);
}
/* Initialize end of game variable (when to show highscore chart) */
_patches.ending_date = 2051;
}

@ -768,7 +768,7 @@ static bool CheckMD5Digest(const MD5File file, md5_byte_t *digest, bool warn)
};
}
/* 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)
{
@ -801,17 +801,17 @@ static bool FileMD5(const MD5File file, bool warn)
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()

@ -1932,7 +1932,7 @@ static const char *name_norwegian_1[] = {
"Vik",
"Våg"
};
static const char *name_norwegian_2[] = {
"aker",
"anger",
@ -2002,7 +2002,7 @@ static const char *name_norwegian_2[] = {
"um",
"åsen"
};
static const char *name_norwegian_real[] = {
"Alta",
"Arendal",

@ -122,7 +122,7 @@ enum {
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);

@ -358,7 +358,7 @@ static void DrawTrainDepotWindow(Window *w)
/* 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;
@ -366,7 +366,7 @@ static void DrawTrainDepotWindow(Window *w)
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);
@ -384,7 +384,7 @@ static void DrawTrainDepotWindow(Window *w)
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;

@ -104,10 +104,10 @@ void DispatchMouseWheelEvent(Window *w, uint widget, int wheel)
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) {

Loading…
Cancel
Save