changeset 15552:683f2dbe75bb draft

(svn r20211) -Codechange: Indented code should have curly braces around it.
author alberth <alberth@openttd.org>
date Sat, 24 Jul 2010 10:14:39 +0000
parents fdcba2335701
children b9c61cdfc65b
files src/aircraft_cmd.cpp src/console_cmds.cpp src/debug.cpp src/economy.cpp src/engine.cpp src/fileio.cpp src/fontcache.cpp src/gfx.cpp src/graph_gui.cpp src/industry_cmd.cpp src/landscape.cpp src/main_gui.cpp src/misc/binaryheap.hpp src/misc/blob.hpp src/misc/crc32.hpp src/mixer.cpp src/network/network.cpp src/network/network_server.cpp src/network/network_udp.cpp src/newgrf_station.cpp src/openttd.cpp src/order_cmd.cpp src/order_gui.cpp src/os/windows/crashlog_win.cpp src/pathfinder/npf/aystar.cpp src/pathfinder/npf/npf.cpp src/pathfinder/yapf/yapf_rail.cpp src/rail_cmd.cpp src/rail_gui.cpp src/roadveh_cmd.cpp src/saveload/afterload.cpp src/saveload/oldloader_sl.cpp src/saveload/saveload.cpp src/saveload/vehicle_sl.cpp src/screenshot.cpp src/sdl.cpp src/settings.cpp src/ship_cmd.cpp src/spriteloader/grf.cpp src/station_cmd.cpp src/strgen/strgen.cpp src/strings.cpp src/town_cmd.cpp src/train_cmd.cpp src/transparency_gui.cpp src/tunnelbridge_cmd.cpp src/unmovable_cmd.cpp src/video/win32_v.cpp src/viewport.cpp
diffstat 49 files changed, 206 insertions(+), 177 deletions(-) [+]
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -148,8 +148,7 @@
 		const Station *st = Station::Get(order->station);
 		if (st->owner == v->owner && (st->facilities & FACIL_AIRPORT)) {
 			/* If an airport doesn't have a hangar, skip it */
-			if (st->Airport()->nof_depots != 0)
-				return true;
+			if (st->Airport()->nof_depots != 0) return true;
 		}
 	}
 
@@ -261,8 +260,9 @@
 	}
 
 	UnitID unit_num = (flags & DC_AUTOREPLACE) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT);
-	if (unit_num > _settings_game.vehicle.max_aircraft)
+	if (unit_num > _settings_game.vehicle.max_aircraft) {
 		return_cmd_error(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME);
+	}
 
 	if (flags & DC_EXEC) {
 		Aircraft *v = new Aircraft(); // aircraft
@@ -372,8 +372,9 @@
 		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
 		InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
 		SetWindowDirty(WC_COMPANY, v->owner);
-		if (IsLocalCompany())
+		if (IsLocalCompany()) {
 			InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Aircraft window
+		}
 
 		Company::Get(_current_company)->num_engines[eid]++;
 	}
@@ -571,11 +572,12 @@
 			}
 		}
 	} else {
-		if (u->cur_speed == 0)
+		if (u->cur_speed == 0) {
 			u->cur_speed = 0x70;
-
-		if (u->cur_speed >= 0x50)
+		}
+		if (u->cur_speed >= 0x50) {
 			u->cur_speed--;
+		}
 	}
 
 	int tick = ++u->tick_counter;
@@ -727,8 +729,9 @@
 	/* updates statusbar only if speed have changed to save CPU time */
 	if (spd != v->cur_speed) {
 		v->cur_speed = spd;
-		if (_settings_client.gui.vehicle_speed)
+		if (_settings_client.gui.vehicle_speed) {
 			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		}
 	}
 
 	/* Adjust distance moved by plane speed setting */
@@ -1144,8 +1147,9 @@
 		v->breakdown_ctr = 1;
 		v->vehstatus |= VS_AIRCRAFT_BROKEN;
 
-		if (v->breakdowns_since_last_service != 255)
+		if (v->breakdowns_since_last_service != 255) {
 			v->breakdowns_since_last_service++;
+		}
 		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
 		SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
 	}
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -324,8 +324,9 @@
 	const char *file = argv[1];
 	const FiosItem *item = GetFiosItem(file);
 	if (item != NULL) {
-		if (!FiosDelete(item->name))
+		if (!FiosDelete(item->name)) {
 			IConsolePrintF(CC_ERROR, "%s: Failed to delete file", file);
+		}
 	} else {
 		IConsolePrintF(CC_ERROR, "%s: No such file or directory.", file);
 	}
@@ -889,8 +890,9 @@
 		IConsoleCmdExec(cmdline);
 	}
 
-	if (ferror(script_file))
+	if (ferror(script_file)) {
 		IConsoleError("Encountered errror while trying to read from script file");
+	}
 
 	_script_running = false;
 	FioFCloseFile(script_file);
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -142,11 +142,12 @@
 
 		/* check debugging levels */
 		p = NULL;
-		for (i = debug_level; i != endof(debug_level); ++i)
+		for (i = debug_level; i != endof(debug_level); ++i) {
 			if (s == t + strlen(i->name) && strncmp(t, i->name, s - t) == 0) {
 				p = i->level;
 				break;
 			}
+		}
 
 		if (*s == '=') s++;
 		v = strtoul(s, &end, 0);
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -192,8 +192,9 @@
 
 		_score_part[owner][SCORE_VEHICLES] = num;
 		/* Don't allow negative min_profit to show */
-		if (min_profit > 0)
+		if (min_profit > 0) {
 			_score_part[owner][SCORE_MIN_PROFIT] = ClampToI32(min_profit);
+		}
 	}
 
 	/* Count stations */
@@ -561,8 +562,7 @@
 	}
 	cur_company.Restore();
 
-	if (!HasBit(1 << 0 | 1 << 3 | 1 << 6 | 1 << 9, _cur_month))
-		return;
+	if (!HasBit(1 << 0 | 1 << 3 | 1 << 6 | 1 << 9, _cur_month)) return;
 
 	FOR_ALL_COMPANIES(c) {
 		memmove(&c->old_economy[1], &c->old_economy[0], sizeof(c->old_economy) - sizeof(c->old_economy[0]));
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -747,8 +747,9 @@
 				e->flags |= ENGINE_EXCLUSIVE_PREVIEW;
 
 				/* Do not introduce new rail wagons */
-				if (!IsWagon(e->index))
+				if (!IsWagon(e->index)) {
 					e->preview_company_rank = 1; // Give to the company with the highest rating.
+				}
 			}
 		}
 	}
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -164,10 +164,9 @@
 
 void FioCloseAll()
 {
-	int i;
-
-	for (i = 0; i != lengthof(_fio.handles); i++)
+	for (int i = 0; i != lengthof(_fio.handles); i++) {
 		FioCloseFile(i);
+	}
 }
 
 #if defined(LIMITED_FDS)
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -263,7 +263,7 @@
 		font_name[length] = '\0';
 
 		if ((platformId == 1 && languageId == 0) ||      // Macintosh English
-			(platformId == 3 && languageId == 0x0409)) { // Microsoft English (US)
+				(platformId == 3 && languageId == 0x0409)) { // Microsoft English (US)
 			ret_font_name = font_name;
 			break;
 		}
@@ -467,8 +467,8 @@
 						CFRelease(font_name);
 						/* Skip some inappropriate or ugly looking fonts that have better alternatives. */
 						if (strncmp(name, "Courier", 7) == 0 || strncmp(name, "Apple Symbols", 13) == 0 ||
-							strncmp(name, ".Aqua", 5) == 0 || strncmp(name, "LastResort", 10) == 0 ||
-							strncmp(name, "GB18030 Bitmap", 14) == 0) continue;
+								strncmp(name, ".Aqua", 5) == 0 || strncmp(name, "LastResort", 10) == 0 ||
+								strncmp(name, "GB18030 Bitmap", 14) == 0) continue;
 
 						/* Save result. */
 						strecpy(settings->small_font,  name, lastof(settings->small_font));
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -1757,8 +1757,9 @@
 
 void CursorTick()
 {
-	if (_cursor.animate_timeout != 0 && --_cursor.animate_timeout == 0)
+	if (_cursor.animate_timeout != 0 && --_cursor.animate_timeout == 0) {
 		SwitchAnimatedCursor();
+	}
 }
 
 void SetMouseCursor(CursorID sprite, PaletteID pal)
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -360,8 +360,7 @@
 		GfxFillRect(r.left, y, r.right, y, GRAPH_AXIS_LINE_COLOUR);
 
 		/* Find the largest value that will be drawn. */
-		if (this->num_on_x_axis == 0)
-			return;
+		if (this->num_on_x_axis == 0) return;
 
 		assert(this->num_on_x_axis > 0);
 		assert(this->num_dataset > 0);
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -244,8 +244,9 @@
 
 	if (IsIndustryCompleted(ti->tile)) {
 		x = _industry_anim_offs_toffee[GetIndustryAnimationState(ti->tile)];
-		if (x == 0xFF)
+		if (x == 0xFF) {
 			x = 0;
+		}
 	}
 
 	AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_SHOVEL, PAL_NONE, 22 - x, 24 + x);
@@ -670,8 +671,7 @@
 	case GFX_GOLD_MINE_TOWER_ANIMATED: {
 			int state = _tick_counter & 0x7FF;
 
-			if ((state -= 0x400) < 0)
-				return;
+			if ((state -= 0x400) < 0) return;
 
 			if (state < 0x1A0) {
 				if (state < 0x20 || state >= 0x180) {
@@ -680,11 +680,9 @@
 						SetIndustryAnimationState(tile, m | 0x40);
 						SndPlayTileFx(SND_0B_MINING_MACHINERY, tile);
 					}
-					if (state & 7)
-						return;
+					if (state & 7) return;
 				} else {
-					if (state & 3)
-						return;
+					if (state & 3) return;
 				}
 				m = (GetIndustryAnimationState(tile) + 1) | 0x40;
 				if (m > 0xC2) m = 0xC0;
@@ -693,8 +691,7 @@
 			} else if (state >= 0x200 && state < 0x3A0) {
 				int i;
 				i = (state < 0x220 || state >= 0x380) ? 7 : 3;
-				if (state & i)
-					return;
+				if (state & i) return;
 
 				m = (GetIndustryAnimationState(tile) & 0xBF) - 1;
 				if (m < 0x80) m = 0x82;
@@ -972,8 +969,7 @@
 	int type;
 
 	if (_settings_game.game_creation.landscape == LT_ARCTIC) {
-		if (GetTileZ(tile) + TILE_HEIGHT * 2 >= GetSnowLine())
-			return;
+		if (GetTileZ(tile) + TILE_HEIGHT * 2 >= GetSnowLine()) return;
 	}
 
 	/* determine field size */
@@ -1066,8 +1062,9 @@
 
 	if (!IsIndustryCompleted(tile)) return;  ///< Can't proceed if not completed
 
-	if (CircularTileSearch(&tile, 40, SearchLumberMillTrees, NULL)) ///< 40x40 tiles  to search
+	if (CircularTileSearch(&tile, 40, SearchLumberMillTrees, NULL)) { ///< 40x40 tiles  to search
 		i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + 45); ///< Found a tree, add according value to waiting cargo
+	}
 }
 
 static void ProduceIndustryGoods(Industry *i)
@@ -1430,8 +1427,7 @@
 	TILE_LOOP(tile_walk, size_x, size_y, tile) {
 		curh = TileHeight(tile_walk);
 		/* Is the tile clear? */
-		if ((GetTileType(tile_walk) != MP_CLEAR) && (GetTileType(tile_walk) != MP_TREES))
-			return false;
+		if ((GetTileType(tile_walk) != MP_CLEAR) && (GetTileType(tile_walk) != MP_TREES)) return false;
 
 		/* Don't allow too big of a change if this is the sub-tile check */
 		if (internal != 0 && Delta(curh, height) > 1) return false;
@@ -1440,8 +1436,9 @@
 		 *  has to be correct too (in level, or almost in level)
 		 *  else you get a chain-reaction of terraforming. */
 		if (internal == 0 && curh != height) {
-			if (TileX(tile_walk) == 0 || TileY(tile_walk) == 0 || !CheckCanTerraformSurroundingTiles(tile_walk + TileDiffXY(-1, -1), height, internal + 1))
+			if (TileX(tile_walk) == 0 || TileY(tile_walk) == 0 || !CheckCanTerraformSurroundingTiles(tile_walk + TileDiffXY(-1, -1), height, internal + 1)) {
 				return false;
+			}
 		}
 	}
 
@@ -2279,8 +2276,9 @@
 				/* Prevent production to overflow or Oil Rig passengers to be over-"produced" */
 				new_prod = Clamp(new_prod, 1, 255);
 
-				if (((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0) && j == 1)
+				if (((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0) && j == 1) {
 					new_prod = Clamp(new_prod, 0, 16);
+				}
 
 				/* Do not stop closing the industry when it has the lowest possible production rate */
 				if (new_prod == old_prod && old_prod > 1) {
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -837,8 +837,9 @@
 			TileIndex t = AddTileIndexDiffCWrap(tile, *data);
 			if (t != INVALID_TILE && (TileHeight(t) >= 4 || IsTileType(t, MP_WATER))) break;
 		}
-		if (data == endof(_make_desert_or_rainforest_data))
+		if (data == endof(_make_desert_or_rainforest_data)) {
 			SetTropicZone(tile, TROPICZONE_DESERT);
+		}
 	}
 
 	for (uint i = 0; i != 256; i++) {
@@ -857,8 +858,9 @@
 			TileIndex t = AddTileIndexDiffCWrap(tile, *data);
 			if (t != INVALID_TILE && IsTileType(t, MP_CLEAR) && IsClearGround(t, CLEAR_DESERT)) break;
 		}
-		if (data == endof(_make_desert_or_rainforest_data))
+		if (data == endof(_make_desert_or_rainforest_data)) {
 			SetTropicZone(tile, TROPICZONE_RAINFOREST);
+		}
 	}
 }
 
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -180,8 +180,7 @@
 
 	if (_game_mode != GM_MENU) {
 		ViewPort *vp = w->viewport;
-		if ((in && vp->zoom == ZOOM_LVL_MIN) || (!in && vp->zoom == ZOOM_LVL_MAX))
-			return;
+		if ((in && vp->zoom == ZOOM_LVL_MIN) || (!in && vp->zoom == ZOOM_LVL_MAX)) return;
 
 		Point pt = GetTileZoomCenterWindow(in, w);
 		if (pt.x != -1) {
--- a/src/misc/binaryheap.hpp
+++ b/src/misc/binaryheap.hpp
@@ -87,8 +87,9 @@
 		/* while children are valid */
 		while (child <= this->items) {
 			/* choose the smaller child */
-			if (child < this->items && *this->data[child + 1] < *this->data[child])
+			if (child < this->items && *this->data[child + 1] < *this->data[child]) {
 				child++;
+			}
 			/* is it smaller than our parent? */
 			if (!(*this->data[child] < *item)) {
 				/* the smaller child is still bigger or same as parent => we are done */
--- a/src/misc/blob.hpp
+++ b/src/misc/blob.hpp
@@ -263,12 +263,14 @@
 		tmp->capacity = new_size - (header_size + tail_reserve);
 
 		/* copy existing data */
-		if (tmp->items != 0)
+		if (tmp->items != 0) {
 			memcpy(tmp + 1, data, tmp->items);
+		}
 
 		/* replace our block with new one */
-		if (Capacity() > 0)
+		if (Capacity() > 0) {
 			RawFree(&Hdr());
+		}
 		Init(tmp);
 	}
 
--- a/src/misc/crc32.hpp
+++ b/src/misc/crc32.hpp
@@ -22,8 +22,9 @@
 
 		uint8 *begin = (uint8*)pBuffer;
 		uint8 *end = begin + nCount;
-		for (uint8 *cur = begin; cur < end; cur++)
+		for (uint8 *cur = begin; cur < end; cur++) {
 			crc = (crc >> 8) ^ pTable[cur[0] ^ (uint8)(crc & 0xff)];
+		}
 		crc ^= 0xffffffff;
 
 		return crc;
--- a/src/mixer.cpp
+++ b/src/mixer.cpp
@@ -157,12 +157,13 @@
 MixerChannel *MxAllocateChannel()
 {
 	MixerChannel *mc;
-	for (mc = _channels; mc != endof(_channels); mc++)
+	for (mc = _channels; mc != endof(_channels); mc++) {
 		if (!mc->active) {
 			free(mc->memory);
 			mc->memory = NULL;
 			return mc;
 		}
+	}
 	return NULL;
 }
 
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -264,9 +264,9 @@
 	/* This client has missed his ACK packet after 1 DAY_TICKS..
 	 *  so we increase his lag for every frame that passes!
 	 * The packet can be out by a max of _net_frame_freq */
-	if (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq < _frame_counter)
+	if (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq < _frame_counter) {
 		lag += _frame_counter - (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq);
-
+	}
 	return lag;
 }
 
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -166,9 +166,9 @@
 			if (new_cs->status > STATUS_AUTHORIZED && new_cs != cs) {
 				/* Some errors we filter to a more general error. Clients don't have to know the real
 				 *  reason a joining failed. */
-				if (error == NETWORK_ERROR_NOT_AUTHORIZED || error == NETWORK_ERROR_NOT_EXPECTED || error == NETWORK_ERROR_WRONG_REVISION)
+				if (error == NETWORK_ERROR_NOT_AUTHORIZED || error == NETWORK_ERROR_NOT_EXPECTED || error == NETWORK_ERROR_WRONG_REVISION) {
 					error = NETWORK_ERROR_ILLEGAL_PACKET;
-
+				}
 				SEND_COMMAND(PACKET_SERVER_ERROR_QUIT)(new_cs, cs->client_id, error);
 			}
 		}
@@ -274,8 +274,9 @@
 
 		/* Transmit info about all the active clients */
 	FOR_ALL_CLIENT_SOCKETS(new_cs) {
-		if (new_cs != cs && new_cs->status > STATUS_AUTHORIZED)
+		if (new_cs != cs && new_cs->status > STATUS_AUTHORIZED) {
 			SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, new_cs->GetInfo());
+		}
 	}
 	/* Also send the info of the server */
 	return SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER));
@@ -1076,8 +1077,9 @@
 		if ((ClientID)dest == CLIENT_ID_SERVER) {
 			ci = NetworkFindClientInfoFromClientID(from_id);
 			/* Display the text locally, and that is it */
-			if (ci != NULL)
+			if (ci != NULL) {
 				NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
+			}
 		} else {
 			/* Else find the client to send the message to */
 			FOR_ALL_CLIENT_SOCKETS(cs) {
@@ -1093,8 +1095,9 @@
 			if (from_id == CLIENT_ID_SERVER) {
 				ci = NetworkFindClientInfoFromClientID(from_id);
 				ci_to = NetworkFindClientInfoFromClientID((ClientID)dest);
-				if (ci != NULL && ci_to != NULL)
+				if (ci != NULL && ci_to != NULL) {
 					NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), true, ci_to->client_name, msg, data);
+				}
 			} else {
 				FOR_ALL_CLIENT_SOCKETS(cs) {
 					if (cs->client_id == from_id) {
@@ -1156,8 +1159,9 @@
 			SEND_COMMAND(PACKET_SERVER_CHAT)(cs, action, from_id, false, msg, data);
 		}
 		ci = NetworkFindClientInfoFromClientID(from_id);
-		if (ci != NULL)
+		if (ci != NULL) {
 			NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
+		}
 		break;
 	}
 }
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -532,8 +532,7 @@
 void NetworkUDPAdvertise()
 {
 	/* Check if we should send an advertise */
-	if (!_networking || !_network_server || !_network_udp_server || !_settings_client.network.server_advertise)
-		return;
+	if (!_networking || !_network_server || !_network_udp_server || !_settings_client.network.server_advertise) return;
 
 	if (_network_need_advertise) {
 		_network_need_advertise = false;
@@ -541,13 +540,12 @@
 	} else {
 		/* Only send once every ADVERTISE_NORMAL_INTERVAL ticks */
 		if (_network_advertise_retries == 0) {
-			if ((_network_last_advertise_frame + ADVERTISE_NORMAL_INTERVAL) > _frame_counter)
-				return;
+			if ((_network_last_advertise_frame + ADVERTISE_NORMAL_INTERVAL) > _frame_counter) return;
+
 			_network_advertise_retries = ADVERTISE_RETRY_TIMES;
 		}
 
-		if ((_network_last_advertise_frame + ADVERTISE_RETRY_INTERVAL) > _frame_counter)
-			return;
+		if ((_network_last_advertise_frame + ADVERTISE_RETRY_INTERVAL) > _frame_counter) return;
 	}
 
 	_network_advertise_retries--;
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -195,8 +195,7 @@
 const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station)
 {
 	assert(sclass < STAT_CLASS_MAX);
-	if (station < _station_classes[sclass].stations)
-		return _station_classes[sclass].spec[station];
+	if (station < _station_classes[sclass].stations) return _station_classes[sclass].spec[station];
 
 	/* If the custom station isn't defined any more, then the GRF file
 	 * probably was not loaded. */
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -239,8 +239,9 @@
 static int MyGetOpt(MyGetOptData *md)
 {
 	char *s = md->cont;
-	if (s != NULL)
+	if (s != NULL) {
 		goto md_continue_here;
+	}
 
 	for (;;) {
 		if (--md->numleft < 0) return -1;
@@ -263,8 +264,7 @@
 						/* It comes as a separate arg. Check if out of args? */
 						if (--md->numleft < 0 || *(t = *md->argv) == '-') {
 							/* Check if item is optional? */
-							if (r[2] != ':')
-								return -2;
+							if (r[2] != ':') return -2;
 							md->numleft++;
 							t = NULL;
 						} else {
@@ -645,10 +645,11 @@
 
 	DEBUG(misc, 1, "Loading blitter...");
 	if (blitter == NULL && _ini_blitter != NULL) blitter = strdup(_ini_blitter);
-	if (BlitterFactoryBase::SelectBlitter(blitter) == NULL)
+	if (BlitterFactoryBase::SelectBlitter(blitter) == NULL) {
 		StrEmpty(blitter) ?
 			usererror("Failed to autoprobe blitter") :
 			usererror("Failed to select requested blitter '%s'; does it exist?", blitter);
+	}
 	free(blitter);
 
 	DEBUG(driver, 1, "Loading drivers...");
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -252,9 +252,9 @@
 
 	Order *order = this->first;
 
-	while (order != NULL && index-- > 0)
+	while (order != NULL && index-- > 0) {
 		order = order->next;
-
+	}
 	return order;
 }
 
@@ -686,8 +686,9 @@
 			if (sel_ord <= u->cur_order_index) {
 				uint cur = u->cur_order_index + 1;
 				/* Check if we don't go out of bound */
-				if (cur < u->GetNumOrders())
+				if (cur < u->GetNumOrders()) {
 					u->cur_order_index = cur;
+				}
 			}
 			/* Update any possible open window of the vehicle */
 			InvalidateVehicleOrder(u, INVALID_VEH_ORDER_ID | (sel_ord << 8));
@@ -752,8 +753,7 @@
 	if (ret.Failed()) return ret;
 
 	/* If we did not select an order, we maybe want to de-clone the orders */
-	if (sel_ord >= v->GetNumOrders())
-		return DecloneOrder(v, flags);
+	if (sel_ord >= v->GetNumOrders()) return DecloneOrder(v, flags);
 
 	order = v->GetOrder(sel_ord);
 	if (order == NULL) return CMD_ERROR;
@@ -764,8 +764,7 @@
 		Vehicle *u = v->FirstShared();
 		DeleteOrderWarnings(u);
 		for (; u != NULL; u = u->NextShared()) {
-			if (sel_ord < u->cur_order_index)
-				u->cur_order_index--;
+			if (sel_ord < u->cur_order_index) u->cur_order_index--;
 
 			assert(v->orders.list == u->orders.list);
 
@@ -1480,8 +1479,7 @@
 	if (v->vehstatus & VS_CRASHED) return;
 
 	/* Do nothing for stopped vehicles if setting is '1' */
-	if (_settings_client.gui.order_review_system == 1 && (v->vehstatus & VS_STOPPED))
-		return;
+	if (_settings_client.gui.order_review_system == 1 && (v->vehstatus & VS_STOPPED)) return;
 
 	/* do nothing we we're not the first vehicle in a share-chain */
 	if (v->FirstShared() != v) return;
@@ -1595,8 +1593,7 @@
 	const Order *order;
 
 	FOR_VEHICLE_ORDERS(v, order) {
-		if (order->IsType(OT_GOTO_DEPOT))
-			return true;
+		if (order->IsType(OT_GOTO_DEPOT)) return true;
 	}
 
 	return false;
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -509,7 +509,7 @@
 		if (this->vehicle->GetNumOrders() != 0 && _ctrl_pressed == 0) return false;
 
 		if (DoCommandP(this->vehicle->tile, this->vehicle->index | (u->index << 16), _ctrl_pressed ? CO_SHARE : CO_COPY,
-			_ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST))) {
+				_ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST))) {
 			this->selected_order = -1;
 			ResetObjectToPlace();
 		}
--- a/src/os/windows/crashlog_win.cpp
+++ b/src/os/windows/crashlog_win.cpp
@@ -152,8 +152,9 @@
 		uint32 crc = (uint32)-1;
 
 		for (;;) {
-			if (ReadFile(file, buffer, sizeof(buffer), &numread, NULL) == 0 || numread == 0)
+			if (ReadFile(file, buffer, sizeof(buffer), &numread, NULL) == 0 || numread == 0) {
 				break;
+			}
 			filesize += numread;
 			crc = CalcCRC(buffer, numread, crc);
 		}
--- a/src/pathfinder/npf/aystar.cpp
+++ b/src/pathfinder/npf/aystar.cpp
@@ -167,8 +167,9 @@
 
 	/* Check for end node and if found, return that code */
 	if (aystar->EndNodeCheck(aystar, current) == AYSTAR_FOUND_END_NODE) {
-		if (aystar->FoundEndNode != NULL)
+		if (aystar->FoundEndNode != NULL) {
 			aystar->FoundEndNode(aystar, current);
+		}
 		free(current);
 		return AYSTAR_FOUND_END_NODE;
 	}
--- a/src/pathfinder/npf/npf.cpp
+++ b/src/pathfinder/npf/npf.cpp
@@ -168,8 +168,9 @@
 	uint dist;
 
 	/* for train-stations, we are going to aim for the closest station tile */
-	if (as->user_data[NPF_TYPE] != TRANSPORT_WATER && fstd->station_index != INVALID_STATION)
+	if (as->user_data[NPF_TYPE] != TRANSPORT_WATER && fstd->station_index != INVALID_STATION) {
 		to = CalcClosestStationTile(fstd->station_index, from, fstd->station_type);
+	}
 
 	if (as->user_data[NPF_TYPE] == TRANSPORT_ROAD) {
 		/* Since roads only have diagonal pieces, we use manhattan distance here */
@@ -314,11 +315,13 @@
 
 	cost = _trackdir_length[trackdir]; // Should be different for diagonal tracks
 
-	if (IsBuoyTile(current->tile) && IsDiagonalTrackdir(trackdir))
+	if (IsBuoyTile(current->tile) && IsDiagonalTrackdir(trackdir)) {
 		cost += _settings_game.pf.npf.npf_buoy_penalty; // A small penalty for going over buoys
+	}
 
-	if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction))
+	if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction)) {
 		cost += _settings_game.pf.npf.npf_water_curve_penalty;
+	}
 
 	/* @todo More penalties? */
 
@@ -373,8 +376,9 @@
 
 	/* Check for turns. Road vehicles only really drive diagonal, turns are
 	 * represented by non-diagonal tracks */
-	if (!IsDiagonalTrackdir(current->direction))
+	if (!IsDiagonalTrackdir(current->direction)) {
 		cost += _settings_game.pf.npf.npf_road_curve_penalty;
+	}
 
 	NPFMarkTile(tile);
 	DEBUG(npf, 4, "Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);
@@ -502,15 +506,17 @@
 	/* HACK: We create a new_node here so we can call EndNodeCheck. Ugly as hell
 	 * of course... */
 	new_node.path.node = *current;
-	if (as->EndNodeCheck(as, &new_node) == AYSTAR_FOUND_END_NODE && NPFGetFlag(current, NPF_FLAG_LAST_SIGNAL_RED))
+	if (as->EndNodeCheck(as, &new_node) == AYSTAR_FOUND_END_NODE && NPFGetFlag(current, NPF_FLAG_LAST_SIGNAL_RED)) {
 		cost += _settings_game.pf.npf.npf_rail_lastred_penalty;
+	}
 
 	/* Check for slope */
 	cost += NPFSlopeCost(current);
 
 	/* Check for turns */
-	if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction))
+	if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction)) {
 		cost += _settings_game.pf.npf.npf_rail_curve_penalty;
+	}
 	/* TODO, with realistic acceleration, also the amount of straight track between
 	 *      curves should be taken into account, as this affects the speed limit. */
 
@@ -933,9 +939,10 @@
 
 		/* Tile with signals? */
 		if (IsTileType(dst_tile, MP_RAILWAY) && GetRailTileType(dst_tile) == RAIL_TILE_SIGNALS) {
-			if (HasSignalOnTrackdir(dst_tile, ReverseTrackdir(dst_trackdir)) && !HasSignalOnTrackdir(dst_tile, dst_trackdir) && IsOnewaySignal(dst_tile, TrackdirToTrack(dst_trackdir)))
+			if (HasSignalOnTrackdir(dst_tile, ReverseTrackdir(dst_trackdir)) && !HasSignalOnTrackdir(dst_tile, dst_trackdir) && IsOnewaySignal(dst_tile, TrackdirToTrack(dst_trackdir))) {
 				/* If there's a one-way signal not pointing towards us, stop going in this direction. */
 				break;
+			}
 		}
 		{
 			/* We've found ourselves a neighbour :-) */
--- a/src/pathfinder/yapf/yapf_rail.cpp
+++ b/src/pathfinder/yapf/yapf_rail.cpp
@@ -176,8 +176,9 @@
 
 		if (target != NULL) target->okay = true;
 
-		if (Yapf().CanUseGlobalCache(*m_res_node))
+		if (Yapf().CanUseGlobalCache(*m_res_node)) {
 			YapfNotifyTrackLayoutChange(INVALID_TILE, INVALID_TRACK);
+		}
 
 		return true;
 	}
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -562,8 +562,9 @@
 			cost.AddCost(RailClearCost(GetRailType(tile)));
 
 			/* Charge extra to remove signals on the track, if they are there */
-			if (HasSignalOnTrack(tile, track))
+			if (HasSignalOnTrack(tile, track)) {
 				cost.AddCost(DoCommand(tile, track, 0, flags, CMD_REMOVE_SIGNALS));
+			}
 
 			if (flags & DC_EXEC) {
 				if (HasReservedTracks(tile, trackbit)) {
@@ -703,12 +704,10 @@
 	}
 
 	/* validate the direction */
-	while (
-		(trdx <= 0 && dx > 0) ||
-		(trdx >= 0 && dx < 0) ||
-		(trdy <= 0 && dy > 0) ||
-		(trdy >= 0 && dy < 0)
-	) {
+	while ((trdx <= 0 && dx > 0) ||
+			(trdx >= 0 && dx < 0) ||
+			(trdy <= 0 && dy > 0) ||
+			(trdy >= 0 && dy < 0)) {
 		if (!HasBit(*trackdir, 3)) { // first direction is invalid, try the other
 			SetBit(*trackdir, 3); // reverse the direction
 			trdx = -trdx;
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -1072,14 +1072,14 @@
 			int x = _settings_client.gui.station_numtracks;
 			int y = _settings_client.gui.station_platlength;
 			if (_railstation.orientation == AXIS_X) Swap(x, y);
-			if (!_remove_button_clicked)
+			if (!_remove_button_clicked) {
 				SetTileSelectSize(x, y);
+			}
 		}
 
 		int rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
 
-		if (_settings_client.gui.station_show_coverage)
-			SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
+		if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 
 		for (uint bits = 0; bits < 7; bits++) {
 			bool disable = bits >= _settings_game.station.station_spread;
@@ -1335,9 +1335,8 @@
 
 				/* Check station availability callback */
 				statspec = GetCustomStationSpec(_railstation.station_class, y);
-				if (statspec != NULL &&
-					HasBit(statspec->callback_mask, CBM_STATION_AVAIL) &&
-					GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) return;
+				if (statspec != NULL && HasBit(statspec->callback_mask, CBM_STATION_AVAIL) &&
+						GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) return;
 
 				_railstation.station_type = y;
 
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -601,8 +601,9 @@
 		v->breakdown_ctr = 1;
 		v->cur_speed = 0;
 
-		if (v->breakdowns_since_last_service != 255)
+		if (v->breakdowns_since_last_service != 255) {
 			v->breakdowns_since_last_service++;
+		}
 
 		v->MarkDirty();
 		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
@@ -646,8 +647,9 @@
 {
 	if (!PlayVehicleSound(v, VSE_START)) {
 		SoundID s = RoadVehInfo(v->engine_type)->sfx;
-		if (s == SND_19_BUS_START_PULL_AWAY && (v->tick_counter & 3) == 0)
+		if (s == SND_19_BUS_START_PULL_AWAY && (v->tick_counter & 3) == 0) {
 			s = SND_1A_BUS_START_PULL_AWAY_WITH_HORN;
+		}
 		SndPlayVehicleFx(s, v);
 	}
 }
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -638,8 +638,9 @@
 	 *  a company does not exist yet. So create one here.
 	 * 1 exeption: network-games. Those can have 0 companies
 	 *   But this exeption is not true for non dedicated network_servers! */
-	if (!Company::IsValidID(COMPANY_FIRST) && (!_networking || (_networking && _network_server && !_network_dedicated)))
+	if (!Company::IsValidID(COMPANY_FIRST) && (!_networking || (_networking && _network_server && !_network_dedicated))) {
 		DoStartupNewCompany(false);
+	}
 
 	/* Fix the cache for cargo payments. */
 	CargoPayment *cp;
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -993,8 +993,9 @@
 
 		if (num == 0) {
 			/* If the first company has no name, make sure we call it UNNAMED */
-			if (c->name_1 == 0)
+			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 */
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -409,8 +409,9 @@
 			i &= ~0x40;
 			if (HasBit(i, 5)) {
 				i &= ~0x20;
-				if (HasBit(i, 4))
+				if (HasBit(i, 4)) {
 					SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Unsupported gamma");
+				}
 				i = (i << 8) | SlReadByte();
 			}
 			i = (i << 8) | SlReadByte();
@@ -538,8 +539,9 @@
 					break;
 				case CH_ARRAY:
 					assert(_sl.last_array_index <= _sl.array_index);
-					while (++_sl.last_array_index <= _sl.array_index)
+					while (++_sl.last_array_index <= _sl.array_index) {
 						SlWriteArrayLength(1);
+					}
 					SlWriteArrayLength(length + 1);
 					break;
 				case CH_SPARSE_ARRAY:
@@ -1520,8 +1522,7 @@
 
 		/* inflate the data */
 		r = inflate(&_z, 0);
-		if (r == Z_STREAM_END)
-			break;
+		if (r == Z_STREAM_END) break;
 
 		if (r != Z_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "inflate() failed");
 	} while (_z.avail_out);
@@ -1569,8 +1570,8 @@
 		if ((n = sizeof(buf) - z->avail_out) != 0) {
 			if (fwrite(buf, n, 1, _sl.fh) != 1) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
 		}
-		if (r == Z_STREAM_END)
-			break;
+		if (r == Z_STREAM_END) break;
+
 		if (r != Z_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "zlib returned error code");
 	} while (z->avail_in || !z->avail_out);
 }
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -733,8 +733,9 @@
 		}
 
 		/* Old savegames used 'last_station_visited = 0xFF' */
-		if (CheckSavegameVersion(5) && v->last_station_visited == 0xFF)
+		if (CheckSavegameVersion(5) && v->last_station_visited == 0xFF) {
 			v->last_station_visited = INVALID_STATION;
+		}
 
 		if (CheckSavegameVersion(5)) {
 			/* Convert the current_order.type (which is a mix of type and flags, because
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -307,8 +307,9 @@
 		y += n;
 
 		/* write them to png */
-		for (i = 0; i != n; i++)
+		for (i = 0; i != n; i++) {
 			png_write_row(png_ptr, (png_bytep)buff + i * w * bpp);
+		}
 	} while (y != h);
 
 	png_write_end(png_ptr, info_ptr);
@@ -356,8 +357,7 @@
 		DEBUG(misc, 0, "Can't convert a 32bpp screenshot to PCX format. Please pick another format.");
 		return false;
 	}
-	if (pixelformat != 8 || w == 0)
-		return false;
+	if (pixelformat != 8 || w == 0) return false;
 
 	f = fopen(name, "wb");
 	if (f == NULL) return false;
@@ -413,12 +413,13 @@
 				uint8 ch = bufp[j];
 
 				if (ch != runchar || runcount >= 0x3f) {
-					if (runcount > 1 || (runchar & 0xC0) == 0xC0)
+					if (runcount > 1 || (runchar & 0xC0) == 0xC0) {
 						if (fputc(0xC0 | runcount, f) == EOF) {
 							free(buff);
 							fclose(f);
 							return false;
 						}
+					}
 					if (fputc(runchar, f) == EOF) {
 						free(buff);
 						fclose(f);
@@ -431,12 +432,13 @@
 			}
 
 			/* write remaining bytes.. */
-			if (runcount > 1 || (runchar & 0xC0) == 0xC0)
+			if (runcount > 1 || (runchar & 0xC0) == 0xC0) {
 				if (fputc(0xC0 | runcount, f) == EOF) {
 					free(buff);
 					fclose(f);
 					return false;
 				}
+			}
 			if (fputc(runchar, f) == EOF) {
 				free(buff);
 				fclose(f);
--- a/src/sdl.cpp
+++ b/src/sdl.cpp
@@ -67,10 +67,12 @@
 
 static const char *LoadSdlDLL()
 {
-	if (sdl_proc.SDL_Init != NULL)
+	if (sdl_proc.SDL_Init != NULL) {
 		return NULL;
-	if (!LoadLibraryList((Function *)(void *)&sdl_proc, sdl_files))
+	}
+	if (!LoadLibraryList((Function *)(void *)&sdl_proc, sdl_files)) {
 		return "Unable to load sdl.dll";
+	}
 	return NULL;
 }
 
@@ -86,11 +88,9 @@
 	}
 #endif
 	if (_sdl_usage++ == 0) {
-		if (SDL_CALL SDL_Init(x | SDL_INIT_NOPARACHUTE) == -1)
-			return SDL_CALL SDL_GetError();
+		if (SDL_CALL SDL_Init(x | SDL_INIT_NOPARACHUTE) == -1) return SDL_CALL SDL_GetError();
 	} else if (x != 0) {
-		if (SDL_CALL SDL_InitSubSystem(x) == -1)
-			return SDL_CALL SDL_GetError();
+		if (SDL_CALL SDL_InitSubSystem(x) == -1) return SDL_CALL SDL_GetError();
 	}
 
 	return NULL;
@@ -98,8 +98,9 @@
 
 void SdlClose(uint32 x)
 {
-	if (x != 0)
+	if (x != 0) {
 		SDL_CALL SDL_QuitSubSystem(x);
+	}
 	if (--_sdl_usage == 0) {
 		SDL_CALL SDL_Quit();
 	}
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -107,8 +107,7 @@
 	if (onelen == 0) onelen = strlen(one);
 
 	/* check if it's an integer */
-	if (*one >= '0' && *one <= '9')
-		return strtoul(one, NULL, 0);
+	if (*one >= '0' && *one <= '9') return strtoul(one, NULL, 0);
 
 	idx = 0;
 	for (;;) {
@@ -348,10 +347,8 @@
 		return 0;
 	}
 	case SDT_BOOLX:
-		if (strcmp(str, "true")  == 0 || strcmp(str, "on")  == 0 || strcmp(str, "1") == 0)
-			return (void*)true;
-		if (strcmp(str, "false") == 0 || strcmp(str, "off") == 0 || strcmp(str, "0") == 0)
-			return (void*)false;
+		if (strcmp(str, "true")  == 0 || strcmp(str, "on")  == 0 || strcmp(str, "1") == 0) return (void*)true;
+		if (strcmp(str, "false") == 0 || strcmp(str, "off") == 0 || strcmp(str, "0") == 0) return (void*)false;
 		ShowInfoF("ini: invalid setting value '%s' for '%s'", str, desc->name);
 		break;
 
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -166,8 +166,9 @@
 
 void Ship::OnNewDay()
 {
-	if ((++this->day_counter & 7) == 0)
+	if ((++this->day_counter & 7) == 0) {
 		DecreaseVehicleValue(this);
+	}
 
 	CheckVehicleBreakdown(this);
 	AgeVehicle(this);
@@ -212,8 +213,9 @@
 		v->breakdown_ctr = 1;
 		v->cur_speed = 0;
 
-		if (v->breakdowns_since_last_service != 255)
+		if (v->breakdowns_since_last_service != 255) {
 			v->breakdowns_since_last_service++;
+		}
 
 		v->MarkDirty();
 		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
@@ -337,8 +339,9 @@
 	/* updates statusbar only if speed have changed to save CPU time */
 	if (spd != v->cur_speed) {
 		v->cur_speed = spd;
-		if (_settings_client.gui.vehicle_speed)
+		if (_settings_client.gui.vehicle_speed) {
 			SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
+		}
 	}
 
 	/* Convert direction-indepenent speed into direction-dependent speed. (old movement method) */
@@ -626,8 +629,7 @@
 
 	unit_num = (flags & DC_AUTOREPLACE) ? 0 : GetFreeUnitNumber(VEH_SHIP);
 
-	if (!Vehicle::CanAllocateItem() || unit_num > _settings_game.vehicle.max_ships)
-		return_cmd_error(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME);
+	if (!Vehicle::CanAllocateItem() || unit_num > _settings_game.vehicle.max_ships) return_cmd_error(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME);
 
 	if (flags & DC_EXEC) {
 		int x;
--- a/src/spriteloader/grf.cpp
+++ b/src/spriteloader/grf.cpp
@@ -161,8 +161,9 @@
 	}
 
 	/* Make sure to mark all transparent pixels transparent on the alpha channel too */
-	for (int i = 0; i < sprite->width * sprite->height; i++)
+	for (int i = 0; i < sprite->width * sprite->height; i++) {
 		if (sprite->data[i].m != 0) sprite->data[i].a = 0xFF;
+	}
 
 	return true;
 }
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1155,8 +1155,7 @@
 
 	if (st != NULL) {
 		/* Reuse an existing station. */
-		if (st->owner != _current_company)
-			return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION);
+		if (st->owner != _current_company) return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION);
 
 		if (st->train_station.tile != INVALID_TILE) {
 			/* check if we want to expanding an already existing station? */
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -524,8 +524,9 @@
 		strecpy(_lang_isocode, str + 8, lastof(_lang_isocode));
 	} else if (!memcmp(str, "plural ", 7)) {
 		_lang_pluralform = atoi(str + 7);
-		if (_lang_pluralform >= lengthof(_plural_forms))
+		if (_lang_pluralform >= lengthof(_plural_forms)) {
 			error("Invalid pluralform %d", _lang_pluralform);
+		}
 	} else if (!memcmp(str, "textdir ", 8)) {
 		if (!memcmp(str + 8, "ltr", 3)) {
 			_lang_textdir = TD_LTR;
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -113,13 +113,15 @@
 
 	switch (tab) {
 		case 4:
-			if (index >= 0xC0)
+			if (index >= 0xC0) {
 				return GetSpecialTownNameString(buffr, index - 0xC0, GetInt32(&argv), last);
+			}
 			break;
 
 		case 14:
-			if (index >= 0xE4)
+			if (index >= 0xE4) {
 				return GetSpecialNameString(buffr, index - 0xE4, argv, last);
+			}
 			break;
 
 		case 15:
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -757,7 +757,7 @@
 
 		/* Test for roadbit parallel to dir and facing towards the middle axis */
 		if (IsValidTile(tile + cur) &&
-			GetTownRoadBits(TILE_ADD(tile, cur)) & DiagDirToRoadBits((pos & 2) ? dir : ReverseDiagDir(dir))) return true;
+				GetTownRoadBits(TILE_ADD(tile, cur)) & DiagDirToRoadBits((pos & 2) ? dir : ReverseDiagDir(dir))) return true;
 	}
 	return false;
 }
@@ -1232,8 +1232,9 @@
 		/* Exclude the source position from the bitmask
 		 * and return if no more road blocks available */
 		cur_rb &= ~DiagDirToRoadBits(ReverseDiagDir(target_dir));
-		if (cur_rb == ROAD_NONE)
+		if (cur_rb == ROAD_NONE) {
 			return _grow_town_result;
+		}
 
 		/* Select a random bit from the blockmask, walk a step
 		 * and continue the search from there. */
@@ -2508,16 +2509,13 @@
 			const TownActions cur = (TownActions)(1 << i);
 
 			/* Is the company not able to bribe ? */
-			if (cur == TACT_BRIBE && (!_settings_game.economy.bribe || t->ratings[cid] >= RATING_BRIBE_MAXIMUM))
-				continue;
+			if (cur == TACT_BRIBE && (!_settings_game.economy.bribe || t->ratings[cid] >= RATING_BRIBE_MAXIMUM)) continue;
 
 			/* Is the company not able to buy exclusive rights ? */
-			if (cur == TACT_BUY_RIGHTS && !_settings_game.economy.exclusive_rights)
-				continue;
+			if (cur == TACT_BUY_RIGHTS && !_settings_game.economy.exclusive_rights) continue;
 
 			/* Is the company not able to build a statue ? */
-			if (cur == TACT_BUILD_STATUE && HasBit(t->statues, cid))
-				continue;
+			if (cur == TACT_BUILD_STATUE && HasBit(t->statues, cid)) continue;
 
 			if (avail >= _town_action_costs[i] * _price[PR_TOWN_ACTION] >> 8) {
 				buttons |= cur;
@@ -2615,11 +2613,10 @@
 	}
 
 	if (_settings_game.game_creation.landscape == LT_ARCTIC) {
-		if (TilePixelHeight(t->xy) >= GetSnowLine() && t->act_food == 0 && t->population > 90)
-			return;
+		if (TilePixelHeight(t->xy) >= GetSnowLine() && t->act_food == 0 && t->population > 90) return;
+
 	} else if (_settings_game.game_creation.landscape == LT_TROPIC) {
-		if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food == 0 || t->act_water == 0) && t->population > 60)
-			return;
+		if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food == 0 || t->act_water == 0) && t->population > 60) return;
 	}
 
 	/* Use the normal growth rate values if new buildings have been funded in
@@ -2630,8 +2627,9 @@
 	if (t->larger_town) m /= 2;
 
 	t->growth_rate = m / (t->num_houses / 50 + 1);
-	if (m <= t->grow_counter)
+	if (m <= t->grow_counter) {
 		t->grow_counter = m;
+	}
 
 	SetBit(t->flags, TOWN_IS_FUNDED);
 }
@@ -2850,8 +2848,9 @@
 	FOR_ALL_TOWNS(t) {
 		if (t->road_build_months != 0) t->road_build_months--;
 
-		if (t->exclusive_counter != 0)
+		if (t->exclusive_counter != 0) {
 			if (--t->exclusive_counter == 0) t->exclusivity = INVALID_COMPANY;
+		}
 
 		UpdateTownGrowRate(t);
 		UpdateTownAmounts(t);
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -206,7 +206,7 @@
 		}
 
 		if (rvi_v->pow_wag_power != 0 && rvi_u->railveh_type == RAILVEH_WAGON &&
-			UsesWagonOverride(u) && !HasBit(u->tcache.cached_vis_effect, 7)) {
+				UsesWagonOverride(u) && !HasBit(u->tcache.cached_vis_effect, 7)) {
 			/* wagon is powered */
 			SetBit(u->flags, VRF_POWEREDWAGON); // cache 'powered' status
 		} else {
@@ -2862,8 +2862,9 @@
 	this->subspeed = (byte)spd;
 	{
 		int tempmax = this->max_speed;
-		if (this->cur_speed > this->max_speed)
+		if (this->cur_speed > this->max_speed) {
 			tempmax = this->cur_speed - (this->cur_speed / 10) - 1;
+		}
 		this->cur_speed = spd = Clamp(this->cur_speed + ((int)spd >> 8), 0, tempmax);
 	}
 
@@ -3587,8 +3588,9 @@
 		v->breakdown_ctr = 1;
 		v->cur_speed = 0;
 
-		if (v->breakdowns_since_last_service != 255)
+		if (v->breakdowns_since_last_service != 255) {
 			v->breakdowns_since_last_service++;
+		}
 
 		v->MarkDirty();
 		SetWindowDirty(WC_VEHICLE_VIEW, v->index);
--- a/src/transparency_gui.cpp
+++ b/src/transparency_gui.cpp
@@ -100,8 +100,9 @@
 			uint i;
 			for (i = TTW_WIDGET_BEGIN; i < TTW_WIDGET_END; i++) {
 				const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(i);
-				if (IsInsideBS(pt.x, nwid->pos_x, nwid->current_x))
+				if (IsInsideBS(pt.x, nwid->pos_x, nwid->current_x)) {
 					break;
+				}
 			}
 			if (i == TTW_WIDGET_LOADING || i == TTW_WIDGET_END) return;
 
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -334,8 +334,7 @@
 		if (ret.Failed()) return ret;
 		cost = ret;
 
-		if (terraform_cost_north.Failed() || (terraform_cost_north.GetCost() != 0 && !allow_on_slopes))
-			return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
+		if (terraform_cost_north.Failed() || (terraform_cost_north.GetCost() != 0 && !allow_on_slopes)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 		cost.AddCost(terraform_cost_north);
 
 		/* Try and clear the end landscape */
@@ -344,8 +343,7 @@
 		cost.AddCost(ret);
 
 		/* false - end tile slope check */
-		if (terraform_cost_south.Failed() || (terraform_cost_south.GetCost() != 0 && !allow_on_slopes))
-			return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
+		if (terraform_cost_south.Failed() || (terraform_cost_south.GetCost() != 0 && !allow_on_slopes)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
 		cost.AddCost(terraform_cost_south);
 
 		if (transport_type == TRANSPORT_WATER && (tileh_start == SLOPE_FLAT || tileh_end == SLOPE_FLAT)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -286,8 +286,9 @@
 	}
 
 	/* checks if you're allowed to remove unmovable things */
-	if (_game_mode != GM_EDITOR && _current_company != OWNER_WATER && ((flags & DC_AUTO) || !_cheats.magic_bulldozer.value) )
-		return_cmd_error(flags & DC_AUTO ? STR_ERROR_OBJECT_IN_THE_WAY : INVALID_STRING_ID);
+	if (_game_mode != GM_EDITOR && _current_company != OWNER_WATER && ((flags & DC_AUTO) || !_cheats.magic_bulldozer.value)) {
+		return_cmd_error((flags & DC_AUTO) ? STR_ERROR_OBJECT_IN_THE_WAY : INVALID_STRING_ID);
+	}
 
 	if (IsStatue(tile)) {
 		if (flags & DC_AUTO) return_cmd_error(STR_ERROR_OBJECT_IN_THE_WAY);
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -689,8 +689,7 @@
 
 	if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
 
-	if (w == _screen.width && h == _screen.height)
-		return false;
+	if (w == _screen.width && h == _screen.height) return false;
 
 	_screen.width = w;
 	_screen.pitch = (bpp == 8) ? Align(w, 4) : w;
@@ -822,8 +821,8 @@
 
 static void CheckPaletteAnim()
 {
-	if (_pal_count_dirty == 0)
-		return;
+	if (_pal_count_dirty == 0) return;
+
 	InvalidateRect(_wnd.main_wnd, NULL, FALSE);
 }
 
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1057,7 +1057,7 @@
 			_tile_type_procs[tt]->draw_tile_proc(&ti);
 
 			if ((x_cur == (int)MapMaxX() * TILE_SIZE && IsInsideMM(y_cur, 0, MapMaxY() * TILE_SIZE + 1)) ||
-				(y_cur == (int)MapMaxY() * TILE_SIZE && IsInsideMM(x_cur, 0, MapMaxX() * TILE_SIZE + 1))) {
+					(y_cur == (int)MapMaxY() * TILE_SIZE && IsInsideMM(x_cur, 0, MapMaxX() * TILE_SIZE + 1))) {
 				TileIndex tile = TileVirtXY(x_cur, y_cur);
 				ti.tile = tile;
 				ti.tileh = GetTileSlope(tile, &ti.z);
@@ -1875,8 +1875,7 @@
 	Point pt = MapXYZToViewport(w->viewport, x, y, z);
 	w->viewport->follow_vehicle = INVALID_VEHICLE;
 
-	if (w->viewport->dest_scrollpos_x == pt.x && w->viewport->dest_scrollpos_y == pt.y)
-		return false;
+	if (w->viewport->dest_scrollpos_x == pt.x && w->viewport->dest_scrollpos_y == pt.y) return false;
 
 	if (instant) {
 		w->viewport->scrollpos_x = pt.x;
@@ -2713,8 +2712,9 @@
 	_thd.window_class = window_class;
 	_thd.window_number = window_num;
 
-	if (mode == HT_SPECIAL) // special tools, like tunnels or docks start with presizing mode
+	if (mode == HT_SPECIAL) { // special tools, like tunnels or docks start with presizing mode
 		VpStartPreSizing();
+	}
 
 	if ((icon & ANIMCURSOR_FLAG) != 0) {
 		SetAnimatedMouseCursor(_animcursors[icon & ~ANIMCURSOR_FLAG]);