diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index e3cd7f608f..8d0a3dda0f 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -707,7 +707,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
 	int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE);
 	int safe_y = Clamp(y - 1, 0, MapMaxY() * TILE_SIZE);
 	u->x_pos = x;
-	u->y_pos = y - ((v->z_pos-GetSlopeZ(safe_x, safe_y)) >> 3);;
+	u->y_pos = y - ((v->z_pos - GetSlopeZ(safe_x, safe_y)) >> 3);;
 
 	safe_y = Clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE);
 	u->z_pos = GetSlopeZ(safe_x, safe_y);
@@ -800,7 +800,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
 
 	speed_limit = min(speed_limit, v->max_speed);
 
-	v->subspeed = (t=v->subspeed) + (byte)spd;
+	v->subspeed = (t = v->subspeed) + (byte)spd;
 
 	/* Aircraft's current speed is used twice so that very fast planes are
 	 * forced to slow down rapidly in the short distance needed. The magic
@@ -1160,7 +1160,7 @@ static bool HandleCrashedAircraft(Aircraft *v)
 
 	if (v->crashed_counter < 650) {
 		uint32 r;
-		if (Chance16R(1,32,r)) {
+		if (Chance16R(1, 32, r)) {
 			static const DirDiff delta[] = {
 				DIRDIFF_45LEFT, DIRDIFF_SAME, DIRDIFF_SAME, DIRDIFF_45RIGHT
 			};
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 2ca91d5e5b..398ac6b68b 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -615,10 +615,10 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
 				this->widget[GLAND_WATER_SE].data = STR_BORDER_RANDOM;
 				this->widget[GLAND_WATER_SW].data = STR_BORDER_RANDOM;
 			} else {
-				this->widget[GLAND_WATER_NE].data = HasBit(_settings_newgame.game_creation.water_borders,BORDER_NE) ? STR_BORDER_WATER : STR_BORDER_FREEFORM;
-				this->widget[GLAND_WATER_NW].data = HasBit(_settings_newgame.game_creation.water_borders,BORDER_NW) ? STR_BORDER_WATER : STR_BORDER_FREEFORM;
-				this->widget[GLAND_WATER_SE].data = HasBit(_settings_newgame.game_creation.water_borders,BORDER_SE) ? STR_BORDER_WATER : STR_BORDER_FREEFORM;
-				this->widget[GLAND_WATER_SW].data = HasBit(_settings_newgame.game_creation.water_borders,BORDER_SW) ? STR_BORDER_WATER : STR_BORDER_FREEFORM;
+				this->widget[GLAND_WATER_NE].data = HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE) ? STR_BORDER_WATER : STR_BORDER_FREEFORM;
+				this->widget[GLAND_WATER_NW].data = HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW) ? STR_BORDER_WATER : STR_BORDER_FREEFORM;
+				this->widget[GLAND_WATER_SE].data = HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE) ? STR_BORDER_WATER : STR_BORDER_FREEFORM;
+				this->widget[GLAND_WATER_SW].data = HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW) ? STR_BORDER_WATER : STR_BORDER_FREEFORM;
 			}
 		} else {
 			this->widget[GLAND_TREE_PULLDOWN].data               = _tree_placer[_settings_newgame.game_creation.tree_placer];
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index b60192ef55..46e623f451 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1310,11 +1310,11 @@ static const NWidgetPart _nested_network_start_server_window_widgets[] = {
 				NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_LABEL), SetMinimalSize(131, 13), SetDataTip(STR_NETWORK_NUMBER_OF_CLIENTS, STR_NULL),
 				NWidget(NWID_SPACER), SetMinimalSize(0, 1),
 				NWidget(NWID_HORIZONTAL),
-					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE,NSSW_CLIENTS_BTND), SetMinimalSize(12, 12),
+					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_BTND), SetMinimalSize(12, 12),
 												SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_NUMBER_OF_CLIENTS_TIP),
 					NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_TXT), SetMinimalSize(106, 12),
 												SetDataTip(STR_NETWORK_CLIENTS_SELECT, STR_NETWORK_NUMBER_OF_CLIENTS_TIP),
-					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE,NSSW_CLIENTS_BTNU), SetMinimalSize(13, 12),
+					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_BTNU), SetMinimalSize(13, 12),
 												SetDataTip(SPR_ARROW_UP, STR_NETWORK_NUMBER_OF_CLIENTS_TIP),
 				EndContainer(),
 
@@ -1322,11 +1322,11 @@ static const NWidgetPart _nested_network_start_server_window_widgets[] = {
 				NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_LABEL), SetMinimalSize(131, 13), SetDataTip(STR_NETWORK_NUMBER_OF_COMPANIES, STR_NULL),
 				NWidget(NWID_SPACER), SetMinimalSize(0, 1),
 				NWidget(NWID_HORIZONTAL),
-					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE,NSSW_COMPANIES_BTND), SetMinimalSize(12, 12),
+					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_BTND), SetMinimalSize(12, 12),
 												SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_NUMBER_OF_COMPANIES_TIP),
 					NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_TXT), SetMinimalSize(106, 12),
 												SetDataTip(STR_NETWORK_COMPANIES_SELECT, STR_NETWORK_NUMBER_OF_COMPANIES_TIP),
-					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE,NSSW_COMPANIES_BTNU), SetMinimalSize(13, 12),
+					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_BTNU), SetMinimalSize(13, 12),
 												SetDataTip(SPR_ARROW_UP, STR_NETWORK_NUMBER_OF_COMPANIES_TIP),
 				EndContainer(),
 
@@ -1334,11 +1334,11 @@ static const NWidgetPart _nested_network_start_server_window_widgets[] = {
 				NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_LABEL), SetMinimalSize(131, 13), SetDataTip(STR_NETWORK_NUMBER_OF_SPECTATORS, STR_NULL),
 				NWidget(NWID_SPACER), SetMinimalSize(0, 1),
 				NWidget(NWID_HORIZONTAL),
-					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE,NSSW_SPECTATORS_BTND), SetMinimalSize(12, 12),
+					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_BTND), SetMinimalSize(12, 12),
 												SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_NUMBER_OF_SPECTATORS_TIP),
 					NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_TXT), SetMinimalSize(106, 12),
 												SetDataTip(STR_NETWORK_SPECTATORS_SELECT, STR_NETWORK_NUMBER_OF_SPECTATORS_TIP),
-					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE,NSSW_SPECTATORS_BTNU), SetMinimalSize(13, 12),
+					NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_BTNU), SetMinimalSize(13, 12),
 												SetDataTip(SPR_ARROW_UP, STR_NETWORK_NUMBER_OF_SPECTATORS_TIP),
 				EndContainer(),
 
@@ -1607,7 +1607,7 @@ static const NWidgetPart _nested_network_lobby_window_widgets[] = {
 			/* Company info. */
 			NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NLWW_DETAILS), SetMinimalSize(232, 153), SetFill(false, false), EndContainer(),
 		EndContainer(),
-		NWidget(NWID_SPACER), SetMinimalSize(0,9),
+		NWidget(NWID_SPACER), SetMinimalSize(0, 9),
 		/* Buttons. */
 		NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 31),
 			NWidget(NWID_VERTICAL),
@@ -1622,7 +1622,7 @@ static const NWidgetPart _nested_network_lobby_window_widgets[] = {
 			EndContainer(),
 			NWidget(NWID_VERTICAL), SetPadding(0, 0, 0, 9),
 				NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_CANCEL), SetMinimalSize(111, 12), SetDataTip(STR_QUERY_CANCEL, STR_NULL),
-				NWidget(NWID_SPACER), SetMinimalSize(0,15),
+				NWidget(NWID_SPACER), SetMinimalSize(0, 15),
 			EndContainer(),
 		EndContainer(),
 		NWidget(NWID_SPACER), SetMinimalSize(0, 8),
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index fa56cfe8eb..bd3712b583 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -118,7 +118,7 @@ struct GRFLocation {
 		return this->grfid < other.grfid || (this->grfid == other.grfid && this->nfoline < other.nfoline);
 	}
 
-	bool operator==(const GRFLocation &other) const
+	bool operator == (const GRFLocation &other) const
 	{
 		return this->grfid == other.grfid && this->nfoline == other.nfoline;
 	}
@@ -2272,7 +2272,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop,
 
 						if (itt[k].ti.x == 0 && itt[k].ti.y == 0x80) {
 							/*  Not the same terminator.  The one we are using is rather
-							 x= -80, y = x .  So, adjust it. */
+							 x = -80, y = x .  So, adjust it. */
 							itt[k].ti.x = -0x80;
 							itt[k].ti.y =  0;
 							itt[k].gfx  =  0;
@@ -4437,7 +4437,7 @@ static uint32 GetPatchVariable(uint8 param)
 			byte max_edge = max(log_X, log_Y);
 
 			if (log_X == log_Y) { // we have a squared map, since both edges are identical
-				SetBit(map_bits ,0);
+				SetBit(map_bits, 0);
 			} else {
 				if (max_edge == log_Y) SetBit(map_bits, 1); // edge Y been the biggest, mark it
 			}
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index aa2187c810..cc2d089cd7 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1157,7 +1157,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin
  */
 CommandCost CmdBuildSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 {
-	return CmdSignalTrackHelper(tile, flags, p1, p2,text);
+	return CmdSignalTrackHelper(tile, flags, p1, p2, text);
 }
 
 /** Remove signals
@@ -1858,7 +1858,7 @@ enum {
 
 static void DrawSignals(TileIndex tile, TrackBits rails)
 {
-#define MAYBE_DRAW_SIGNAL(x,y,z,t) if (IsSignalPresent(tile, x)) DrawSingleSignal(tile, t, GetSingleSignalState(tile, x), y, z)
+#define MAYBE_DRAW_SIGNAL(x, y, z, t) if (IsSignalPresent(tile, x)) DrawSingleSignal(tile, t, GetSingleSignalState(tile, x), y, z)
 
 	if (!(rails & TRACK_BIT_Y)) {
 		if (!(rails & TRACK_BIT_X)) {
@@ -2469,7 +2469,7 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int
 		((_fractcoords_enter[dir] & 0x0F) + // x
 			(length + 1) * _deltacoord_leaveoffset[dir]) +
 		(((_fractcoords_enter[dir] >> 4) +  // y
-			((length + 1) * _deltacoord_leaveoffset[dir+4])) << 4);
+			((length + 1) * _deltacoord_leaveoffset[dir + 4])) << 4);
 
 	fract_coord = (x & 0xF) + ((y & 0xF) << 4);
 
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 4098a94fa9..ae1dc9122a 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1836,7 +1836,7 @@ static const NWidgetPart _nested_cust_currency_widgets[] = {
 		NWidget(WWT_CAPTION, COLOUR_GREY, CUSTCURR_CAPTION), SetDataTip(STR_CURRENCY_WINDOW, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 	EndContainer(),
 	NWidget(WWT_PANEL, COLOUR_GREY, CUSTCURR_BACKGROUND),
-		NWidget(NWID_SPACER), SetMinimalSize(0,7),
+		NWidget(NWID_SPACER), SetMinimalSize(0, 7),
 		NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2),
 			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_RATE_DOWN), SetMinimalSize(10, 9), SetDataTip(STR_ARROW_LEFT_SMALL, STR_TOOLTIP_DECREASE_EXCHANGE_RATE),
 			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_RATE_UP), SetMinimalSize(10, 9), SetDataTip(STR_ARROW_RIGHT_SMALL, STR_TOOLTIP_INCREASE_EXCHANGE_RATE),
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 9cf12bc942..110a68acf6 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -847,7 +847,7 @@ static const NWidgetPart _nested_found_town_widgets[] = {
 			NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_LAYOUT_GRID3), SetMinimalSize(78, 12), SetFill(1, 0), SetDataTip(STR_SELECT_LAYOUT_3X3_GRID, STR_SELECT_TOWN_ROAD_LAYOUT),
 		EndContainer(),
 		NWidget(NWID_SPACER), SetMinimalSize(0, 1),
-		NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_LAYOUT_RANDOM), SetPadding(0, 2, 0, 2), SetMinimalSize(0,12), SetFill(1, 0),
+		NWidget(WWT_TEXTBTN, COLOUR_GREY, TSEW_LAYOUT_RANDOM), SetPadding(0, 2, 0, 2), SetMinimalSize(0, 12), SetFill(1, 0),
 										SetDataTip(STR_SELECT_LAYOUT_RANDOM, STR_SELECT_TOWN_ROAD_LAYOUT), SetFill(1, 0),
 		NWidget(NWID_SPACER), SetMinimalSize(0, 2),
 	EndContainer(),
diff --git a/src/widget.cpp b/src/widget.cpp
index f6e858cde8..1f5a8b9e51 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -590,7 +590,7 @@ void Window::DrawWidgets() const
 		switch (wi->type & WWT_MASK) {
 		case WWT_IMGBTN:
 		case WWT_IMGBTN_2:
-			DrawImageButtons(r, wi->type,wi->colour, clicked, wi->data);
+			DrawImageButtons(r, wi->type, wi->colour, clicked, wi->data);
 			break;
 
 		case WWT_PANEL:
@@ -2018,7 +2018,7 @@ void NWidgetLeaf::Draw(const Window *w)
 		case WWT_IMGBTN:
 		case WWT_PUSHIMGBTN:
 		case WWT_IMGBTN_2:
-			DrawImageButtons(r, this->type,this->colour, clicked, this->widget_data);
+			DrawImageButtons(r, this->type, this->colour, clicked, this->widget_data);
 			break;
 
 		case WWT_TEXTBTN: