(svn r15711) -Codechange: lots of whitespace cleanup/fixes

pull/155/head
rubidium 15 years ago
parent 81361189ca
commit f3e0fd7416

@ -32,7 +32,7 @@ static void _DoCommandReturnBuildBridge2(class AIInstance *instance)
}
/* This can never happen, as in test-mode this callback is never executed,
* and in execute-mode, the other callback is called. */
* and in execute-mode, the other callback is called. */
NOT_REACHED();
}
@ -45,7 +45,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
}
/* This can never happen, as in test-mode this callback is never executed,
* and in execute-mode, the other callback is called. */
* and in execute-mode, the other callback is called. */
NOT_REACHED();
}

@ -316,7 +316,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
EnforcePrecondition(false, ::IsValidTile(tile));
EnforcePrecondition(false, ::IsValidTile(to));
EnforcePrecondition(false, ::DistanceManhattan(from, tile) == 1);
EnforcePrecondition(false, ::DistanceManhattan(tile,to) >= 1);
EnforcePrecondition(false, ::DistanceManhattan(tile, to) >= 1);
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
int diag_offset = abs(abs((int)::TileX(to) - (int)::TileX(tile)) - abs((int)::TileY(to) - (int)::TileY(tile)));
EnforcePrecondition(false, diag_offset <= 1 ||
@ -333,7 +333,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
EnforcePrecondition(false, ::IsValidTile(tile));
EnforcePrecondition(false, ::IsValidTile(to));
EnforcePrecondition(false, ::DistanceManhattan(from, tile) == 1);
EnforcePrecondition(false, ::DistanceManhattan(tile,to) >= 1);
EnforcePrecondition(false, ::DistanceManhattan(tile, to) >= 1);
int diag_offset = abs(abs((int)::TileX(to) - (int)::TileX(tile)) - abs((int)::TileY(to) - (int)::TileY(tile)));
EnforcePrecondition(false, diag_offset <= 1 ||
(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||

@ -395,7 +395,7 @@ static bool NormaliseTileOffset(int32 *tile)
static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, DiagDirection neighbour)
{
TileIndex neighbour_tile = ::TileAddByDiagDir(start_tile, neighbour);
if ((rts & ::GetRoadTypes(neighbour_tile)) == 0) return false;
if ((rts & ::GetRoadTypes(neighbour_tile)) == 0) return false;
switch (::GetTileType(neighbour_tile)) {
case MP_ROAD:

@ -8,7 +8,7 @@
bool AITestMode::ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs)
{
/* In test mode we only return 'false', telling the DoCommand it
* should stop after testing the command and return with that result. */
* should stop after testing the command and return with that result. */
return false;
}

@ -15,12 +15,12 @@
#include "table/strings.h"
/**
* Draw the details for the given vehicle at the position (x,y)
*
* @param v current vehicle
* @param x The x coordinate
* @param y The y coordinate
*/
* Draw the details for the given vehicle at the position (x, y)
*
* @param v current vehicle
* @param x The x coordinate
* @param y The y coordinate
*/
void DrawAircraftDetails(const Vehicle *v, int x, int y)
{
int y_offset = (v->Next()->cargo_cap != 0) ? -11 : 0;

@ -207,7 +207,7 @@ public:
if (vehicletype == VEH_TRAIN) {
this->wagon_btnstate = true;
/* The train window is bigger so we will move some of the widgets to fit the new size.
* We will start by moving the resize button to the lower right corner. */
* We will start by moving the resize button to the lower right corner. */
widget[RVW_WIDGET_RESIZE].top = widget[RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE].top;
widget[RVW_WIDGET_RESIZE].bottom = widget[RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE].bottom;
widget[RVW_WIDGET_STOP_REPLACE].right = widget[RVW_WIDGET_RESIZE].right;
@ -421,12 +421,12 @@ public:
if (delta.x != 0) {
/* We changed the width of the window so we have to resize the lists.
* Because ResizeButtons() makes each widget the same size it can't be used on the lists
* because then the lists would have the same size as the scrollbars.
* Instead we use it on the detail panels.
* Afterwards we use the new location of the detail panels (the middle of the window)
* to place the lists.
* This way the lists will have equal size while keeping the width of the scrollbars unchanged. */
* Because ResizeButtons() makes each widget the same size it can't be used on the lists
* because then the lists would have the same size as the scrollbars.
* Instead we use it on the detail panels.
* Afterwards we use the new location of the detail panels (the middle of the window)
* to place the lists.
* This way the lists will have equal size while keeping the width of the scrollbars unchanged. */
ResizeButtons(this, RVW_WIDGET_LEFT_DETAILS, RVW_WIDGET_RIGHT_DETAILS);
widget[RVW_WIDGET_RIGHT_MATRIX].left = widget[RVW_WIDGET_RIGHT_DETAILS].left;
widget[RVW_WIDGET_LEFT_SCROLLBAR].right = widget[RVW_WIDGET_LEFT_DETAILS].right;

@ -97,12 +97,12 @@ public:
}
/**
* Make a pixel looks like it is transparent.
* @param colour the colour already on the screen.
* @param nom the amount of transparency, nominator, makes colour lighter.
* @param denom denominator, makes colour darker.
* @return the new colour for the screen.
*/
* Make a pixel looks like it is transparent.
* @param colour the colour already on the screen.
* @param nom the amount of transparency, nominator, makes colour lighter.
* @param denom denominator, makes colour darker.
* @return the new colour for the screen.
*/
static inline uint32 MakeTransparent(uint32 colour, uint nom, uint denom = 256)
{
uint r = GB(colour, 16, 8);
@ -113,10 +113,10 @@ public:
}
/**
* Make a colour grey - based.
* @param colour the colour to make grey.
* @return the new colour, now grey.
*/
* Make a colour grey - based.
* @param colour the colour to make grey.
* @return the new colour, now grey.
*/
static inline uint32 MakeGrey(uint32 colour)
{
uint r = GB(colour, 16, 8);
@ -124,8 +124,8 @@ public:
uint b = GB(colour, 0, 8);
/* To avoid doubles and stuff, multiple it with a total of 65536 (16bits), then
* divide by it to normalize the value to a byte again. See heightmap.cpp for
* information about the formula. */
* divide by it to normalize the value to a byte again. See heightmap.cpp for
* information about the formula. */
colour = ((r * 19595) + (g * 38470) + (b * 7471)) / 65536;
return ComposeColour(0xFF, colour, colour, colour);

@ -169,11 +169,11 @@ static int CDECL TrainEnginePowerVsRunningCostSorter(const void *a, const void *
const Engine *e_b = GetEngine(*(const EngineID*)b);
/* Here we are using a few tricks to get the right sort.
* We want power/running cost, but since we usually got higher running cost than power and we store the result in an int,
* we will actually calculate cunning cost/power (to make it more than 1).
* Because of this, the return value have to be reversed as well and we return b - a instead of a - b.
* Another thing is that both power and running costs should be doubled for multiheaded engines.
* Since it would be multipling with 2 in both numerator and denumerator, it will even themselves out and we skip checking for multiheaded. */
* We want power/running cost, but since we usually got higher running cost than power and we store the result in an int,
* we will actually calculate cunning cost/power (to make it more than 1).
* Because of this, the return value have to be reversed as well and we return b - a instead of a - b.
* Another thing is that both power and running costs should be doubled for multiheaded engines.
* Since it would be multipling with 2 in both numerator and denumerator, it will even themselves out and we skip checking for multiheaded. */
Money va = (e_a->GetRunningCost()) / max(1U, (uint)e_a->GetPower());
Money vb = (e_b->GetRunningCost()) / max(1U, (uint)e_b->GetPower());
int r = ClampToI32(vb - va);
@ -514,7 +514,7 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const
DrawString(x, y, STR_PURCHASE_INFO_AIRCRAFT_CAPACITY, TC_FROMSTRING);
} else {
/* Note, if the default capacity is selected by the refit capacity
* callback, then the capacity shown is likely to be incorrect. */
* callback, then the capacity shown is likely to be incorrect. */
SetDParam(0, cargo);
SetDParam(1, AircraftDefaultCargoCapacity(cargo, avi));
SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
@ -809,9 +809,9 @@ struct BuildVehicleWindow : Window {
this->eng_list.Clear();
/* Make list of all available train engines and wagons.
* Also check to see if the previously selected engine is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when engines become obsolete and are removed */
* Also check to see if the previously selected engine is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when engines become obsolete and are removed */
const Engine *e;
FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
EngineID eid = e->index;
@ -891,9 +891,9 @@ struct BuildVehicleWindow : Window {
const Station *st = this->listview_mode ? NULL : GetStationByTile(this->window_number);
/* Make list of all available planes.
* Also check to see if the previously selected plane is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when planes become obsolete and are removed */
* Also check to see if the previously selected plane is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when planes become obsolete and are removed */
const Engine *e;
FOR_ALL_ENGINES_OF_TYPE(e, VEH_AIRCRAFT) {
EngineID eid = e->index;

@ -725,12 +725,12 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
#ifdef ENABLE_NETWORK
/* Joining Client:
* _local_company: COMPANY_SPECTATOR
* _network_playas/cid = requested company/clientid
*
* Other client(s)/server:
* _local_company/_network_playas: what they play as
* cid = requested company/company of joining client */
* _local_company: COMPANY_SPECTATOR
* _network_playas/cid = requested company/clientid
*
* Other client(s)/server:
* _local_company/_network_playas: what they play as
* cid = requested company/company of joining client */
ClientID cid = (ClientID)p2;
/* Has the network client a correct ClientIndex? */
@ -766,7 +766,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
_current_company = _local_company;
/* Now that we have a new company, broadcast our autorenew settings to
* all clients so everything is in sync */
* all clients so everything is in sync */
NetworkSend_Command(0,
(_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4,
_settings_client.gui.autorenew_money,
@ -780,8 +780,8 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (_network_server) {
/* XXX - UGLY! p2 (pid) is mis-used to fetch the client-id, done at
* server-side in network_server.c:838, function
* DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) */
* server side in network_server.c:838, function
* DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND) */
CompanyID old_playas = ci->client_playas;
ci->client_playas = c->index;
NetworkUpdateClientInfo(ci->client_id);
@ -793,16 +793,16 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
NetworkServerUpdateCompanyPassworded(ci->client_playas, false);
/* XXX - When a client joins, we automatically set its name to the
* client's name (for some reason). As it stands now only the server
* knows the client's name, so it needs to send out a "broadcast" to
* do this. To achieve this we send a network command. However, it
* uses _local_company to execute the command as. To prevent abuse
* (eg. only yourself can change your name/company), we 'cheat' by
* impersonation _local_company as the server. Not the best solution;
* but it works.
* TODO: Perhaps this could be improved by when the client is ready
* with joining to let it send itself the command, and not the server?
* For example in network_client.c:534? */
* client's name (for some reason). As it stands now only the server
* knows the client's name, so it needs to send out a "broadcast" to
* do this. To achieve this we send a network command. However, it
* uses _local_company to execute the command as. To prevent abuse
* (eg. only yourself can change your name/company), we 'cheat' by
* impersonation _local_company as the server. Not the best solution;
* but it works.
* TODO: Perhaps this could be improved by when the client is ready
* with joining to let it send itself the command, and not the server?
* For example in network_client.c:534? */
_local_company = ci->client_playas;
NetworkSend_Command(0, 0, 0, CMD_RENAME_PRESIDENT, NULL, ci->client_name);
_local_company = company_backup;

@ -877,8 +877,8 @@ public:
/* Disable dynamically the widgets which CompanyManagerFaceVariable has less than 2 options
* (or in other words you haven't any choice).
* If the widgets depend on a HAS-variable and this is false the widgets will be disabled, too. */
* (or in other words you haven't any choice).
* If the widgets depend on a HAS-variable and this is false the widgets will be disabled, too. */
/* Eye colour buttons */
this->SetWidgetsDisabledState(_cmf_info[CMFV_EYE_COLOUR].valid_values[this->ge] < 2,
@ -1037,10 +1037,10 @@ public:
default:
/* For all buttons from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R is the same function.
* Therefor is this combined function.
* First it checks which CompanyManagerFaceVariable will be change and then
* a: invert the value for boolean variables
* or b: it checks inside of IncreaseCompanyManagerFaceBits() if a left (_L) butten is pressed and then decrease else increase the variable */
* Therefor is this combined function.
* First it checks which CompanyManagerFaceVariable will be change and then
* a: invert the value for boolean variables
* or b: it checks inside of IncreaseCompanyManagerFaceBits() if a left (_L) butten is pressed and then decrease else increase the variable */
if (this->advanced && widget >= SCMFW_WIDGET_HAS_MOUSTACHE_EARRING && widget <= SCMFW_WIDGET_GLASSES_R) {
CompanyManagerFaceVariable cmfv; // which CompanyManagerFaceVariable shall be edited

@ -204,7 +204,7 @@ struct IConsoleWindow : Window
const int scroll_height = (this->height / ICON_LINE_HEIGHT) - 1;
switch (keycode) {
case WKC_UP:
IConsoleHistoryNavigate(+1);
IConsoleHistoryNavigate(1);
this->SetDirty();
break;

@ -64,12 +64,12 @@ struct MakeEnumPropsT {
/** In some cases we use byte or uint16 to store values that are defined as enum. It is
* necessary in order to control the sizeof() such values. Some compilers make enum
* the same size as int (4 or 8 bytes instead of 1 or 2). As a consequence the strict
* compiler type - checking causes errors like:
* 'HasPowerOnRail' : cannot convert parameter 1 from 'byte' to 'RailType' when
* u->u.rail.railtype is passed as argument or type RailType. In such cases it is better
* to teach the compiler that u->u.rail.railtype is to be treated as RailType. */
* necessary in order to control the sizeof() such values. Some compilers make enum
* the same size as int (4 or 8 bytes instead of 1 or 2). As a consequence the strict
* compiler type - checking causes errors like:
* 'HasPowerOnRail' : cannot convert parameter 1 from 'byte' to 'RailType' when
* u->u.rail.railtype is passed as argument or type RailType. In such cases it is better
* to teach the compiler that u->u.rail.railtype is to be treated as RailType. */
template <typename Tenum_t> struct TinyEnumT;
/** The general declaration of TinyEnumT<> (above) */

@ -167,7 +167,7 @@ static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Veh
uint _block_sizes[4][2];
/* Array to hold the default resize capacities
* First part is the vehicle type, while the last is 0 = x, 1 = y */
* First part is the vehicle type, while the last is 0 = x, 1 = y */
const uint _resize_cap[][2] = {
/* VEH_TRAIN */ {6, 10 * 29},
/* VEH_ROAD */ {5, 5},
@ -255,11 +255,11 @@ struct DepotWindow : Window {
}
/** Draw a vehicle in the depot window in the box with the top left corner at x,y
* @param *w Window to draw in
* @param *v Vehicle to draw
* @param x Left side of the box to draw in
* @param y Top of the box to draw in
*/
* @param *w Window to draw in
* @param *v Vehicle to draw
* @param x Left side of the box to draw in
* @param y Top of the box to draw in
*/
void DrawVehicleInDepot(Window *w, const Vehicle *v, int x, int y)
{
byte diff_x = 0, diff_y = 0;
@ -550,10 +550,10 @@ struct DepotWindow : Window {
}
/**
* Clones a vehicle
* @param *v is the original vehicle to clone
* @param *w is the window of the depot where the clone is build
*/
* Clones a vehicle
* @param *v is the original vehicle to clone
* @param *w is the window of the depot where the clone is build
*/
void HandleCloneVehClick(const Vehicle *v, const Window *w)
{
uint error_str;
@ -585,7 +585,7 @@ struct DepotWindow : Window {
if (this->type == VEH_TRAIN) {
/* Divide the size of DEPOT_WIDGET_SELL into two equally big buttons so DEPOT_WIDGET_SELL and DEPOT_WIDGET_SELL_CHAIN will get the same size.
* This way it will stay the same even if DEPOT_WIDGET_SELL_CHAIN is resized for some reason */
* This way it will stay the same even if DEPOT_WIDGET_SELL_CHAIN is resized for some reason */
this->widget[DEPOT_WIDGET_SELL_CHAIN].top = ((this->widget[DEPOT_WIDGET_SELL_CHAIN].bottom - this->widget[DEPOT_WIDGET_SELL].top) / 2) + this->widget[DEPOT_WIDGET_SELL].top;
this->widget[DEPOT_WIDGET_SELL].bottom = this->widget[DEPOT_WIDGET_SELL_CHAIN].top - 1;
}

@ -190,7 +190,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
do {
min_income = min(min_income, cee->income + cee->expenses);
max_income = max(max_income, cee->income + cee->expenses);
} while (++cee,--numec);
} while (++cee, --numec);
if (min_income > 0) {
_score_part[owner][SCORE_MIN_INCOME] = ClampToI32(min_income);
@ -212,7 +212,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
total_delivered = 0;
do {
total_delivered += cee->delivered_cargo;
} while (++cee,--numec);
} while (++cee, --numec);
_score_part[owner][SCORE_DELIVERED] = total_delivered;
}
@ -962,7 +962,7 @@ struct FoundRoute {
static void FindSubsidyPassengerRoute(FoundRoute *fr)
{
Town *from,*to;
Town *from, *to;
fr->distance = UINT_MAX;
@ -1062,13 +1062,13 @@ static void SubsidyMonthlyHandler()
for (s = _subsidies; s != endof(_subsidies); s++) {
if (s->cargo_type == CT_INVALID) continue;
if (s->age == 12-1) {
if (s->age == 12 - 1) {
pair = SetupSubsidyDecodeParam(s, 1);
AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NS_SUBSIDIES, pair.a, pair.b);
s->cargo_type = CT_INVALID;
modified = true;
AI::BroadcastNewEvent(new AIEventSubsidyOfferExpired(s - _subsidies));
} else if (s->age == 2*12-1) {
} else if (s->age == 2 * 12 - 1) {
st = GetStation(s->to);
if (st->owner == _local_company) {
pair = SetupSubsidyDecodeParam(s, 1);
@ -1083,7 +1083,7 @@ static void SubsidyMonthlyHandler()
}
/* 25% chance to go on */
if (Chance16(1,4)) {
if (Chance16(1, 4)) {
/* Find a free slot*/
s = _subsidies;
while (s->cargo_type != CT_INVALID) {
@ -1734,7 +1734,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
if (anything_loaded || anything_unloaded) {
if (_settings_game.order.gradual_loading) {
/* The time it takes to load one 'slice' of cargo or passengers depends
* on the vehicle type - the values here are those found in TTDPatch */
* on the vehicle type - the values here are those found in TTDPatch */
const uint gradual_loading_wait_time[] = { 40, 20, 10, 20 };
unloading_time = gradual_loading_wait_time[v->type];

@ -552,12 +552,12 @@ bool SettingsDisableElrail(int32 p1)
}
/* when disabling elrails, make sure that all existing trains can run on
* normal rail too */
* normal rail too */
if (disable) {
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_TRAIN && v->u.rail.railtype == RAILTYPE_ELECTRIC) {
/* this railroad vehicle is now compatible only with elrail,
* so add there also normal rail compatibility */
* so add there also normal rail compatibility */
v->u.rail.compatible_railtypes |= RAILTYPES_RAIL;
v->u.rail.railtype = RAILTYPE_RAIL;
SetBit(v->u.rail.flags, VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL);
@ -577,8 +577,8 @@ bool SettingsDisableElrail(int32 p1)
FOR_ALL_COMPANIES(c) c->avail_railtypes = GetCompanyRailtypes(c->index);
/* This resets the _last_built_railtype, which will be invalid for electric
* rails. It may have unintended consequences if that function is ever
* extended, though. */
* rails. It may have unintended consequences if that function is ever
* extended, though. */
ReinitGuiAfterToggleElrail(disable);
return true;
}

@ -673,7 +673,7 @@ void EnginesMonthlyLoop()
if (!(e->flags & ENGINE_AVAILABLE) && _date >= (e->intro_date + DAYS_IN_YEAR)) {
/* Introduce it to all companies */
NewVehicleAvailable(e);
} else if (!(e->flags & (ENGINE_AVAILABLE|ENGINE_EXCLUSIVE_PREVIEW)) && _date >= e->intro_date) {
} else if (!(e->flags & (ENGINE_AVAILABLE | ENGINE_EXCLUSIVE_PREVIEW)) && _date >= e->intro_date) {
/* Introduction date has passed.. show introducing dialog to one companies. */
e->flags |= ENGINE_EXCLUSIVE_PREVIEW;

@ -376,8 +376,8 @@ static FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
if (font_style != NULL && strcasecmp(font_style, (char*)style) != 0) continue;
/* Font config takes the best shot, which, if the family name is spelled
* wrongly a 'random' font, so check whether the family name is the
* same as the supplied name */
* wrongly a 'random' font, so check whether the family name is the
* same as the supplied name */
if (strcasecmp(font_family, (char*)family) == 0) {
err = FT_New_Face(_library, (char *)file, 0, face);
}

@ -555,10 +555,9 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
EventState state;
this->HandleEditBoxKey(GLAND_RANDOM_EDITBOX, key, keycode, state);
/* the seed is unsigned, therefore atoi cannot be used.
* As 2^32 - 1 (UINT32_MAX) is a 'magic' value
* (use random seed) it should not be possible to be
* entered into the input field; the generate seed
* button can be used instead. */
* As UINT32_MAX is a 'magic' value (use random seed) it
* should not be possible to be entered into the input
* field; the generate seed button can be used instead. */
_settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, 10), UINT32_MAX - 1);
return state;
}

@ -125,8 +125,8 @@ protected:
GRAPH_NUM_LINES_Y = 9, ///< How many horizontal lines to draw.
/* 9 is convenient as that means the distance between them is the gd_height of the graph / 8,
* which is the same
* as height >> 3. */
* which is the same
* as height >> 3. */
};
uint excluded_data; ///< bitmask of the datasets that shouldn't be displayed.
@ -159,7 +159,7 @@ protected:
int x_axis_offset; ///< Distance from the top of the graph to the x axis.
/* the colours and cost array of GraphDrawer must accomodate
* both values for cargo and companies. So if any are higher, quit */
* both values for cargo and companies. So if any are higher, quit */
assert(GRAPH_MAX_DATASETS >= (int)NUM_CARGO && GRAPH_MAX_DATASETS >= (int)MAX_COMPANIES);
assert(this->num_vert_lines > 0);
@ -209,9 +209,9 @@ protected:
assert(this->num_dataset > 0);
/* Start of with a value of twice the gd_height of the graph in pixels. It's a
* bit arbitrary, but it makes the cargo payment graph look a little nicer,
* and prevents division by zero when calculating where the datapoint
* should be drawn. */
* bit arbitrary, but it makes the cargo payment graph look a little nicer,
* and prevents division by zero when calculating where the datapoint
* should be drawn. */
highest_value = x_axis_offset * 2;
for (int i = 0; i < this->num_dataset; i++) {
@ -221,8 +221,8 @@ protected:
if (datapoint != INVALID_DATAPOINT) {
/* For now, if the graph has negative values the scaling is
* symmetrical about the x axis, so take the absolute value
* of each data point. */
* symmetrical about the x axis, so take the absolute value
* of each data point. */
highest_value = max(highest_value, abs(datapoint));
}
}
@ -230,7 +230,7 @@ protected:
}
/* Round up highest_value so that it will divide cleanly into the number of
* axis labels used. */
* axis labels used. */
int round_val = highest_value % (GRAPH_NUM_LINES_Y - 1);
if (round_val != 0) highest_value += (GRAPH_NUM_LINES_Y - 1 - round_val);
@ -239,7 +239,7 @@ protected:
int64 y_label_separation = highest_value / (GRAPH_NUM_LINES_Y - 1);
/* If there are negative values, the graph goes from highest_value to
* -highest_value, not highest_value to 0. */
* -highest_value, not highest_value to 0. */
if (this->has_negative_values) y_label_separation *= 2;
x = this->gd_left + GRAPH_X_POSITION_BEGINNING + 1;
@ -303,16 +303,16 @@ protected:
if (datapoint != INVALID_DATAPOINT) {
/*
* Check whether we need to reduce the 'accuracy' of the
* datapoint value and the highest value to splut overflows.
* And when 'drawing' 'one million' or 'one million and one'
* there is no significant difference, so the least
* significant bits can just be removed.
*
* If there are more bits needed than would fit in a 32 bits
* integer, so at about 31 bits because of the sign bit, the
* least significant bits are removed.
*/
* Check whether we need to reduce the 'accuracy' of the
* datapoint value and the highest value to splut overflows.
* And when 'drawing' 'one million' or 'one million and one'
* there is no significant difference, so the least
* significant bits can just be removed.
*
* If there are more bits needed than would fit in a 32 bits
* integer, so at about 31 bits because of the sign bit, the
* least significant bits are removed.
*/
int mult_range = FindLastBit(x_axis_offset) + FindLastBit(abs(datapoint));
int reduce_range = max(mult_range - 31, 0);
@ -1008,7 +1008,7 @@ public:
if (i == SCORE_LOAN) val = needed - val;
/* Draw the amount we have against what is needed
* For some of them it is in currency format */
* For some of them it is in currency format */
SetDParam(0, val);
SetDParam(1, needed);
switch (i) {

@ -388,7 +388,7 @@ public:
this->DrawWidgets();
/* Draw Matrix Group
* The selected group is drawn in white */
* The selected group is drawn in white */
StringID str_all_veh, str_no_group_veh;
switch (this->vehicle_type) {

@ -1921,14 +1921,14 @@ static bool CheckIndustryCloseDownProtection(IndustryType type)
}
/**
* Can given cargo type be accepted or produced by the industry?
* @param cargo: Cargo type
* @param ind: Industry
* @param *c_accepts: Pointer to boolean for acceptance of cargo
* @param *c_produces: Pointer to boolean for production of cargo
* @return: \c *c_accepts is set when industry accepts the cargo type,
* \c *c_produces is set when the industry produces the cargo type
*/
* Can given cargo type be accepted or produced by the industry?
* @param cargo: Cargo type
* @param ind: Industry
* @param *c_accepts: Pointer to boolean for acceptance of cargo
* @param *c_produces: Pointer to boolean for production of cargo
* @return: \c *c_accepts is set when industry accepts the cargo type,
* \c *c_produces is set when the industry produces the cargo type
*/
static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accepts, bool *c_produces)
{
const IndustrySpec *indspec = GetIndustrySpec(ind->type);
@ -1959,18 +1959,18 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
}
/**
* Compute who can service the industry.
*
* Here, 'can service' means that he/she has trains and stations close enough
* to the industry with the right cargo type and the right orders (ie has the
* technical means).
*
* @param ind: Industry being investigated.
*
* @return: 0 if nobody can service the industry, 2 if the local company can
* service the industry, and 1 otherwise (only competitors can service the
* industry)
*/
* Compute who can service the industry.
*
* Here, 'can service' means that he/she has trains and stations close enough
* to the industry with the right cargo type and the right orders (ie has the
* technical means).
*
* @param ind: Industry being investigated.
*
* @return: 0 if nobody can service the industry, 2 if the local company can
* service the industry, and 1 otherwise (only competitors can service the
* industry)
*/
int WhoCanServiceIndustry(Industry *ind)
{
/* Find all stations within reach of the industry */
@ -2024,12 +2024,12 @@ int WhoCanServiceIndustry(Industry *ind)
}
/**
* Report news that industry production has changed significantly
*
* @param ind: Industry with changed production
* @param type: Cargo type that has changed
* @param percent: Percentage of change (>0 means increase, <0 means decrease)
*/
* Report news that industry production has changed significantly
*
* @param ind: Industry with changed production
* @param type: Cargo type that has changed
* @param percent: Percentage of change (>0 means increase, <0 means decrease)
*/
static void ReportNewsProductionChangeIndustry(Industry *ind, CargoID type, int percent)
{
NewsSubtype ns;

@ -219,9 +219,9 @@ struct MainWindow : Window
}
/* Disable all key shortcuts, except quit shortcuts when
* generating the world, otherwise they create threading
* problem during the generating, resulting in random
* assertions that are hard to trigger and debug */
* generating the world, otherwise they create threading
* problem during the generating, resulting in random
* assertions that are hard to trigger and debug */
if (IsGeneratingWorld()) return ES_NOT_HANDLED;
if (keycode == WKC_BACKQUOTE) {

@ -9,34 +9,34 @@
#include "../core/mem_func.hpp"
/** Base class for simple binary blobs.
* Item is byte.
* The word 'simple' means:
* - no configurable allocator type (always made from heap)
* - no smart deallocation - deallocation must be called from the same
* module (DLL) where the blob was allocated
* - no configurable allocation policy (how big blocks should be allocated)
* - no extra ownership policy (i.e. 'copy on write') when blob is copied
* - no thread synchronization at all
*
* Internal member layout:
* 1. The only class member is pointer to the first item (see union ptr_u).
* 2. Allocated block contains the blob header (see CHdr) followed by the raw byte data.
* Always, when it allocates memory the allocated size is:
* sizeof(CHdr) + <data capacity>
* 3. Two 'virtual' members (m_size and m_max_size) are stored in the CHdr at beginning
* of the alloated block.
* 4. The pointter (in ptr_u) pobsize_ts behind the header (to the first data byte).
* When memory block is allocated, the sizeof(CHdr) it added to it.
* 5. Benefits of this layout:
* - items are accessed in the simplest possible way - just dereferencing the pointer,
* which is good for performance (assuming that data are accessed most often).
* - sizeof(blob) is the same as the size of any other pointer
* 6. Drawbacks of this layout:
* - the fact, that pointer to the alocated block is adjusted by sizeof(CHdr) before
* it is stored can lead to several confusions:
* - it is not common pattern so the implementation code is bit harder to read
* - valgrind can generate warning that allocated block is lost (not accessible)
* */
* Item is byte.
* The word 'simple' means:
* - no configurable allocator type (always made from heap)
* - no smart deallocation - deallocation must be called from the same
* module (DLL) where the blob was allocated
* - no configurable allocation policy (how big blocks should be allocated)
* - no extra ownership policy (i.e. 'copy on write') when blob is copied
* - no thread synchronization at all
*
* Internal member layout:
* 1. The only class member is pointer to the first item (see union ptr_u).
* 2. Allocated block contains the blob header (see CHdr) followed by the raw byte data.
* Always, when it allocates memory the allocated size is:
* sizeof(CHdr) + <data capacity>
* 3. Two 'virtual' members (m_size and m_max_size) are stored in the CHdr at beginning
* of the alloated block.
* 4. The pointter (in ptr_u) pobsize_ts behind the header (to the first data byte).
* When memory block is allocated, the sizeof(CHdr) it added to it.
* 5. Benefits of this layout:
* - items are accessed in the simplest possible way - just dereferencing the pointer,
* which is good for performance (assuming that data are accessed most often).
* - sizeof(blob) is the same as the size of any other pointer
* 6. Drawbacks of this layout:
* - the fact, that pointer to the alocated block is adjusted by sizeof(CHdr) before
* it is stored can lead to several confusions:
* - it is not common pattern so the implementation code is bit harder to read
* - valgrind can generate warning that allocated block is lost (not accessible)
*/
class CBlobBaseSimple {
public:
typedef ::ptrdiff_t bsize_t;
@ -93,7 +93,7 @@ public:
protected:
/** initialize the empty blob by setting the ptr_u.m_pHdr_1 pointer to the static CHdr with
* both m_size and m_max_size containing zero */
* both m_size and m_max_size containing zero */
FORCEINLINE void InitEmpty()
{
static CHdr hdrEmpty[] = {{0, 0}, {0, 0}};
@ -217,7 +217,7 @@ public:
}
/** Reallocate if there is no free space for num_bytes bytes.
* @return pointer to the new data to be added */
* @return pointer to the new data to be added */
FORCEINLINE bitem_t *MakeRawFreeSpace(bsize_t num_bytes)
{
assert(num_bytes >= 0);
@ -227,7 +227,7 @@ public:
}
/** Increase RawSize() by num_bytes.
* @return pointer to the new data added */
* @return pointer to the new data added */
FORCEINLINE bitem_t *GrowRawSize(bsize_t num_bytes)
{
bitem_t *pNewData = MakeRawFreeSpace(num_bytes);
@ -312,12 +312,12 @@ public:
};
/** Blob - simple dynamic Titem_ array. Titem_ (template argument) is a placeholder for any type.
* Titem_ can be any integral type, pointer, or structure. Using Blob instead of just plain C array
* simplifies the resource management in several ways:
* 1. When adding new item(s) it automatically grows capacity if needed.
* 2. When variable of type Blob comes out of scope it automatically frees the data buffer.
* 3. Takes care about the actual data size (number of used items).
* 4. Dynamically constructs only used items (as opposite of static array which constructs all items) */
* Titem_ can be any integral type, pointer, or structure. Using Blob instead of just plain C array
* simplifies the resource management in several ways:
* 1. When adding new item(s) it automatically grows capacity if needed.
* 2. When variable of type Blob comes out of scope it automatically frees the data buffer.
* 3. Takes care about the actual data size (number of used items).
* 4. Dynamically constructs only used items (as opposite of static array which constructs all items) */
template <class Titem_, class Tbase_ = CBlobBaseSimple>
class CBlobT : public Tbase_ {
// make template arguments public:
@ -504,7 +504,7 @@ public:
}
/** Ensures that given number of items can be added to the end of Blob. Returns pointer to the
* first free (unused) item */
* first free (unused) item */
FORCEINLINE Titem *MakeFreeSpace(bsize_t num_items)
{
return (Titem*)Tbase::MakeRawFreeSpace(num_items * Titem_size);

@ -23,9 +23,9 @@ template <typename T, size_t N> struct ArrayT<T[N]> {
/**
* Helper template function that returns item of array at given index
* or t_unk when index is out of bounds.
*/
* Helper template function that returns item of array at given index
* or t_unk when index is out of bounds.
*/
template <typename E, typename T>
inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_t t_unk)
{
@ -36,10 +36,10 @@ inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_
}
/**
* Helper template function that returns item of array at given index
* or t_inv when index == idx_inv
* or t_unk when index is out of bounds.
*/
* Helper template function that returns item of array at given index
* or t_inv when index == idx_inv
* or t_unk when index is out of bounds.
*/
template <typename E, typename T>
inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_t t_unk, E idx_inv, typename ArrayT<T>::item_t t_inv)
{
@ -53,11 +53,11 @@ inline typename ArrayT<T>::item_t ItemAtT(E idx, T &t, typename ArrayT<T>::item_
}
/**
* Helper template function that returns compound bitfield name that is
* concatenation of names of each set bit in the given value
* or t_inv when index == idx_inv
* or t_unk when index is out of bounds.
*/
* Helper template function that returns compound bitfield name that is
* concatenation of names of each set bit in the given value
* or t_inv when index == idx_inv
* or t_unk when index is out of bounds.
*/
template <typename E, typename T>
inline CStrA ComposeNameT(E value, T &t, const char *t_unk, E val_inv, const char *name_inv)
{

@ -17,9 +17,9 @@
#endif /* HAS_WCHAR */
/** String API mapper base - just mapping by character type, not by case sensitivity yet.
* Class template CStrApiBaseT declaration is general, but following inline method
* definitions are specialized by character type. Class is not used directly, but only
* as a base class for template class CStrApiT */
* Class template CStrApiBaseT declaration is general, but following inline method
* definitions are specialized by character type. Class is not used directly, but only
* as a base class for template class CStrApiT */
template <typename Tchar>
class CStrApiBaseT
{

@ -318,7 +318,7 @@ public:
/* Then, try townnames */
/* Not that the following assumes all town indices are adjacent, ie no
* towns have been deleted. */
* towns have been deleted. */
if (*item <= (uint)MAX_CLIENT_SLOTS + GetMaxTownIndex()) {
const Town *t;
@ -375,7 +375,7 @@ public:
if (_chat_tab_completion_active) {
/* We are pressing TAB again on the same name, is there an other name
* that starts with this? */
* that starts with this? */
if (!second_scan) {
size_t offset;
size_t length;

@ -257,9 +257,9 @@ void ClientNetworkContentSocketHandler::DownloadSelectedContent(uint &files, uin
while (count > 0) {
/* We can "only" send a limited number of IDs in a single packet.
* A packet begins with the packet size and a byte for the type.
* Then this packet adds a uint16 for the count in this packet.
* The rest of the packet can be used for the IDs. */
* A packet begins with the packet size and a byte for the type.
* Then this packet adds a uint16 for the count in this packet.
* The rest of the packet can be used for the IDs. */
uint p_count = min(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32));
Packet *p = new Packet(PACKET_CONTENT_CLIENT_CONTENT);

@ -713,8 +713,8 @@ public:
SetVScrollCount(this, this->servers.Length());
/* Additional colums in server list */
if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE)
+ GetWidgetWidth(NGWW_DATE) + GetWidgetWidth(NGWW_YEARS)) {
if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE) +
GetWidgetWidth(NGWW_DATE) + GetWidgetWidth(NGWW_YEARS)) {
/* show columns 'Map size', 'Date' and 'Years' */
this->SetWidgetsHiddenState(false, NGWW_MAPSIZE, NGWW_DATE, NGWW_YEARS, WIDGET_LIST_END);
AlignWidgetRight(NGWW_YEARS, NGWW_INFO);
@ -1028,7 +1028,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
case NSSW_LOAD: // Load game
_is_network_server = true;
/* XXX - WC_NETWORK_WINDOW (this window) should stay, but if it stays, it gets
* copied all the elements of 'load game' and upon closing that, it segfaults */
* copied all the elements of 'load game' and upon closing that, it segfaults */
delete this;
ShowSaveLoadDialog(SLD_LOAD_GAME);
break;

@ -117,7 +117,7 @@ static uint32 RotateRight(uint32 val, uint32 rot)
/* Evaluate an adjustment for a variable of the given size.
* U is the unsigned type and S is the signed type to use. */
* U is the unsigned type and S is the signed type to use. */
template <typename U, typename S>
static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ResolverObject *object, U last_value, uint32 value)
{

@ -843,7 +843,7 @@ struct MessageOptionsWindow : Window {
/* Draw the string of each setting on each button. */
for (int i = 0, y = 26; i < NT_END; i++, y += 12) {
/* 51 comes from 13 + 89 (left and right of the button)+1, shiefted by one as to get division,
* which will give centered position */
* which will give centered position */
DrawStringCentered(51, y + 1, _message_opt[_news_type_data[i].display], TC_BLACK);
}
}
@ -890,28 +890,28 @@ struct MessageOptionsWindow : Window {
/*
* The news settings window widgets
*
* Main part of the window is a list of news-setting lines, one for each news category.
* Each line is constructed by an expansion of the \c NEWS_SETTINGS_LINE macro
*/
* The news settings window widgets
*
* Main part of the window is a list of news setting lines, one for each news category.
* Each line is constructed by an expansion of the \c NEWS_SETTINGS_LINE macro
*/
/**
* Macro to construct one news-setting line in the news-settings window.
* One line consists of four widgets, namely
* - A [<] button
* - A [...] label
* - A [>] button
* - A text label describing the news category
* Horizontal positions of the widgets are hard-coded, vertical start position is (\a basey + \a linenum * \c NEWS_SETTING_BASELINE_SKIP).
* Height of one line is 12, with the text label shifted 1 pixel down.
*
* First line should be widget number WIDGET_NEWSOPT_START_OPTION
*
* @param basey: Base Y coordinate
* @param linenum: Count, news-setting is the \a linenum-th line
* @param text: StringID for the text label to display
*/
* Macro to construct one news setting line in the news - settings window.
* One line consists of four widgets, namely
* - A [<] button
* - A [...] label
* - A [>] button
* - A text label describing the news category
* Horizontal positions of the widgets are hard coded, vertical start position is (\a basey + \a linenum * \c NEWS_SETTING_BASELINE_SKIP).
* Height of one line is 12, with the text label shifted 1 pixel down.
*
* First line should be widget number WIDGET_NEWSOPT_START_OPTION
*
* @param basey: Base Y coordinate
* @param linenum: Count, news - setting is the \a linenum - th line
* @param text: StringID for the text label to display
*/
#define NEWS_SETTINGS_LINE(basey, linenum, text) \
{ WWT_PUSHIMGBTN, RESIZE_NONE, COLOUR_YELLOW, \
4, 12, basey + linenum * NEWS_SETTING_BASELINE_SKIP, basey + 11 + linenum * NEWS_SETTING_BASELINE_SKIP, \

@ -217,7 +217,7 @@ struct MyGetOptData {
static int MyGetOpt(MyGetOptData *md)
{
const char *s,*r,*t;
const char *s, *r, *t;
s = md->cont;
if (s != NULL)
@ -942,7 +942,7 @@ void SwitchToMode(SwitchMode new_mode)
StartupEngines();
}
/* Update the local company for a loaded game. It is either always
* company #1 (eg 0) or in the case of a dedicated server a spectator */
* company #1 (eg 0) or in the case of a dedicated server a spectator */
SetLocalCompany(_network_dedicated ? COMPANY_SPECTATOR : COMPANY_FIRST);
/* Execute the game-start script */
IConsoleCmdExec("exec scripts/game_start.scr 0");

@ -1112,13 +1112,13 @@ public:
{
const Vehicle *v = _place_clicked_vehicle;
/*
* Check if we clicked on a vehicle
* and if the GOTO button of this window is pressed
* This is because of all open order windows WE_MOUSELOOP is called
* and if you have 3 windows open, and this check is not done
* the order is copied to the last open window instead of the
* one where GOTO is enabled
*/
* Check if we clicked on a vehicle
* and if the GOTO button of this window is pressed
* This is because of all open order windows WE_MOUSELOOP is called
* and if you have 3 windows open, and this check is not done
* the order is copied to the last open window instead of the
* one where GOTO is enabled
*/
if (v != NULL && this->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
_place_clicked_vehicle = NULL;
this->HandleOrderVehClick(v);

@ -624,7 +624,7 @@ struct BuildRailToolbarWindow : Window {
switch (clicked_widget) {
case RTW_REMOVE:
/* If it is the removal button that has been clicked, do nothing,
* as it is up to the other buttons to drive removal status */
* as it is up to the other buttons to drive removal status */
return;
break;
case RTW_BUILD_NS:
@ -636,13 +636,13 @@ struct BuildRailToolbarWindow : Window {
case RTW_BUILD_STATION:
case RTW_BUILD_SIGNALS:
/* Removal button is enabled only if the rail/signal/waypoint/station
* button is still lowered. Once raised, it has to be disabled */
* button is still lowered. Once raised, it has to be disabled */
this->SetWidgetDisabledState(RTW_REMOVE, !this->IsWidgetLowered(clicked_widget));
break;
default:
/* When any other buttons than rail/signal/waypoint/station, raise and
* disable the removal button */
* disable the removal button */
this->DisableWidget(RTW_REMOVE);
this->RaiseWidget(RTW_REMOVE);
break;
@ -862,7 +862,7 @@ static void HandleStationPlacement(TileIndex start, TileIndex end)
uint sy = TileY(start);
uint ex = TileX(end);
uint ey = TileY(end);
uint w,h;
uint w, h;
if (sx > ex) Swap(sx, ex);
if (sy > ey) Swap(sy, ey);

@ -596,9 +596,9 @@ struct BuildRoadToolbarWindow : Window {
case DDSP_PLACE_ROAD_Y_DIR:
case DDSP_PLACE_AUTOROAD:
/* Flag description:
* Use the first three bits (0x07) if dir == Y
* else use the last 2 bits (X dir has
* not the 3rd bit set) */
* Use the first three bits (0x07) if dir == Y
* else use the last 2 bits (X dir has
* not the 3rd bit set) */
_place_road_flag = (RoadFlags)((_place_road_flag & RF_DIR_Y) ? (_place_road_flag & 0x07) : (_place_road_flag >> 3));
DoCommandP(end_tile, start_tile, _place_road_flag | (_cur_roadtype << 3) | (_one_way_button_clicked << 5),

@ -120,7 +120,7 @@ static inline Owner GetRoadOwner(TileIndex t, RoadType rt)
case ROADTYPE_ROAD: return (Owner)GB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5);
case ROADTYPE_TRAM: {
/* Trams don't need OWNER_TOWN, and remapping OWNER_NONE
* to OWNER_TOWN makes it use one bit less */
* to OWNER_TOWN makes it use one bit less */
Owner o = (Owner)GB(_m[t].m3, 4, 4);
return o == OWNER_TOWN ? OWNER_NONE : o;
}

@ -691,9 +691,9 @@ static bool LoadOldCargoPaymentRate(LoadgameState *ls, int num)
if (_savegame_type == SGT_TTO) {
/* SVXConverter about cargo payment rates correction:
* "increase them to compensate for the faster time advance in TTD compared to TTO
* which otherwise would cause much less income while the annual running costs of
* the vehicles stay the same" */
* "increase them to compensate for the faster time advance in TTD compared to TTO
* which otherwise would cause much less income while the annual running costs of
* the vehicles stay the same" */
Money m = ((((Money)_old_price) << 16) + (uint)_old_price_frac) * 124 / 74;
@ -1039,15 +1039,15 @@ static bool LoadOldCompany(LoadgameState *ls, int num)
c->name_1 = STR_SV_UNNAMED;
} else {
/* Beside some multiplayer maps (1 on 1), which we don't official support,
* all other companys are an AI.. mark them as such */
* all other companys are an AI.. mark them as such */
c->is_ai = true;
}
/* Sometimes it is better to not ask.. in old scenarios, the money
* was always 893288 pounds. In the newer versions this is correct,
* but correct for those oldies
* Ps: this also means that if you had exact 893288 pounds, you will go back
* to 100000.. this is a very VERY small chance ;) */
* was always 893288 pounds. In the newer versions this is correct,
* but correct for those oldies
* Ps: this also means that if you had exact 893288 pounds, you will go back
* to 100000.. this is a very VERY small chance ;) */
if (c->money == 893288) c->money = c->current_loan = 100000;
}

@ -602,7 +602,7 @@ static void ShipController(Vehicle *v)
if (HasBit(r, VETS_CANNOT_ENTER)) goto reverse_direction;
/* A leave station order only needs one tick to get processed, so we can
* always skip ahead. */
* always skip ahead. */
if (v->current_order.IsType(OT_LEAVESTATION)) {
v->current_order.Free();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
@ -612,7 +612,7 @@ static void ShipController(Vehicle *v)
GetStation(v->current_order.GetDestination())->IsBuoy() &&
DistanceManhattan(v->dest_tile, gp.new_tile) <= 3) {
/* We got within 3 tiles of our target buoy, so let's skip to our
* next order */
* next order */
UpdateVehicleTimetable(v, true);
v->cur_order_index++;
v->current_order.MakeDummy();

@ -35,12 +35,12 @@ void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2)
}
/**
* Draw the details for the given vehicle at the position (x,y)
*
* @param v current vehicle
* @param x The x coordinate
* @param y The y coordinate
*/
* Draw the details for the given vehicle at the position (x, y)
*
* @param v current vehicle
* @param x The x coordinate
* @param y The y coordinate
*/
void DrawShipDetails(const Vehicle *v, int x, int y)
{
SetDParam(0, v->engine_type);

@ -64,8 +64,8 @@ void UpdateAllSignVirtCoords()
void MarkSignDirty(Sign *si)
{
/* We use ZOOM_LVL_MAX here, as every viewport can have an other zoom,
* and there is no way for us to know which is the biggest. So make the
* biggest area dirty, and we are safe for sure. */
* and there is no way for us to know which is the biggest. So make the
* biggest area dirty, and we are safe for sure. */
MarkAllViewportsDirty(
si->sign.left - 6,
si->sign.top - 3,

@ -25,25 +25,25 @@
#include "table/sprites.h"
static const Widget _smallmap_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_BROWN, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_BROWN, 11, 337, 0, 13, STR_00B0_MAP, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_STICKYBOX, RESIZE_LR, COLOUR_BROWN, 338, 349, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, RESIZE_RB, COLOUR_BROWN, 0, 349, 14, 157, 0x0, STR_NULL},
{ WWT_INSET, RESIZE_RB, COLOUR_BROWN, 2, 347, 16, 155, 0x0, STR_NULL},
{ WWT_PANEL, RESIZE_RTB, COLOUR_BROWN, 0, 261, 158, 201, 0x0, STR_NULL},
{ WWT_PANEL, RESIZE_LRTB, COLOUR_BROWN, 262, 349, 158, 158, 0x0, STR_NULL},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 284, 305, 158, 179, SPR_IMG_SHOW_COUNTOURS, STR_0191_SHOW_LAND_CONTOURS_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 306, 327, 158, 179, SPR_IMG_SHOW_VEHICLES, STR_0192_SHOW_VEHICLES_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 328, 349, 158, 179, SPR_IMG_INDUSTRY, STR_0193_SHOW_INDUSTRIES_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 284, 305, 180, 201, SPR_IMG_SHOW_ROUTES, STR_0194_SHOW_TRANSPORT_ROUTES_ON},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 306, 327, 180, 201, SPR_IMG_PLANTTREES, STR_0195_SHOW_VEGETATION_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 328, 349, 180, 201, SPR_IMG_COMPANY_GENERAL, STR_0196_SHOW_LAND_OWNERS_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 262, 283, 158, 179, SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 262, 283, 180, 201, SPR_IMG_TOWN, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF},
{ WWT_PANEL, RESIZE_RTB, COLOUR_BROWN, 0, 337, 202, 213, 0x0, STR_NULL},
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 0, 99, 202, 213, STR_MESSAGES_ENABLE_ALL, STR_NULL},
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 100, 201, 202, 213, STR_MESSAGES_DISABLE_ALL,STR_NULL},
{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_BROWN, 338, 349, 202, 213, 0x0, STR_RESIZE_BUTTON},
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_BROWN, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_BROWN, 11, 337, 0, 13, STR_00B0_MAP, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_STICKYBOX, RESIZE_LR, COLOUR_BROWN, 338, 349, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PANEL, RESIZE_RB, COLOUR_BROWN, 0, 349, 14, 157, 0x0, STR_NULL},
{ WWT_INSET, RESIZE_RB, COLOUR_BROWN, 2, 347, 16, 155, 0x0, STR_NULL},
{ WWT_PANEL, RESIZE_RTB, COLOUR_BROWN, 0, 261, 158, 201, 0x0, STR_NULL},
{ WWT_PANEL, RESIZE_LRTB, COLOUR_BROWN, 262, 349, 158, 158, 0x0, STR_NULL},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 284, 305, 158, 179, SPR_IMG_SHOW_COUNTOURS, STR_0191_SHOW_LAND_CONTOURS_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 306, 327, 158, 179, SPR_IMG_SHOW_VEHICLES, STR_0192_SHOW_VEHICLES_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 328, 349, 158, 179, SPR_IMG_INDUSTRY, STR_0193_SHOW_INDUSTRIES_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 284, 305, 180, 201, SPR_IMG_SHOW_ROUTES, STR_0194_SHOW_TRANSPORT_ROUTES_ON},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 306, 327, 180, 201, SPR_IMG_PLANTTREES, STR_0195_SHOW_VEGETATION_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 328, 349, 180, 201, SPR_IMG_COMPANY_GENERAL, STR_0196_SHOW_LAND_OWNERS_ON_MAP},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 262, 283, 158, 179, SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER},
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 262, 283, 180, 201, SPR_IMG_TOWN, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF},
{ WWT_PANEL, RESIZE_RTB, COLOUR_BROWN, 0, 337, 202, 213, 0x0, STR_NULL},
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 0, 99, 202, 213, STR_MESSAGES_ENABLE_ALL, STR_NULL},
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 100, 201, 202, 213, STR_MESSAGES_DISABLE_ALL, STR_NULL},
{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_BROWN, 338, 349, 202, 213, 0x0, STR_RESIZE_BUTTON},
{ WIDGETS_END},
};

@ -364,7 +364,7 @@ public:
assert(st->xy != INVALID_TILE);
/* Do not do the complex check HasStationInUse here, it may be even false
* when the order had been removed and the station list hasn't been removed yet */
* when the order had been removed and the station list hasn't been removed yet */
assert(st->owner == owner || (st->owner == OWNER_NONE && !st->IsBuoy()));
SetDParam(0, st->index);

@ -3,26 +3,26 @@
/** @file files.h MD5 checksum information and names of the original and extra data files. */
/*
MD5 sums of graphics files
DOS -
TRG1.GRF 9311676280e5b14077a8ee41c1b42192
TRGC.GRF ed446637e034104c5559b32c18afe78d
TRGH.GRF ee6616fb0e6ef6b24892c58c93d86fc9
TRGI.GRF da6a6c9dcc451eec88d79211437b76a8
TRGT.GRF e30e8a398ae86c03dc534a8ac7dfb3b6 (German: fcde1d7e8a74197d72a62695884b909e)
SAMPLE.CAT 422ea3dd074d2859bb51639a6e0e85da
WINDOWS -
TRG1R.GRF b04ce593d8c5016e07473a743d7d3358
TRGCR.GRF 3668f410c761a050b5e7095a2b14879b
TRGHR.GRF 06bf2b7a31766f048baac2ebe43457b1
TRGIR.GRF 0c2484ff6be49fc63a83be6ab5c38f32
TRGTR.GRF de53650517fe661ceaa3138c6edb0eb8
SAMPLE.CAT 9212e81e72badd4bbe1eaeae66458e10
*/
* MD5 sums of graphics files
*
* DOS -
*
* TRG1.GRF 9311676280e5b14077a8ee41c1b42192
* TRGC.GRF ed446637e034104c5559b32c18afe78d
* TRGH.GRF ee6616fb0e6ef6b24892c58c93d86fc9
* TRGI.GRF da6a6c9dcc451eec88d79211437b76a8
* TRGT.GRF e30e8a398ae86c03dc534a8ac7dfb3b6 (German: fcde1d7e8a74197d72a62695884b909e)
* SAMPLE.CAT 422ea3dd074d2859bb51639a6e0e85da
*
* WINDOWS -
*
* TRG1R.GRF b04ce593d8c5016e07473a743d7d3358
* TRGCR.GRF 3668f410c761a050b5e7095a2b14879b
* TRGHR.GRF 06bf2b7a31766f048baac2ebe43457b1
* TRGIR.GRF 0c2484ff6be49fc63a83be6ab5c38f32
* TRGTR.GRF de53650517fe661ceaa3138c6edb0eb8
* SAMPLE.CAT 9212e81e72badd4bbe1eaeae66458e10
*/
static MD5File _sound_sets[] = {

@ -1032,8 +1032,8 @@ struct MainToolbarWindow : Window {
GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB4, FILLRECT_CHECKER);
/* If spectator, disable all construction buttons
* ie : Build road, rail, ships, airports and landscaping
* Since enabled state is the default, just disable when needed */
* ie : Build road, rail, ships, airports and landscaping
* Since enabled state is the default, just disable when needed */
this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, TBN_RAILS, TBN_ROADS, TBN_WATER, TBN_AIR, TBN_LANDSCAPE, WIDGET_LIST_END);
/* disable company list drop downs, if there are no companies */
this->SetWidgetsDisabledState(ActiveCompanyCount() == TBN_PAUSE, TBN_STATIONS, TBN_FINANCES, TBN_TRAINS, TBN_ROADVEHS, TBN_SHIPS, TBN_AIRCRAFTS, WIDGET_LIST_END);

@ -720,9 +720,9 @@ CargoID FindFirstRefittableCargo(EngineID engine_type)
}
/** Learn the price of refitting a certain engine
* @param engine_type Which engine to refit
* @return Price for refitting
*/
* @param engine_type Which engine to refit
* @return Price for refitting
*/
CommandCost GetRefitCost(EngineID engine_type)
{
Money base_cost;

@ -513,9 +513,9 @@ CommandCost SendAllVehiclesToDepot(VehicleType type, DoCommandFlag flags, bool s
CommandCost ret = DoCommand(v->tile, v->index, (service ? 1 : 0) | DEPOT_DONT_CANCEL, flags, GetCmdSendToDepot(type));
/* Return 0 if DC_EXEC is not set this is a valid goto depot command)
* In this case we know that at least one vehicle can be sent to a depot
* and we will issue the command. We can now safely quit the loop, knowing
* it will succeed at least once. With DC_EXEC we really need to send them to the depot */
* In this case we know that at least one vehicle can be sent to a depot
* and we will issue the command. We can now safely quit the loop, knowing
* it will succeed at least once. With DC_EXEC we really need to send them to the depot */
if (CmdSucceeded(ret) && !(flags & DC_EXEC)) {
return CommandCost();
}

@ -420,9 +420,9 @@ static const WindowDesc _vehicle_refit_desc = {
};
/** Show the refit window for a vehicle
* @param *v The vehicle to show the refit window for
* @param order of the vehicle ( ? )
*/
* @param *v The vehicle to show the refit window for
* @param order of the vehicle ( ? )
*/
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent)
{
DeleteWindowById(WC_VEHICLE_REFIT, v->index);
@ -816,7 +816,7 @@ struct VehicleListWindow : public BaseVehicleListWindow {
this->owner = company;
/* Hide the widgets that we will not use in this window
* Some windows contains actions only fit for the owner */
* Some windows contains actions only fit for the owner */
if (company == _local_company) {
this->HideWidget(VLW_WIDGET_OTHER_COMPANY_FILLER);
this->SetWidgetDisabledState(VLW_WIDGET_AVAILABLE_VEHICLES, window_type != VLW_STANDARD);
@ -916,8 +916,8 @@ struct VehicleListWindow : public BaseVehicleListWindow {
this->widget[VLW_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1;
/* Set up sorting. Make the window-specific _sorting variable
* point to the correct global _sorting struct so we are freed
* from having conditionals during window operation */
* point to the correct global _sorting struct so we are freed
* from having conditionals during window operation */
switch (this->vehicle_type) {
case VEH_TRAIN: this->sorting = &_sorting.train; break;
case VEH_ROAD: this->sorting = &_sorting.roadveh; break;
@ -957,7 +957,7 @@ struct VehicleListWindow : public BaseVehicleListWindow {
case VLW_SHARED_ORDERS: /* Shared Orders */
if (this->vehicles.Length() == 0) {
/* We can't open this window without vehicles using this order
* and we should close the window when deleting the order */
* and we should close the window when deleting the order */
NOT_REACHED();
}
SetDParam(0, this->vscroll.count);

@ -379,7 +379,7 @@ class FullscreenSubdriver: public CocoaSubdriver {
* As a result, coordinate translation produces incorrect results.
* We can hack around this bug by setting the screen rect ourselves.
* This hack should be removed if/when the bug is fixed.
*/
*/
screen_rect = NSMakeRect(0, 0, display_width, display_height);
[ [ NSScreen mainScreen ] setFrame:screen_rect ];
@ -576,9 +576,9 @@ public:
}
/*
Convert local coordinate to window server (CoreGraphics) coordinate.
In fullscreen mode this just means copying the coords.
*/
* Convert local coordinate to window server (CoreGraphics) coordinate.
* In fullscreen mode this just means copying the coords.
*/
virtual CGPoint PrivateLocalToCG(NSPoint *p)
{
CGPoint cgp;

@ -2251,9 +2251,9 @@ void VpSetPlaceSizingLimit(int limit)
}
/**
* Highlights all tiles between a set of two tiles. Used in dock and tunnel placement
* @param from TileIndex of the first tile to highlight
* @param to TileIndex of the last tile to highlight */
* Highlights all tiles between a set of two tiles. Used in dock and tunnel placement
* @param from TileIndex of the first tile to highlight
* @param to TileIndex of the last tile to highlight */
void VpSetPresizeRange(TileIndex from, TileIndex to)
{
uint64 distance = DistanceManhattan(from, to) + 1;
@ -2338,19 +2338,19 @@ static bool SwapDirection(HighLightStyle style, TileIndex start_tile, TileIndex
}
/** Calculates height difference between one tile and another
* Multiplies the result to suit the standard given by minimap - 50 meters high
* To correctly get the height difference we need the direction we are dragging
* in, as well as with what kind of tool we are dragging. For example a horizontal
* autorail tool that starts in bottom and ends at the top of a tile will need the
* maximum of SW, S and SE, N corners respectively. This is handled by the lookup table below
* See _tileoffs_by_dir in map.c for the direction enums if you can't figure out
* the values yourself.
* @param style HightlightStyle of drag. This includes direction and style (autorail, rect, etc.)
* @param distance amount of tiles dragged, important for horizontal/vertical drags
* ignored for others
* @param start_tile, end_tile start and end tile of drag operation
* @return height difference between two tiles. Tile measurement tool utilizes
* this value in its tooltips */
* Multiplies the result to suit the standard given by minimap - 50 meters high
* To correctly get the height difference we need the direction we are dragging
* in, as well as with what kind of tool we are dragging. For example a horizontal
* autorail tool that starts in bottom and ends at the top of a tile will need the
* maximum of SW, S and SE, N corners respectively. This is handled by the lookup table below
* See _tileoffs_by_dir in map.c for the direction enums if you can't figure out
* the values yourself.
* @param style HightlightStyle of drag. This includes direction and style (autorail, rect, etc.)
* @param distance amount of tiles dragged, important for horizontal/vertical drags
* ignored for others
* @param start_tile, end_tile start and end tile of drag operation
* @return height difference between two tiles. Tile measurement tool utilizes
* this value in its tooltips */
static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_tile, TileIndex end_tile)
{
bool swap = SwapDirection(style, start_tile, end_tile);

@ -183,7 +183,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1
/* Move existing (recently deleted) waypoint to the new location */
/* First we update the destination for all vehicles that
* have the old waypoint in their orders. */
* have the old waypoint in their orders. */
Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_TRAIN &&

@ -87,7 +87,7 @@ public:
{
int x = TileX(this->wp->xy) * TILE_SIZE;
int y = TileY(this->wp->xy) * TILE_SIZE;
ScrollWindowTo(x,y, this);
ScrollWindowTo(x, y, this);
}
virtual void OnQueryTextFinished(char *str)

@ -787,13 +787,13 @@ void Window::Initialize(int x, int y, int min_width, int min_height,
if (this->window_class != WC_OSK && (!EditBoxInGlobalFocus() || this->HasWidgetOfType(WWT_EDITBOX))) SetFocusedWindow(this);
/* Hacky way of specifying always-on-top windows. These windows are
* always above other windows because they are moved below them.
* status-bar is above news-window because it has been created earlier.
* Also, as the chat-window is excluded from this, it will always be
* the last window, thus always on top.
* XXX - Yes, ugly, probably needs something like w->always_on_top flag
* to implement correctly, but even then you need some kind of distinction
* between on-top of chat/news and status windows, because these conflict */
* always above other windows because they are moved below them.
* status-bar is above news-window because it has been created earlier.
* Also, as the chat-window is excluded from this, it will always be
* the last window, thus always on top.
* XXX - Yes, ugly, probably needs something like w->always_on_top flag
* to implement correctly, but even then you need some kind of distinction
* between on-top of chat/news and status windows, because these conflict */
Window *w = _z_front_window;
if (w != NULL && this->window_class != WC_SEND_NETWORK_MSG && this->window_class != WC_HIGHSCORE && this->window_class != WC_ENDSCREEN) {
if (FindWindowById(WC_MAIN_TOOLBAR, 0) != NULL) w = w->z_back;
@ -1719,14 +1719,14 @@ static bool MaybeBringWindowToFront(Window *w)
void HandleKeypress(uint32 raw_key)
{
/*
* During the generation of the world, there might be
* another thread that is currently building for example
* a road. To not interfere with those tasks, we should
* NOT change the _current_company here.
*
* This is not necessary either, as the only events that
* can be handled are the 'close application' events
*/
* During the generation of the world, there might be
* another thread that is currently building for example
* a road. To not interfere with those tasks, we should
* NOT change the _current_company here.
*
* This is not necessary either, as the only events that
* can be handled are the 'close application' events
*/
if (!IsGeneratingWorld()) _current_company = _local_company;
/* Setup event */
@ -1967,7 +1967,8 @@ void MouseLoop(MouseClick click, int mousewheel)
default:
if (!scrollwheel_scrolling || w == NULL || w->window_class != WC_SMALLMAP) break;
/* We try to use the scrollwheel to scroll since we didn't touch any of the buttons.
* Simulate a right button click so we can get started. */
* Simulate a right button click so we can get started. */
/* fallthough */
case MC_RIGHT: DispatchRightClickEvent(w, x - w->left, y - w->top); break;
}

@ -138,7 +138,7 @@ struct CSegmentCostCacheT
/** CYapfSegmentCostCacheGlobalT - the yapf cost cache provider that adds the segment cost
* caching functionality to yapf. Using this class as base of your will provide the global
* segment cost caching services for your Nodes.
*/
*/
template <class Types>
class CYapfSegmentCostCacheGlobalT
: public CYapfSegmentCostCacheLocalT<Types>

@ -68,7 +68,7 @@ enum EndSegmentReason {
ESR_SAFE_TILE, ///< safe waiting position found (could be a target)
/* The following reasons are used only internally by PfCalcCost().
* They should not be found in the cached segment. */
* They should not be found in the cached segment. */
ESR_PATH_TOO_LONG, ///< the path is too long (searching for the nearest depot in the given radius)
ESR_FIRST_TWO_WAY_RED, ///< first signal was 2-way and it was red
ESR_LOOK_AHEAD_END, ///< we have just passed the last look-ahead signal

Loading…
Cancel
Save