Changeset - r11356:ae9277304002
[Not reviewed]
master
0 53 0
rubidium - 16 years ago 2009-03-14 18:16:29
rubidium@openttd.org
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
53 files changed with 368 insertions and 368 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_bridge.cpp
Show inline comments
 
@@ -29,26 +29,26 @@ static void _DoCommandReturnBuildBridge2
 
		AIObject::SetLastCommandRes(false);
 
		AIInstance::DoCommandReturn(instance);
 
		return;
 
	}
 

	
 
	/* 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();
 
}
 

	
 
static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
 
{
 
	if (!AIBridge::_BuildBridgeRoad1()) {
 
		AIObject::SetLastCommandRes(false);
 
		AIInstance::DoCommandReturn(instance);
 
		return;
 
	}
 

	
 
	/* 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();
 
}
 

	
 
/* static */ bool AIBridge::BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end)
 
{
 
	EnforcePrecondition(false, start != end);
src/ai/api/ai_rail.cpp
Show inline comments
 
@@ -313,13 +313,13 @@ static uint32 SimulateDrag(TileIndex fro
 
/* static */ bool AIRail::BuildRail(TileIndex from, TileIndex tile, TileIndex to)
 
{
 
	EnforcePrecondition(false, ::IsValidTile(from));
 
	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 ||
 
			(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||
 
			(::TileY(from) == ::TileY(tile) && ::TileY(tile) == ::TileY(to)));
 

	
 
@@ -330,13 +330,13 @@ static uint32 SimulateDrag(TileIndex fro
 
/* static */ bool AIRail::RemoveRail(TileIndex from, TileIndex tile, TileIndex to)
 
{
 
	EnforcePrecondition(false, ::IsValidTile(from));
 
	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)) ||
 
			(::TileY(from) == ::TileY(tile) && ::TileY(tile) == ::TileY(to)));
 

	
 
	if (!IsRailTypeAvailable(GetCurrentRailType())) SetCurrentRailType(GetRailType(tile));
src/ai/api/ai_road.cpp
Show inline comments
 
@@ -392,13 +392,13 @@ static bool NormaliseTileOffset(int32 *t
 
 * @param neighbour The direction to the neighbouring tile to "enter".
 
 * @return true if and only if the tile is reachable.
 
 */
 
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:
 
			return (::GetRoadTileType(neighbour_tile) != ROAD_TILE_DEPOT);
 

	
 
		case MP_STATION:
src/ai/api/ai_testmode.cpp
Show inline comments
 
@@ -5,13 +5,13 @@
 
#include "ai_testmode.hpp"
 
#include "../../command_type.h"
 

	
 
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;
 
}
 

	
 
AITestMode::AITestMode()
 
{
 
	this->last_mode     = this->GetDoCommandMode();
src/aircraft_gui.cpp
Show inline comments
 
@@ -12,18 +12,18 @@
 
#include "window_gui.h"
 

	
 
#include "table/sprites.h"
 
#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;
 
	Money feeder_share = 0;
 

	
 
	for (const Vehicle *u = v ; u != NULL ; u = u->Next()) {
src/autoreplace_gui.cpp
Show inline comments
 
@@ -204,13 +204,13 @@ public:
 
		Widget *widget = this->widget;
 
		widget[RVW_WIDGET_LEFT_MATRIX].data = widget[RVW_WIDGET_RIGHT_MATRIX].data = (this->vscroll.cap << 8) + 1;
 

	
 
		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;
 

	
 
			/* The detail panel is one line taller for trains so we will move some of the widgets one line (10 pixels) down. */
 
			widget[RVW_WIDGET_LEFT_DETAILS].bottom  += 10;
 
@@ -418,18 +418,18 @@ public:
 
		Widget *widget = this->widget;
 

	
 
		widget[RVW_WIDGET_LEFT_MATRIX].data = widget[RVW_WIDGET_RIGHT_MATRIX].data = (this->vscroll2.cap << 8) + 1;
 

	
 
		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;
 
			widget[RVW_WIDGET_LEFT_SCROLLBAR].left  = widget[RVW_WIDGET_LEFT_SCROLLBAR].right - 11;
 
			widget[RVW_WIDGET_LEFT_MATRIX].right    = widget[RVW_WIDGET_LEFT_SCROLLBAR].left - 1;
 
		}
src/blitter/32bpp_base.hpp
Show inline comments
 
@@ -94,41 +94,41 @@ public:
 
		if (a >= 255) return (colour | 0xFF000000);
 

	
 
		return ComposeColourPANoCheck(colour, a, current);
 
	}
 

	
 
	/**
 
	* 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);
 
		uint g = GB(colour, 8,  8);
 
		uint b = GB(colour, 0,  8);
 

	
 
		return ComposeColour(0xFF, r * nom / denom, g * nom / denom, b * nom / denom);
 
	}
 

	
 
	/**
 
	* 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);
 
		uint g = GB(colour, 8,  8);
 
		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);
 
	}
 
};
 

	
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -166,17 +166,17 @@ static int CDECL EngineRunningCostSorter
 
static int CDECL TrainEnginePowerVsRunningCostSorter(const void *a, const void *b)
 
{
 
	const Engine *e_a = GetEngine(*(const EngineID*)a);
 
	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);
 

	
 
	/* Use EngineID to sort instead since we want consistent sorting */
 
	if (r == 0) return EngineNumberSorter(a, b);
 
@@ -511,13 +511,13 @@ static int DrawAircraftPurchaseInfo(int 
 
	if (cargo == CT_INVALID || cargo == CT_PASSENGERS) {
 
		SetDParam(0, avi->passenger_capacity);
 
		SetDParam(1, avi->mail_capacity);
 
		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);
 
		DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
 
	}
 
	y += 10;
 
@@ -806,15 +806,15 @@ struct BuildVehicleWindow : Window {
 

	
 
		this->filter.railtype = (this->listview_mode) ? RAILTYPE_END : GetRailType(this->window_number);
 

	
 
		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;
 
			const RailVehicleInfo *rvi = &e->u.rail;
 

	
 
			if (this->filter.railtype != RAILTYPE_END && !HasPowerOnRail(rvi->railtype, this->filter.railtype)) continue;
 
@@ -888,15 +888,15 @@ struct BuildVehicleWindow : Window {
 

	
 
		this->eng_list.Clear();
 

	
 
		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;
 
			if (!IsEngineBuildable(eid, VEH_AIRCRAFT, _local_company)) continue;
 
			/* First VEH_END window_numbers are fake to allow a window open for all different types at once */
 
			if (!this->listview_mode && !CanVehicleUseStation(eid, st)) continue;
src/company_cmd.cpp
Show inline comments
 
@@ -722,18 +722,18 @@ CommandCost CmdCompanyCtrl(TileIndex til
 
			/* This command is only executed in a multiplayer game */
 
			if (!_networking) return CMD_ERROR;
 

	
 
#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? */
 
			if (!(flags & DC_EXEC)) return CommandCost();
 
			NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(cid);
 
			if (ci == NULL) return CommandCost();
 
@@ -763,13 +763,13 @@ CommandCost CmdCompanyCtrl(TileIndex til
 
					NetworkChangeCompanyPassword(1, &password);
 
				}
 

	
 
				_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,
 
					CMD_SET_AUTOREPLACE,
 
					NULL,
 
					NULL
 
@@ -777,35 +777,35 @@ CommandCost CmdCompanyCtrl(TileIndex til
 

	
 
				MarkWholeScreenDirty();
 
			}
 

	
 
			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);
 

	
 
				if (IsValidCompanyID(ci->client_playas)) {
 
					CompanyID company_backup = _local_company;
 
					_network_company_states[c->index].months_empty = 0;
 
					_network_company_states[c->index].password[0] = '\0';
 
					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;
 
				}
 

	
 
				/* Announce new company on network, if the client was a SPECTATOR before */
src/company_gui.cpp
Show inline comments
 
@@ -874,14 +874,14 @@ public:
 
			/* lower the non-selected ethnicity button */
 
			this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_EUR, !HasBit(this->ge, ETHNICITY_BLACK));
 
			this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_AFR,  HasBit(this->ge, ETHNICITY_BLACK));
 

	
 

	
 
			/* 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,
 
				SCMFW_WIDGET_EYECOLOUR, SCMFW_WIDGET_EYECOLOUR_L, SCMFW_WIDGET_EYECOLOUR_R, WIDGET_LIST_END);
 

	
 
			/* Chin buttons */
 
@@ -1034,16 +1034,16 @@ public:
 
				this->UpdateData();
 
				this->SetDirty();
 
				break;
 

	
 
			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
 

	
 
					if (widget < SCMFW_WIDGET_EYECOLOUR_L) { // Bool buttons
 
						switch (widget - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING) {
 
							default: NOT_REACHED();
src/console_gui.cpp
Show inline comments
 
@@ -201,13 +201,13 @@ struct IConsoleWindow : Window
 
	{
 
		if (_focused_window != this) return ES_NOT_HANDLED;
 

	
 
		const int scroll_height = (this->height / ICON_LINE_HEIGHT) - 1;
 
		switch (keycode) {
 
			case WKC_UP:
 
				IConsoleHistoryNavigate(+1);
 
				IConsoleHistoryNavigate(1);
 
				this->SetDirty();
 
				break;
 

	
 
			case WKC_DOWN:
 
				IConsoleHistoryNavigate(-1);
 
				this->SetDirty();
src/core/enum_type.hpp
Show inline comments
 
@@ -61,18 +61,18 @@ struct MakeEnumPropsT {
 
	static const Tenum_t invalid = Tinvalid;  ///< what value is used as invalid value (i.e. INVALID_TRACKDIR)
 
};
 

	
 

	
 

	
 
/** 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) */
 
template <typename Tenum_t>
 
struct TinyEnumT {
 
	typedef Tenum_t enum_type;                      ///< expose our enumeration type (i.e. Trackdir) to outside
src/depot_gui.cpp
Show inline comments
 
@@ -164,13 +164,13 @@ static void TrainDepotMoveVehicle(const 
 

	
 
/* Array to hold the block sizes
 
 * First part is the vehicle type, while the last is 0 = x, 1 = y */
 
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},
 
/* VEH_SHIP */     {3, 3},
 
/* VEH_AIRCRAFT */ {3, 4},
 
};
 
@@ -252,17 +252,17 @@ struct DepotWindow : Window {
 
	~DepotWindow()
 
	{
 
		DeleteWindowById(WC_BUILD_VEHICLE, this->window_number);
 
	}
 

	
 
	/** 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;
 

	
 
		int sprite_y = y + this->resize.step_height - GetVehicleListHeight(v->type);
 

	
 
@@ -547,16 +547,16 @@ struct DepotWindow : Window {
 

	
 
			default: NOT_REACHED();
 
		}
 
	}
 

	
 
	/**
 
	* 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;
 

	
 
		if (v == NULL) return;
 

	
 
@@ -582,13 +582,13 @@ struct DepotWindow : Window {
 
	void ResizeDepotButtons(Window *w)
 
	{
 
		ResizeButtons(w, DEPOT_WIDGET_BUILD, DEPOT_WIDGET_LOCATION);
 

	
 
		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;
 
		}
 
	}
 

	
 
	/* Function to set up vehicle specific sprites and strings
src/economy.cpp
Show inline comments
 
@@ -187,13 +187,13 @@ int UpdateCompanyRatingAndValue(Company 
 
			Money min_income = cee->income + cee->expenses;
 
			Money max_income = cee->income + cee->expenses;
 

	
 
			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);
 
			}
 

	
 
			_score_part[owner][SCORE_MAX_INCOME] = ClampToI32(max_income);
 
@@ -209,13 +209,13 @@ int UpdateCompanyRatingAndValue(Company 
 
		numec = min(c->num_valid_stat_ent, 4);
 
		if (numec != 0) {
 
			cee = c->old_economy;
 
			total_delivered = 0;
 
			do {
 
				total_delivered += cee->delivered_cargo;
 
			} while (++cee,--numec);
 
			} while (++cee, --numec);
 

	
 
			_score_part[owner][SCORE_DELIVERED] = total_delivered;
 
		}
 
	}
 

	
 
	/* Generate score for variety of cargo */
 
@@ -959,13 +959,13 @@ struct FoundRoute {
 
	void *from;
 
	void *to;
 
};
 

	
 
static void FindSubsidyPassengerRoute(FoundRoute *fr)
 
{
 
	Town *from,*to;
 
	Town *from, *to;
 

	
 
	fr->distance = UINT_MAX;
 

	
 
	fr->from = from = GetRandomTown();
 
	if (from == NULL || from->population < 400) return;
 

	
 
@@ -1059,19 +1059,19 @@ static void SubsidyMonthlyHandler()
 
	FoundRoute fr;
 
	bool modified = false;
 

	
 
	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);
 
				AddNewsItem(STR_202F_SUBSIDY_WITHDRAWN_SERVICE, NS_SUBSIDIES, pair.a, pair.b);
 
			}
 
			s->cargo_type = CT_INVALID;
 
@@ -1080,13 +1080,13 @@ static void SubsidyMonthlyHandler()
 
		} else {
 
			s->age++;
 
		}
 
	}
 

	
 
	/* 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) {
 
			if (++s == endof(_subsidies))
 
				goto no_add;
 
		}
 
@@ -1731,13 +1731,13 @@ static void LoadUnloadVehicle(Vehicle *v
 

	
 
	v = u;
 

	
 
	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];
 
		}
 
	} else {
 
		bool finished_loading = true;
src/elrail.cpp
Show inline comments
 
@@ -549,18 +549,18 @@ bool SettingsDisableElrail(int32 p1)
 
			/* change it to the proper one */
 
			rv_info->railtype = new_railtype;
 
		}
 
	}
 

	
 
	/* 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);
 
			}
 
		}
 
	}
 
@@ -574,11 +574,11 @@ 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;
 
}
src/engine.cpp
Show inline comments
 
@@ -670,13 +670,13 @@ void EnginesMonthlyLoop()
 
				CalcEngineReliability(e);
 
			}
 

	
 
			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;
 

	
 
				/* Do not introduce new rail wagons */
 
				if (!IsWagon(e->index))
 
					e->preview_company_rank = 1; // Give to the company with the highest rating.
src/fontcache.cpp
Show inline comments
 
@@ -373,14 +373,14 @@ static FT_Error GetFontByFaceName(const 
 
						FcPatternGetString(fs->fonts[i], FC_STYLE,  0, &style)  == FcResultMatch) {
 

	
 
					/* The correct style? */
 
					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);
 
					}
 
				}
 
			}
 
		}
src/genworld_gui.cpp
Show inline comments
 
@@ -552,16 +552,15 @@ struct GenerateLandscapeWindow : public 
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		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;
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
src/graph_gui.cpp
Show inline comments
 
@@ -122,14 +122,14 @@ protected:
 

	
 
		GRAPH_X_POSITION_BEGINNING  = 44,  ///< Start the graph 44 pixels from gd_left
 
		GRAPH_X_POSITION_SEPARATION = 22,  ///< There are 22 pixels between each X value
 

	
 
		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.
 
	byte num_dataset;
 
	byte num_on_x_axis;
 
	bool has_negative_values;
 
@@ -156,13 +156,13 @@ protected:
 
	{
 
		uint x, y;                       ///< Reused whenever x and y coordinates are needed.
 
		OverflowSafeInt64 highest_value; ///< Highest value to be drawn.
 
		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);
 

	
 
		byte grid_colour = _colour_gradient[COLOUR_GREY][4];
 

	
 
		/* The coordinates of the opposite edges of the graph. */
 
@@ -206,43 +206,43 @@ protected:
 
			return;
 

	
 
		assert(this->num_on_x_axis > 0);
 
		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++) {
 
			if (!HasBit(this->excluded_data, i)) {
 
				for (int j = 0; j < this->num_on_x_axis; j++) {
 
					OverflowSafeInt64 datapoint = this->cost[i][j];
 

	
 
					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));
 
					}
 
				}
 
			}
 
		}
 

	
 
		/* 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);
 

	
 
		/* draw text strings on the y axis */
 
		int64 y_label = highest_value;
 
		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;
 
		y = this->gd_top - 3;
 

	
 
		for (int i = 0; i < GRAPH_NUM_LINES_Y; i++) {
 
@@ -300,22 +300,22 @@ protected:
 

	
 
				for (int j = 0; j < this->num_on_x_axis; j++) {
 
					OverflowSafeInt64 datapoint = this->cost[i][j];
 

	
 
					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);
 

	
 
						/* Handle negative values differently (don't shift sign) */
 
						if (datapoint < 0) {
 
							datapoint = -(abs(datapoint) >> reduce_range);
 
@@ -1005,13 +1005,13 @@ public:
 
			DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, TC_FROMSTRING);
 

	
 
			/* SCORE_LOAN is inversed */
 
			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) {
 
				case SCORE_MIN_PROFIT:
 
				case SCORE_MIN_INCOME:
 
				case SCORE_MAX_INCOME:
src/group_gui.cpp
Show inline comments
 
@@ -385,13 +385,13 @@ public:
 
		/* Set text of sort by dropdown */
 
		this->widget[GRP_WIDGET_SORT_BY_DROPDOWN].data = this->vehicle_sorter_names[this->vehicles.SortType()];
 

	
 
		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) {
 
			case VEH_TRAIN:
 
				str_all_veh = STR_GROUP_ALL_TRAINS;
 
				str_no_group_veh = STR_GROUP_DEFAULT_TRAINS;
src/industry_cmd.cpp
Show inline comments
 
@@ -1918,20 +1918,20 @@ static bool CheckIndustryCloseDownProtec
 
	/* oil wells (or the industries with that flag set) are always allowed to closedown */
 
	if (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD && _settings_game.game_creation.landscape == LT_TEMPERATE) return false;
 
	return (indspec->behaviour & INDUSTRYBEH_CANCLOSE_LASTINSTANCE) == 0 && GetIndustryTypeCount(type) <= 1;
 
}
 

	
 
/**
 
* 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);
 

	
 
	/* Check for acceptance of cargo */
 
	for (byte j = 0; j < lengthof(ind->accepts_cargo); j++) {
 
@@ -1956,24 +1956,24 @@ static void CanCargoServiceIndustry(Carg
 
			break;
 
		}
 
	}
 
}
 

	
 
/**
 
* 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 */
 
	StationList stations;
 
	FindStationsAroundTiles(ind->xy, ind->width, ind->height, &stations);
 

	
 
@@ -2021,18 +2021,18 @@ int WhoCanServiceIndustry(Industry *ind)
 
		}
 
	}
 
	return result;
 
}
 

	
 
/**
 
* 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;
 

	
 
	switch (WhoCanServiceIndustry(ind)) {
 
		case 0: ns = NS_INDUSTRY_NOBODY;  break;
src/main_gui.cpp
Show inline comments
 
@@ -216,15 +216,15 @@ struct MainWindow : Window
 
			case 'Q' | WKC_META:
 
				HandleExitGameRequest();
 
				return ES_HANDLED;
 
		}
 

	
 
		/* 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) {
 
			IConsoleSwitch();
 
			return ES_HANDLED;
 
		}
src/misc/blob.hpp
Show inline comments
 
@@ -6,40 +6,40 @@
 
#define BLOB_HPP
 

	
 
#include "../core/alloc_func.hpp"
 
#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;
 
	typedef ::byte      bitem_t;
 

	
 
protected:
 
@@ -90,13 +90,13 @@ public:
 
	{
 
		Free();
 
	}
 

	
 
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}};
 
		ptr_u.m_pHdr_1 = &hdrEmpty[1];
 
	}
 

	
 
@@ -214,23 +214,23 @@ public:
 
	{
 
		if (!src.IsEmpty())
 
			memcpy(GrowRawSize(src.RawSize()), src.RawData(), src.RawSize());
 
	}
 

	
 
	/** 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);
 
		bsize_t new_size = RawSize() + num_bytes;
 
		if (new_size > MaxRawSize()) SmartAlloc(new_size);
 
		return ptr_u.m_pData + RawSize();
 
	}
 

	
 
	/** 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);
 
		RawSizeRef() += num_bytes;
 
		return pNewData;
 
	}
 
@@ -309,18 +309,18 @@ 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:
 
public:
 
	typedef Titem_ Titem;
 
	typedef Tbase_ Tbase;
 
@@ -501,13 +501,13 @@ public:
 
		pLast->~Titem_();
 
		// and reduce the raw blob size
 
		Tbase::ReduceRawSize(Titem_size);
 
	}
 

	
 
	/** 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);
 
	}
 

	
 
	FORCEINLINE OnTransfer Transfer()
src/misc/dbg_helpers.h
Show inline comments
 
@@ -20,29 +20,29 @@ template <typename T, size_t N> struct A
 
	static const size_t length = N;
 
	typedef T item_t;
 
};
 

	
 

	
 
/**
 
* 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)
 
{
 
	if ((size_t)idx >= ArrayT<T>::length) {
 
		return t_unk;
 
	}
 
	return t[idx];
 
}
 

	
 
/**
 
* 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)
 
{
 
	if ((size_t)idx < ArrayT<T>::length) {
 
		return t[idx];
 
	}
 
@@ -50,17 +50,17 @@ inline typename ArrayT<T>::item_t ItemAt
 
		return t_inv;
 
	}
 
	return t_unk;
 
}
 

	
 
/**
 
* 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)
 
{
 
	CStrA out;
 
	if (value == val_inv) {
 
		out = name_inv;
src/misc/strapi.hpp
Show inline comments
 
@@ -14,15 +14,15 @@
 
#define _stricmp strcmp
 
#define _wcsicmp wcscmp
 
#endif /* !defined(_MSC_VER) */
 
#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
 
{
 
public:
 
	/** ::strlen wrapper */
 
	static size_t StrLen(const Tchar *s);
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -315,13 +315,13 @@ public:
 
			}
 
			*item = MAX_CLIENT_SLOTS;
 
		}
 

	
 
		/* 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;
 

	
 
			FOR_ALL_TOWNS_FROM(t, *item - MAX_CLIENT_SLOTS) {
 
				/* Get the town-name via the string-system */
 
				SetDParam(0, t->index);
 
@@ -372,13 +372,13 @@ public:
 

	
 
		while ((cur_name = ChatTabCompletionNextItem(&item)) != NULL) {
 
			item++;
 

	
 
			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;
 

	
 
					/* If we are completing at the begin of the line, skip the ': ' we added */
 
					if (tb_buf == pre_buf) {
src/network/network_content.cpp
Show inline comments
 
@@ -254,15 +254,15 @@ void ClientNetworkContentSocketHandler::
 
	uint count = files;
 
	ContentID *content_ids = ids;
 
	this->Connect();
 

	
 
	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);
 
		p->Send_uint16(p_count);
 

	
 
		for (uint i = 0; i < p_count; i++) {
src/network/network_gui.cpp
Show inline comments
 
@@ -710,14 +710,14 @@ public:
 

	
 
		this->widget[NGWW_MATRIX].data = (this->vscroll.cap << 8) + 1;
 

	
 
		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);
 
			AlignWidgetRight(NGWW_DATE,    NGWW_YEARS);
 
			AlignWidgetRight(NGWW_MAPSIZE, NGWW_DATE);
 
			AlignWidgetRight(NGWW_CLIENTS, NGWW_MAPSIZE);
 
@@ -1025,13 +1025,13 @@ struct NetworkStartServerWindow : public
 
				}
 
				break;
 

	
 
			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;
 
		}
 
	}
 

	
src/newgrf_spritegroup.cpp
Show inline comments
 
@@ -114,13 +114,13 @@ static uint32 RotateRight(uint32 val, ui
 

	
 
	return (val >> rot) | (val << (32 - 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)
 
{
 
	value >>= adjust->shift_num;
 
	value  &= adjust->and_mask;
 

	
src/news_gui.cpp
Show inline comments
 
@@ -840,13 +840,13 @@ struct MessageOptionsWindow : Window {
 
		this->widget[WIDGET_NEWSOPT_DROP_SUMMARY].data = _message_opt[this->state];
 
		this->DrawWidgets();
 

	
 
		/* 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);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
@@ -887,34 +887,34 @@ struct MessageOptionsWindow : Window {
 
		this->SetDirty();
 
	}
 
};
 

	
 

	
 
/*
 
* 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, \
 
	  SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST}, \
 
	{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, \
 
	   13,  89,  basey     + linenum * NEWS_SETTING_BASELINE_SKIP,  basey + 11 + linenum * NEWS_SETTING_BASELINE_SKIP, \
src/openttd.cpp
Show inline comments
 
@@ -214,13 +214,13 @@ struct MyGetOptData {
 
		cont = NULL;
 
	}
 
};
 

	
 
static int MyGetOpt(MyGetOptData *md)
 
{
 
	const char *s,*r,*t;
 
	const char *s, *r, *t;
 

	
 
	s = md->cont;
 
	if (s != NULL)
 
		goto md_continue_here;
 

	
 
	for (;;) {
 
@@ -939,13 +939,13 @@ void SwitchToMode(SwitchMode new_mode)
 
				ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
 
			} else {
 
				if (_saveload_mode == SLD_LOAD_SCENARIO) {
 
					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");
 
				/* Decrease pause counter (was increased from opening load dialog) */
 
				DoCommandP(0, 0, 0, CMD_PAUSE);
 
#ifdef ENABLE_NETWORK
src/order_gui.cpp
Show inline comments
 
@@ -1109,19 +1109,19 @@ public:
 
	}
 

	
 
	virtual void OnMouseLoop()
 
	{
 
		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);
 
		}
 
	}
 

	
src/rail_gui.cpp
Show inline comments
 
@@ -621,31 +621,31 @@ struct BuildRailToolbarWindow : Window {
 

	
 
	void UpdateRemoveWidgetStatus(int clicked_widget)
 
	{
 
		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:
 
			case RTW_BUILD_X:
 
			case RTW_BUILD_EW:
 
			case RTW_BUILD_Y:
 
			case RTW_AUTORAIL:
 
			case RTW_BUILD_WAYPOINT:
 
			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;
 
		}
 
	}
 

	
 
@@ -859,13 +859,13 @@ void ShowBuildRailToolbar(RailType railt
 
static void HandleStationPlacement(TileIndex start, TileIndex end)
 
{
 
	uint sx = TileX(start);
 
	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);
 
	w = ex - sx + 1;
 
	h = ey - sy + 1;
 

	
src/road_gui.cpp
Show inline comments
 
@@ -593,15 +593,15 @@ struct BuildRoadToolbarWindow : Window {
 
					break;
 

	
 
				case DDSP_PLACE_ROAD_X_DIR:
 
				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),
 
						(_ctrl_pressed || _remove_button_clicked) ?
 
						CMD_REMOVE_LONG_ROAD | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_road) :
 
						CMD_BUILD_LONG_ROAD | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_road), CcPlaySound1D);
src/road_map.h
Show inline comments
 
@@ -117,13 +117,13 @@ static inline Owner GetRoadOwner(TileInd
 
{
 
	switch (rt) {
 
		default: NOT_REACHED();
 
		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;
 
		}
 
	}
 
}
 

	
src/saveload/oldloader_sl.cpp
Show inline comments
 
@@ -688,15 +688,15 @@ static bool LoadOldCargoPaymentRate(Load
 
	}
 

	
 
	if (!LoadChunk(ls, NULL, cargo_payment_rate_chunk)) return false;
 

	
 
	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;
 

	
 
		_old_price = m >> 16;
 
		_old_price_frac = GB((int64)m, 0, 16);
 
	}
 
@@ -1036,21 +1036,21 @@ static bool LoadOldCompany(LoadgameState
 
		if (num == 0) {
 
			/* If the first company has no name, make sure we call it UNNAMED */
 
			if (c->name_1 == 0)
 
				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;
 
	}
 

	
 
	_company_colours[num] = (Colours)c->colour;
 
	c->inaugurated_year -= ORIGINAL_BASE_YEAR;
 

	
src/ship_cmd.cpp
Show inline comments
 
@@ -599,23 +599,23 @@ static void ShipController(Vehicle *v)
 
			} else {
 
				/* Not inside depot */
 
				r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y);
 
				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);
 
				} else if (v->dest_tile != 0) {
 
					/* We have a target, let's see if we reached it... */
 
					if (v->current_order.IsType(OT_GOTO_STATION) &&
 
							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();
 
						InvalidateVehicleOrder(v, 0);
 
					} else {
 
						/* Non-buoy orders really need to reach the tile */
src/ship_gui.cpp
Show inline comments
 
@@ -32,18 +32,18 @@ void CcBuildShip(bool success, TileIndex
 
		RestoreVehicleOrders(v);
 
	}
 
	ShowVehicleViewWindow(v);
 
}
 

	
 
/**
 
* 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);
 
	SetDParam(1, v->build_year);
 
	SetDParam(2, v->value);
 
	DrawString(x, y, STR_9816_BUILT_VALUE, TC_FROMSTRING);
src/signs.cpp
Show inline comments
 
@@ -61,14 +61,14 @@ void UpdateAllSignVirtCoords()
 
 * @param si Pointer to the Sign
 
 * @ingroup dirty
 
 */
 
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,
 
		si->sign.left + ScaleByZoom(si->sign.width_1 + 12, ZOOM_LVL_MAX),
 
		si->sign.top  + ScaleByZoom(12, ZOOM_LVL_MAX));
 
}
src/smallmap_gui.cpp
Show inline comments
 
@@ -22,31 +22,31 @@
 
#include "window_func.h"
 

	
 
#include "table/strings.h"
 
#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},
 
};
 

	
 
/* number of used industries */
 
static int _smallmap_industry_count;
 

	
src/station_gui.cpp
Show inline comments
 
@@ -361,13 +361,13 @@ public:
 
			const Station *st = this->stations[i];
 
			int x;
 

	
 
			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);
 
			SetDParam(1, st->facilities);
 
			x = DrawString(xb, y, STR_3049_0, TC_FROMSTRING) + 5;
 

	
src/table/files.h
Show inline comments
 
/* $Id$ */
 

	
 
/** @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[] = {
 
	{ "SAMPLE.CAT", {0x42, 0x2e, 0xa3, 0xdd, 0x07, 0x4d, 0x28, 0x59, 0xbb, 0x51, 0x63, 0x9a, 0x6e, 0x0e, 0x85, 0xda}, NULL },
 
	{ "SAMPLE.CAT", {0x92, 0x12, 0xe8, 0x1e, 0x72, 0xba, 0xdd, 0x4b, 0xbe, 0x1e, 0xae, 0xae, 0x66, 0x45, 0x8e, 0x10}, NULL },
 
};
src/toolbar_gui.cpp
Show inline comments
 
@@ -1029,14 +1029,14 @@ struct MainToolbarWindow : Window {
 
	{
 
		/* Draw brown-red toolbar bg. */
 
		GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2);
 
		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);
 

	
 
		this->SetWidgetDisabledState(TBN_RAILS, !CanBuildVehicleInfrastructure(VEH_TRAIN));
 
		this->SetWidgetDisabledState(TBN_AIR, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT));
src/vehicle.cpp
Show inline comments
 
@@ -717,15 +717,15 @@ CargoID FindFirstRefittableCargo(EngineI
 
	}
 

	
 
	return CT_INVALID;
 
}
 

	
 
/** 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;
 
	ExpensesType expense_type;
 
	switch (GetEngine(engine_type)->type) {
 
		case VEH_SHIP:
src/vehicle_cmd.cpp
Show inline comments
 
@@ -510,15 +510,15 @@ CommandCost SendAllVehiclesToDepot(Vehic
 
	/* Send all the vehicles to a depot */
 
	for (uint i = 0; i < list.Length(); i++) {
 
		const Vehicle *v = list[i];
 
		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();
 
		}
 
	}
 

	
 
	return (flags & DC_EXEC) ? CommandCost() : CMD_ERROR;
src/vehicle_gui.cpp
Show inline comments
 
@@ -417,15 +417,15 @@ static const WindowDesc _vehicle_refit_d
 
	WC_VEHICLE_REFIT, WC_VEHICLE_VIEW,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE | WDF_CONSTRUCTION,
 
	_vehicle_refit_widgets,
 
};
 

	
 
/** 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);
 
	RefitWindow *w = new RefitWindow(&_vehicle_refit_desc, v, order);
 
	w->parent = parent;
 
}
 
@@ -813,13 +813,13 @@ struct VehicleListWindow : public BaseVe
 
		CompanyID company = (CompanyID)GB(this->window_number, 0, 8);
 

	
 
		this->vehicle_type = (VehicleType)GB(this->window_number, 11, 5);
 
		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);
 
		} else {
 
			this->SetWidgetsHiddenState(true,
 
				VLW_WIDGET_AVAILABLE_VEHICLES,
 
@@ -913,14 +913,14 @@ struct VehicleListWindow : public BaseVe
 
		}
 

	
 

	
 
		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;
 
			case VEH_SHIP:     this->sorting = &_sorting.ship; break;
 
			case VEH_AIRCRAFT: this->sorting = &_sorting.aircraft; break;
 
			default: NOT_REACHED(); break;
 
@@ -954,13 +954,13 @@ struct VehicleListWindow : public BaseVe
 

	
 
		/* draw the widgets */
 
		switch (window_type) {
 
			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);
 
				break;
 

	
 
			case VLW_STANDARD: /* Company Name */
src/video/cocoa/fullscreen.mm
Show inline comments
 
@@ -376,13 +376,13 @@ class FullscreenSubdriver: public CocoaS
 

	
 
		/* There is a bug in Cocoa where NSScreen doesn't synchronize
 
		 * with CGDirectDisplay, so the main screen's frame is wrong.
 
		 * 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 ];
 

	
 

	
 
		pt = [ NSEvent mouseLocation ];
 
		pt.y = display_height - pt.y;
 
@@ -573,15 +573,15 @@ public:
 
	virtual void *GetPixelBuffer()
 
	{
 
		return pixel_buffer;
 
	}
 

	
 
	/*
 
		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;
 

	
 
		cgp.x = p->x;
 
		cgp.y = p->y;
src/viewport.cpp
Show inline comments
 
@@ -2248,15 +2248,15 @@ void VpStartPlaceSizing(TileIndex tile, 
 
void VpSetPlaceSizingLimit(int limit)
 
{
 
	_thd.sizelimit = 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;
 

	
 
	_thd.selend.x = TileX(to) * TILE_SIZE;
 
	_thd.selend.y = TileY(to) * TILE_SIZE;
 
@@ -2335,25 +2335,25 @@ static bool SwapDirection(HighLightStyle
 
	}
 

	
 
	return false;
 
}
 

	
 
/** 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);
 
	byte style_t;
 
	uint h0, h1, ht; // start heigth, end height, and temp variable
 

	
src/waypoint_cmd.cpp
Show inline comments
 
@@ -180,13 +180,13 @@ CommandCost CmdBuildTrainWaypoint(TileIn
 
			wp->name = NULL;
 
			wp->town_cn = 0;
 
		} else {
 
			/* 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 &&
 
						v->First() == v &&
 
						v->current_order.IsType(OT_GOTO_WAYPOINT) &&
 
						v->dest_tile == wp->xy) {
src/waypoint_gui.cpp
Show inline comments
 
@@ -84,13 +84,13 @@ public:
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
		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)
 
	{
 
		if (str == NULL) return;
 

	
src/window.cpp
Show inline comments
 
@@ -784,19 +784,19 @@ void Window::Initialize(int x, int y, in
 
	/* Give focus to the opened window unless it is the OSK window or a text box
 
	 * of focused window has focus (so we don't interrupt typing). But if the new
 
	 * window has a text box, then take focus anyway. */
 
	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;
 
		if (FindWindowById(WC_STATUS_BAR, 0)       != NULL) w = w->z_back;
 
		if (FindWindowById(WC_NEWS_WINDOW, 0)      != NULL) w = w->z_back;
 
		if (FindWindowById(WC_SEND_NETWORK_MSG, 0) != NULL) w = w->z_back;
 
@@ -1716,20 +1716,20 @@ static bool MaybeBringWindowToFront(Wind
 
/** Handle keyboard input.
 
 * @param raw_key Lower 8 bits contain the ASCII character, the higher 16 bits the keycode
 
 */
 
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 */
 
	uint16 key     = GB(raw_key,  0, 16);
 
	uint16 keycode = GB(raw_key, 16, 16);
 

	
 
@@ -1964,13 +1964,14 @@ void MouseLoop(MouseClick click, int mou
 
				DispatchLeftClickEvent(w, x - w->left, y - w->top, false);
 
				break;
 

	
 
			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;
 
		}
 
	}
 
}
 

	
src/yapf/yapf_costcache.hpp
Show inline comments
 
@@ -135,13 +135,13 @@ 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>
 
{
 
public:
 
	typedef CYapfSegmentCostCacheLocalT<Types> Tlocal;
src/yapf/yapf_node_rail.hpp
Show inline comments
 
@@ -65,13 +65,13 @@ enum EndSegmentReason {
 
	ESR_DEPOT,             ///< stop in the depot (could be a target next time)
 
	ESR_WAYPOINT,          ///< waypoint encountered (could be a target next time)
 
	ESR_STATION,           ///< station encountered (could be a target next time)
 
	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
 
	ESR_TARGET_REACHED,    ///< we have just reached the destination
 

	
 
	/* Special values */
0 comments (0 inline, 0 general)