Changeset - r10642:3c8977a0f499
[Not reviewed]
master
0 10 0
rubidium - 15 years ago 2009-01-09 22:56:28
rubidium@openttd.org
(svn r14944) -Cleanup: add spaces around some operators
10 files changed with 27 insertions and 27 deletions:
0 comments (0 inline, 0 general)
src/ai/default/default.cpp
Show inline comments
 
@@ -3398,13 +3398,13 @@ static void AiStateAirportStuff(Company 
 
	_companies_ai[c->index].state_counter = 0;
 
}
 

	
 
static CommandCost AiDoBuildDefaultAirportBlock(TileIndex tile, const AiDefaultBlockData *p, byte flag)
 
{
 
	uint32 avail_airports = GetValidAirports();
 
	CommandCost ret,total_cost(EXPENSES_CONSTRUCTION);
 
	CommandCost ret, total_cost(EXPENSES_CONSTRUCTION);
 

	
 
	for (; p->mode == 0; p++) {
 
		if (!HasBit(avail_airports, p->attr)) return CMD_ERROR;
 
		ret = DoCommand(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr, INVALID_STATION << 16, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_AIRPORT);
 
		if (CmdFailed(ret)) return CMD_ERROR;
 
		total_cost.AddCost(ret);
src/ai/trolly/build.cpp
Show inline comments
 
@@ -61,13 +61,13 @@ CommandCost AiNew_Build_Bridge(Company *
 
{
 
	int bridge_type, bridge_len, type, type2;
 

	
 
	// Find a good bridgetype (the best money can buy)
 
	bridge_len = GetTunnelBridgeLength(tile_a, tile_b);
 
	type = type2 = 0;
 
	for (bridge_type = MAX_BRIDGES-1; bridge_type >= 0; bridge_type--) {
 
	for (bridge_type = MAX_BRIDGES - 1; bridge_type >= 0; bridge_type--) {
 
		if (CheckBridge_Stuff(bridge_type, bridge_len)) {
 
			type2 = type;
 
			type = bridge_type;
 
			// We found two bridges, exit
 
			if (type2 != 0) break;
 
		}
 
@@ -139,13 +139,13 @@ CommandCost AiNew_Build_RoutePart(Compan
 

	
 
		// Build normal rail
 
		// Keep it doing till we go an other way
 
		if (route_extra[part - 1] == 0 && route_extra[part] == 0) {
 
			while (route_extra[part] == 0) {
 
				// Get the current direction
 
				dir = AiNew_GetRailDirection(route[part-1], route[part], route[part+1]);
 
				dir = AiNew_GetRailDirection(route[part - 1], route[part], route[part + 1]);
 
				// Is it the same as the last one?
 
				if (old_dir != -1 && old_dir != dir) break;
 
				old_dir = dir;
 
				// Build the tile
 
				res = AI_DoCommand(route[part], 0, dir, flag, CMD_BUILD_SINGLE_RAIL);
 
				if (CmdFailed(res)) {
 
@@ -188,16 +188,16 @@ CommandCost AiNew_Build_RoutePart(Compan
 
		}
 

	
 
		// Build normal road
 
		// Keep it doing till we go an other way
 
		// EnsureNoVehicleOnGround makes sure we don't build on a tile where a vehicle is. This way
 
		//  it will wait till the vehicle is gone..
 
		if (route_extra[part-1] == 0 && route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicleOnGround(route[part]))) {
 
		if (route_extra[part - 1] == 0 && route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicleOnGround(route[part]))) {
 
			while (route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicleOnGround(route[part]))) {
 
				// Get the current direction
 
				dir = AiNew_GetRoadDirection(route[part-1], route[part], route[part+1]);
 
				dir = AiNew_GetRoadDirection(route[part - 1], route[part], route[part + 1]);
 
				// Is it the same as the last one?
 
				if (old_dir != -1 && old_dir != dir) break;
 
				old_dir = dir;
 
				// There is already some road, and it is a bridge.. don't build!!!
 
				if (!IsTileType(route[part], MP_TUNNELBRIDGE)) {
 
					// Build the tile
src/main_gui.cpp
Show inline comments
 
@@ -177,13 +177,13 @@ void ZoomInOrOutToCursorWindow(bool in, 
 

	
 
	if (_game_mode != GM_MENU) {
 
		ViewPort *vp = w->viewport;
 
		if ((in && vp->zoom == ZOOM_LVL_MIN) || (!in && vp->zoom == ZOOM_LVL_MAX))
 
			return;
 

	
 
		Point pt = GetTileZoomCenterWindow(in,w);
 
		Point pt = GetTileZoomCenterWindow(in, w);
 
		if (pt.x != -1) {
 
			ScrollWindowTo(pt.x, pt.y, w, true);
 

	
 
			DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w);
 
		}
 
	}
src/misc_gui.cpp
Show inline comments
 
@@ -572,26 +572,26 @@ void ShowEstimatedCostOrIncome(Money cos
 
	SetDParam(0, cost);
 
	ShowErrorMessage(INVALID_STRING_ID, msg, x, y);
 
}
 

	
 
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
 
{
 
	Point pt = RemapCoords(x,y,z);
 
	Point pt = RemapCoords(x, y, z);
 
	StringID msg = STR_0801_COST;
 

	
 
	if (cost < 0) {
 
		cost = -cost;
 
		msg = STR_0803_INCOME;
 
	}
 
	SetDParam(0, cost);
 
	AddTextEffect(msg, pt.x, pt.y, 0x250, TE_RISING);
 
}
 

	
 
void ShowFeederIncomeAnimation(int x, int y, int z, Money cost)
 
{
 
	Point pt = RemapCoords(x,y,z);
 
	Point pt = RemapCoords(x, y, z);
 

	
 
	SetDParam(0, cost);
 
	AddTextEffect(STR_FEEDER, pt.x, pt.y, 0x250, TE_RISING);
 
}
 

	
 
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent, StringID string)
src/network/network.cpp
Show inline comments
 
@@ -1033,13 +1033,13 @@ void NetworkGameLoop()
 
}
 

	
 
static void NetworkGenerateUniqueId()
 
{
 
	Md5 checksum;
 
	uint8 digest[16];
 
	char hex_output[16*2 + 1];
 
	char hex_output[16 * 2 + 1];
 
	char coding_string[NETWORK_NAME_LENGTH];
 
	int di;
 

	
 
	snprintf(coding_string, sizeof(coding_string), "%d%s", (uint)Random(), "OpenTTD Unique ID");
 

	
 
	/* Generate the MD5 hash */
src/smallmap_gui.cpp
Show inline comments
 
@@ -56,18 +56,18 @@ static const Widget _smallmap_widgets[] 
 
};
 

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

	
 
/** Macro for ordinary entry of LegendAndColor */
 
#define MK(a,b) {a, b, INVALID_INDUSTRYTYPE, true, false, false}
 
#define MK(a, b) {a, b, INVALID_INDUSTRYTYPE, true, false, false}
 
/** Macro for end of list marker in arrays of LegendAndColor */
 
#define MKEND() {0, STR_NULL, INVALID_INDUSTRYTYPE, true, true, false}
 
/** Macro for break marker in arrays of LegendAndColor.
 
 * It will have valid data, though */
 
#define MS(a,b) {a, b, INVALID_INDUSTRYTYPE, true, false, true}
 
#define MS(a, b) {a, b, INVALID_INDUSTRYTYPE, true, false, true}
 

	
 
/** Structure for holding relevant data for legends in small map */
 
struct LegendAndColour {
 
	uint16 colour;     ///< color of the item on the map
 
	StringID legend;   ///< string corresponding to the colored item
 
	IndustryType type; ///< type of industry
 
@@ -141,13 +141,13 @@ static const LegendAndColour _legend_lan
 
#undef MK
 
#undef MS
 
#undef MKEND
 

	
 
/** Allow room for all industries, plus a terminator entry
 
 * This is required in order to have the indutry slots all filled up */
 
static LegendAndColour _legend_from_industries[NUM_INDUSTRYTYPES+1];
 
static LegendAndColour _legend_from_industries[NUM_INDUSTRYTYPES + 1];
 
/* For connecting industry type to position in industries list(small map legend) */
 
static uint _industry_to_list_pos[NUM_INDUSTRYTYPES];
 

	
 
/**
 
 * Fills an array for the industries legends.
 
 */
 
@@ -580,13 +580,13 @@ public:
 
	 * @param show_towns true if the town names should be displayed, false if not.
 
	 */
 
	void DrawSmallMap(DrawPixelInfo *dpi)
 
	{
 
		Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
 
		DrawPixelInfo *old_dpi;
 
		int dx,dy, x, y, x2, y2;
 
		int dx, dy, x, y, x2, y2;
 
		void *ptr;
 
		int tile_x;
 
		int tile_y;
 
		ViewPort *vp;
 

	
 
		old_dpi = _cur_dpi;
 
@@ -752,13 +752,13 @@ public:
 

	
 
		/* Draw map indicators */
 
		{
 
			Point pt;
 

	
 
			/* Find main viewport. */
 
			vp = FindWindowById(WC_MAIN_WINDOW,0)->viewport;
 
			vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport;
 

	
 
			pt = RemapCoords(this->scroll_x, this->scroll_y, 0);
 

	
 
			x = vp->virtual_left - pt.x;
 
			y = vp->virtual_top - pt.y;
 
			x2 = (x + vp->virtual_width) / TILE_SIZE;
src/vehicle.cpp
Show inline comments
 
@@ -857,13 +857,13 @@ Vehicle *CheckClickOnVehicle(const ViewP
 
	if ((uint)(x -= vp->left) >= (uint)vp->width || (uint)(y -= vp->top) >= (uint)vp->height) return NULL;
 

	
 
	x = ScaleByZoom(x, vp->zoom) + vp->virtual_left;
 
	y = ScaleByZoom(y, vp->zoom) + vp->virtual_top;
 

	
 
	FOR_ALL_VEHICLES(v) {
 
		if ((v->vehstatus & (VS_HIDDEN|VS_UNCLICKABLE)) == 0 &&
 
		if ((v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) == 0 &&
 
				x >= v->left_coord && x <= v->right_coord &&
 
				y >= v->top_coord && y <= v->bottom_coord) {
 

	
 
			dist = max(
 
				abs(((v->left_coord + v->right_coord) >> 1) - x),
 
				abs(((v->top_coord + v->bottom_coord) >> 1) - y)
 
@@ -955,13 +955,13 @@ static void ShowVehicleGettingOld(Vehicl
 

	
 
void AgeVehicle(Vehicle *v)
 
{
 
	if (v->age < 65535) v->age++;
 

	
 
	int age = v->age - v->max_age;
 
	if (age == 366*0 || age == 366*1 || age == 366*2 || age == 366*3 || age == 366*4) v->reliability_spd_dec <<= 1;
 
	if (age == 366 * 0 || age == 366 * 1 || age == 366 * 2 || age == 366 * 3 || age == 366 * 4) v->reliability_spd_dec <<= 1;
 

	
 
	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 

	
 
	if (age == -366) {
 
		ShowVehicleGettingOld(v, STR_01A0_IS_GETTING_OLD);
 
	} else if (age == 0) {
src/video/win32_v.cpp
Show inline comments
 
@@ -85,16 +85,16 @@ struct VkMapping {
 

	
 
#define AS(x, z) {x, 0, z}
 
#define AM(x, y, z, w) {x, y - x, z}
 

	
 
static const VkMapping _vk_mapping[] = {
 
	/* Pageup stuff + up/down */
 
	AM(VK_PRIOR,VK_DOWN, WKC_PAGEUP, WKC_DOWN),
 
	AM(VK_PRIOR, VK_DOWN, WKC_PAGEUP, WKC_DOWN),
 
	/* Map letters & digits */
 
	AM('A','Z','A','Z'),
 
	AM('0','9','0','9'),
 
	AM('A', 'Z', 'A', 'Z'),
 
	AM('0', '9', '0', '9'),
 

	
 
	AS(VK_ESCAPE,   WKC_ESC),
 
	AS(VK_PAUSE,    WKC_PAUSE),
 
	AS(VK_BACK,     WKC_BACKSPACE),
 
	AM(VK_INSERT,   VK_DELETE, WKC_INSERT, WKC_DELETE),
 

	
 
@@ -166,13 +166,13 @@ static void ClientSizeChanged(int w, int
 

	
 
#ifdef _DEBUG
 
// Keep this function here..
 
// It allows you to redraw the screen from within the MSVC debugger
 
int RedrawScreenDebug()
 
{
 
	HDC dc,dc2;
 
	HDC dc, dc2;
 
	static int _fooctr;
 
	HBITMAP old_bmp;
 
	HPALETTE old_palette;
 

	
 
	_screen.dst_ptr = _wnd.buffer_bits;
 
	UpdateWindows();
src/viewport.cpp
Show inline comments
 
@@ -267,20 +267,20 @@ static void DoSetViewportPosition(const 
 

	
 
		if (xo > 0) {
 
			RedrawScreenRect(left, top, xo + left, top + height);
 
			left += xo;
 
			width -= xo;
 
		} else if (xo < 0) {
 
			RedrawScreenRect(left+width+xo, top, left+width, top + height);
 
			RedrawScreenRect(left + width + xo, top, left + width, top + height);
 
			width += xo;
 
		}
 

	
 
		if (yo > 0) {
 
			RedrawScreenRect(left, top, width+left, top + yo);
 
			RedrawScreenRect(left, top, width + left, top + yo);
 
		} else if (yo < 0) {
 
			RedrawScreenRect(left, top + height + yo, width+left, top + height);
 
			RedrawScreenRect(left, top + height + yo, width + left, top + height);
 
		}
 
	}
 
}
 

	
 
static void SetViewportPosition(Window *w, int x, int y)
 
{
 
@@ -361,26 +361,26 @@ ViewPort *IsPtInWindowViewport(const Win
 
 * @param x   Screen x coordinate
 
 * @param y   Screen y coordinate
 
 * @return Tile coordinate */
 
static Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y)
 
{
 
	Point pt;
 
	int a,b;
 
	int a, b;
 
	uint z;
 

	
 
	if ( (uint)(x -= vp->left) >= (uint)vp->width ||
 
				(uint)(y -= vp->top) >= (uint)vp->height) {
 
				Point pt = {-1, -1};
 
				return pt;
 
	}
 

	
 
	x = (ScaleByZoom(x, vp->zoom) + vp->virtual_left) >> 2;
 
	y = (ScaleByZoom(y, vp->zoom) + vp->virtual_top) >> 1;
 

	
 
	a = y-x;
 
	b = y+x;
 
	a = y - x;
 
	b = y + x;
 

	
 
	/* we need to move variables in to the valid range, as the
 
	 * GetTileZoomCenterWindow() function can call here with invalid x and/or y,
 
	 * when the user tries to zoom out along the sides of the map */
 
	a = Clamp(a, 0, (int)(MapMaxX() * TILE_SIZE) - 1);
 
	b = Clamp(b, 0, (int)(MapMaxY() * TILE_SIZE) - 1);
src/win32.cpp
Show inline comments
 
@@ -936,13 +936,13 @@ void ShowInfo(const char *str)
 
#if defined(UNICODE)
 
		/* We need to put the text in a seperate buffer because the default
 
		 * buffer in MB_TO_WIDE might not be large enough (512 chars) */
 
		wchar_t help_msgW[8192];
 
#endif
 
		ReleaseCapture();
 
		_left_button_clicked =_left_button_down = false;
 
		_left_button_clicked = _left_button_down = false;
 

	
 
		old = MyShowCursor(true);
 
		if (MessageBox(GetActiveWindow(), MB_TO_WIDE_BUFFER(str, help_msgW, lengthof(help_msgW)), _T("OpenTTD"), MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
 
			CreateConsole();
 
		}
 
		MyShowCursor(old);
0 comments (0 inline, 0 general)