changeset 7931:44ff7a6d801f draft

(svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style
author skidd13 <skidd13@openttd.org>
date Tue, 20 Nov 2007 13:35:54 +0000
parents 89b01facb974
children 712f252f0d4d
files src/ai/default/default.cpp src/aircraft_cmd.cpp src/airport.cpp src/autoreplace_cmd.cpp src/bridge_map.h src/cargotype.cpp src/console.cpp src/economy.cpp src/elrail.cpp src/engine.cpp src/graph_gui.cpp src/helpers.hpp src/macros.h src/main_gui.cpp src/misc_gui.cpp src/network/network_gui.cpp src/network/network_udp.cpp src/newgrf.cpp src/newgrf_config.cpp src/newgrf_engine.cpp src/newgrf_industries.cpp src/newgrf_station.cpp src/npf.h src/openttd.cpp src/player_gui.cpp src/players.cpp src/rail_cmd.cpp src/road_gui.cpp src/road_map.h src/roadveh_cmd.cpp src/settings.cpp src/settings_gui.cpp src/ship_cmd.cpp src/signs_gui.cpp src/station.cpp src/station_cmd.cpp src/station_gui.cpp src/timetable_cmd.cpp src/town_cmd.cpp src/town_map.h src/train.h src/train_cmd.cpp src/tunnelbridge_cmd.cpp src/vehicle.cpp src/viewport.cpp
diffstat 45 files changed, 161 insertions(+), 166 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -3847,7 +3847,7 @@
 			return;
 		}
 
-		SETBIT(p->bankrupt_asked, best_pl->index);
+		SetBit(p->bankrupt_asked, best_pl->index);
 
 		if (best_pl->index == _local_player) {
 			p->bankrupt_timeout = 4440;
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -418,7 +418,7 @@
 		u->random_bits = VehicleRandomBits();
 
 		v->vehicle_flags = 0;
-		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SETBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
+		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 
 		UpdateAircraftCache(v);
 
@@ -606,7 +606,7 @@
 
 			v->current_order.type = OT_GOTO_DEPOT;
 			v->current_order.flags = OF_NON_STOP;
-			if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
+			if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
 			v->current_order.refit_cargo = CT_INVALID;
 			v->current_order.dest = next_airport_index;
 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@@ -1960,7 +1960,7 @@
 		if (!HasBit(st->airport_flags, _airport_terminal_flag[i])) {
 			/* TERMINAL# HELIPAD# */
 			v->u.air.state = _airport_terminal_state[i]; // start moving to that terminal/helipad
-			SETBIT(st->airport_flags, _airport_terminal_flag[i]); // occupy terminal/helipad
+			SetBit(st->airport_flags, _airport_terminal_flag[i]); // occupy terminal/helipad
 			return true;
 		}
 	}
--- a/src/airport.cpp
+++ b/src/airport.cpp
@@ -488,14 +488,14 @@
 {
 	uint32 mask = 0;
 
-	if (_cur_year <  1960 || _patches.always_small_airport) SETBIT(mask, 0);  // small airport
-	if (_cur_year >= 1955) SETBIT(mask, 1); // city airport
-	if (_cur_year >= 1963) SETBIT(mask, 2); // heliport
-	if (_cur_year >= 1980) SETBIT(mask, 3); // metropolitan airport
-	if (_cur_year >= 1990) SETBIT(mask, 4); // international airport
-	if (_cur_year >= 1983) SETBIT(mask, 5); // commuter airport
-	if (_cur_year >= 1976) SETBIT(mask, 6); // helidepot
-	if (_cur_year >= 2002) SETBIT(mask, 7); // intercontinental airport
-	if (_cur_year >= 1980) SETBIT(mask, 8); // helistation
+	if (_cur_year <  1960 || _patches.always_small_airport) SetBit(mask, 0);  // small airport
+	if (_cur_year >= 1955) SetBit(mask, 1); // city airport
+	if (_cur_year >= 1963) SetBit(mask, 2); // heliport
+	if (_cur_year >= 1980) SetBit(mask, 3); // metropolitan airport
+	if (_cur_year >= 1990) SetBit(mask, 4); // international airport
+	if (_cur_year >= 1983) SetBit(mask, 5); // commuter airport
+	if (_cur_year >= 1976) SetBit(mask, 6); // helidepot
+	if (_cur_year >= 2002) SetBit(mask, 7); // intercontinental airport
+	if (_cur_year >= 1980) SetBit(mask, 8); // helistation
 	return mask;
 }
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -191,7 +191,7 @@
 
 		if (new_v->type == VEH_TRAIN && HasBit(old_v->u.rail.flags, VRF_REVERSE_DIRECTION) && !IsMultiheaded(new_v) && !(new_v->Next() != NULL && IsArticulatedPart(new_v->Next()))) {
 			// we are autorenewing to a single engine, so we will turn it as the old one was turned as well
-			SETBIT(new_v->u.rail.flags, VRF_REVERSE_DIRECTION);
+			SetBit(new_v->u.rail.flags, VRF_REVERSE_DIRECTION);
 		}
 
 		if (old_v->type == VEH_TRAIN && !IsFrontEngine(old_v)) {
--- a/src/bridge_map.h
+++ b/src/bridge_map.h
@@ -208,7 +208,7 @@
 static inline void SetBridgeMiddle(TileIndex t, Axis a)
 {
 	assert(MayHaveBridgeAbove(t));
-	SETBIT(_m[t].m6, 6 + a);
+	SetBit(_m[t].m6, 6 + a);
 }
 
 /**
--- a/src/cargotype.cpp
+++ b/src/cargotype.cpp
@@ -37,7 +37,7 @@
 		if (cl < lengthof(_default_cargo)) {
 			/* Copy the indexed cargo */
 			_cargo[i] = _default_cargo[cl];
-			SETBIT(_cargo_mask, i);
+			SetBit(_cargo_mask, i);
 			continue;
 		}
 
@@ -48,7 +48,7 @@
 				_cargo[i] = _default_cargo[j];
 
 				/* Populate the available cargo mask */
-				SETBIT(_cargo_mask, i);
+				SetBit(_cargo_mask, i);
 				break;
 			}
 		}
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -305,7 +305,7 @@
 			w->height = _screen.height / 3;
 			w->width = _screen.width;
 			_iconsole_mode = ICONSOLE_OPENED;
-			SETBIT(_no_scroll, SCROLL_CON); // override cursor arrows; the gamefield will not scroll
+			SetBit(_no_scroll, SCROLL_CON); // override cursor arrows; the gamefield will not scroll
 		} break;
 		case ICONSOLE_OPENED: case ICONSOLE_FULL:
 			DeleteWindowById(WC_CONSOLE, 0);
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -333,7 +333,7 @@
 					// use max of the two ratings.
 					t->ratings[new_player] = max(t->ratings[new_player], t->ratings[old_player]);
 				} else {
-					SETBIT(t->have_ratings, new_player);
+					SetBit(t->have_ratings, new_player);
 					t->ratings[new_player] = t->ratings[old_player];
 				}
 			}
@@ -1371,7 +1371,7 @@
 	{
 		Player *p = GetPlayer(_current_player);
 		p->cur_economy.delivered_cargo += num_pieces;
-		SETBIT(p->cargo_types, cargo_type);
+		SetBit(p->cargo_types, cargo_type);
 	}
 
 	/* Get station pointers. */
@@ -1436,7 +1436,7 @@
 
 		/* All cargo has already been paid for, no need to pay again */
 		if (!v->cargo.UnpaidCargo()) {
-			SETBIT(v->vehicle_flags, VF_CARGO_UNLOADING);
+			SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
 			continue;
 		}
 
@@ -1460,7 +1460,7 @@
 
 				result |= 1;
 
-				SETBIT(v->vehicle_flags, VF_CARGO_UNLOADING);
+				SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
 			} else if (front_v->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) {
 				if (!cp->paid_for && (front_v->current_order.flags & OF_TRANSFER) != 0) {
 					Money profit = GetTransportedGoodsIncome(
@@ -1477,7 +1477,7 @@
 				}
 				result |= 2;
 
-				SETBIT(v->vehicle_flags, VF_CARGO_UNLOADING);
+				SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
 			}
 		}
 		v->cargo.InvalidateCache();
@@ -1527,7 +1527,7 @@
 	if (v->type == VEH_TRAIN && !IsTileType(v->tile, MP_STATION)) {
 		/* The train reversed in the station. Take the "easy" way
 		 * out and let the train just leave as it always did. */
-		SETBIT(v->vehicle_flags, VF_LOADING_FINISHED);
+		SetBit(v->vehicle_flags, VF_LOADING_FINISHED);
 		return;
 	}
 
@@ -1570,7 +1570,7 @@
 				result |= 1;
 			} else if (u->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) {
 				remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded);
-				SETBIT(ge->acceptance_pickup, GoodsEntry::PICKUP);
+				SetBit(ge->acceptance_pickup, GoodsEntry::PICKUP);
 
 				result |= 2;
 			} else {
@@ -1621,7 +1621,7 @@
 			/* Skip loading this vehicle if another train/vehicle is already handling
 			 * the same cargo type at this station */
 			if (_patches.improved_load && cargo_left[v->cargo_type] <= 0) {
-				SETBIT(cargo_not_full, v->cargo_type);
+				SetBit(cargo_not_full, v->cargo_type);
 				continue;
 			}
 
@@ -1656,9 +1656,9 @@
 		}
 
 		if (v->cargo.Count() == v->cargo_cap) {
-			SETBIT(cargo_full, v->cargo_type);
+			SetBit(cargo_full, v->cargo_type);
 		} else {
-			SETBIT(cargo_not_full, v->cargo_type);
+			SetBit(cargo_not_full, v->cargo_type);
 		}
 	}
 
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -274,7 +274,7 @@
 				/* track found, if track is in the neighbour tile, adjust the number
 				 * of the PCP for preferred/allowed determination*/
 				DiagDirection PCPpos = (TrackSourceTile[i][k] == TS_HOME) ? i : ReverseDiagDir(i);
-				SETBIT(PCPstatus, i); // This PCP is in use
+				SetBit(PCPstatus, i); // This PCP is in use
 
 				PPPpreferred[i] &= PreferredPPPofTrackAtPCP[TracksAtPCP[i][k]][PCPpos];
 				PPPallowed[i] &= ~DisallowedPPPofTrackAtPCP[TracksAtPCP[i][k]][PCPpos];
@@ -322,7 +322,7 @@
 
 			if ((height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) &&
 					(i == PCPpositions[bridgetrack][0] || i == PCPpositions[bridgetrack][1])) {
-				SETBIT(OverridePCP, i);
+				SetBit(OverridePCP, i);
 			}
 		}
 
@@ -504,7 +504,7 @@
 				*  so add there also normal rail compatibility */
 				v->u.rail.compatible_railtypes |= (1 << RAILTYPE_RAIL);
 				v->u.rail.railtype = RAILTYPE_RAIL;
-				SETBIT(v->u.rail.flags, VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL);
+				SetBit(v->u.rail.flags, VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL);
 			}
 		}
 	}
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -183,14 +183,14 @@
 	Engine *e = GetEngine(eid);
 	Player *p = GetPlayer(player);
 
-	SETBIT(e->player_avail, player);
+	SetBit(e->player_avail, player);
 	if (e->type == VEH_TRAIN) {
 		const RailVehicleInfo *rvi = RailVehInfo(eid);
 
 		assert(rvi->railtype < RAILTYPE_END);
-		SETBIT(p->avail_railtypes, rvi->railtype);
+		SetBit(p->avail_railtypes, rvi->railtype);
 	} else if (e->type == VEH_ROAD) {
-		SETBIT(p->avail_roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
+		SetBit(p->avail_roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
 	}
 
 	e->preview_player = INVALID_PLAYER;
@@ -219,7 +219,7 @@
 
 		if (best_player == PLAYER_SPECTATOR) return PLAYER_SPECTATOR;
 
-		SETBIT(mask, best_player);
+		SetBit(mask, best_player);
 	} while (pp--, pp != 0);
 
 	return best_player;
@@ -332,13 +332,13 @@
 		RailType railtype = RailVehInfo(index)->railtype;
 		assert(railtype < RAILTYPE_END);
 		FOR_ALL_PLAYERS(p) {
-			if (p->is_active) SETBIT(p->avail_railtypes, railtype);
+			if (p->is_active) SetBit(p->avail_railtypes, railtype);
 		}
 	}
 	if ((index - NUM_TRAIN_ENGINES) < NUM_ROAD_ENGINES) {
 		/* maybe make another road type available */
 		FOR_ALL_PLAYERS(p) {
-			if (p->is_active) SETBIT(p->avail_roadtypes, HasBit(EngInfo(index)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
+			if (p->is_active) SetBit(p->avail_roadtypes, HasBit(EngInfo(index)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
 		}
 	}
 	AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL), 0, 0);
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -260,7 +260,7 @@
 			FOR_ALL_PLAYERS(p) {
 				if (p->is_active) continue;
 
-				SETBIT(_legend_excluded_players, p->index);
+				SetBit(_legend_excluded_players, p->index);
 				RaiseWindowWidget(w, p->index + 3);
 			}
 
@@ -334,7 +334,7 @@
 
 	/* Exclude the players which aren't valid */
 	FOR_ALL_PLAYERS(p) {
-		if (!p->is_active) SETBIT(excluded_players, p->index);
+		if (!p->is_active) SetBit(excluded_players, p->index);
 	}
 	gd->excluded_data = excluded_players;
 	gd->num_vert_lines = 24;
--- a/src/helpers.hpp
+++ b/src/helpers.hpp
@@ -149,11 +149,6 @@
 	}
 };
 
-template <typename T> void SetBitT(T &t, int bit_index)
-{
-	t = (T)(t | ((T)1 << bit_index));
-}
-
 template <typename T> void ToggleBitT(T &t, int bit_index)
 {
 	t = (T)(t ^ ((T)1 << bit_index));
--- a/src/macros.h
+++ b/src/macros.h
@@ -247,9 +247,9 @@
  * @param y The bit position to set
  * @return The new value of the old value with the bit set
  */
-template<typename T> static inline T SETBIT(T& x, const uint8 y)
+template<typename T> static inline T SetBit(T& x, const uint8 y)
 {
-	return x |= (T)1U << y;
+	return x = (T)(x | (T)(1U << y));
 }
 
 /**
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -971,14 +971,14 @@
 
 	w = PopupMainToolbMenu(w, 2, STR_02C3_GAME_OPTIONS, 14, 0);
 
-	if (HasBit(_display_opt, DO_SHOW_TOWN_NAMES))    SETBIT(x,  6);
-	if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SETBIT(x,  7);
-	if (HasBit(_display_opt, DO_SHOW_SIGNS))         SETBIT(x,  8);
-	if (HasBit(_display_opt, DO_WAYPOINTS))          SETBIT(x,  9);
-	if (HasBit(_display_opt, DO_FULL_ANIMATION))     SETBIT(x, 10);
-	if (HasBit(_display_opt, DO_FULL_DETAIL))        SETBIT(x, 11);
-	if (IsTransparencySet(TO_HOUSES) && IsTransparencySet(TO_TREES)) SETBIT(x, 12);
-	if (IsTransparencySet(TO_SIGNS))                     SETBIT(x, 13);
+	if (HasBit(_display_opt, DO_SHOW_TOWN_NAMES))    SetBit(x,  6);
+	if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SetBit(x,  7);
+	if (HasBit(_display_opt, DO_SHOW_SIGNS))         SetBit(x,  8);
+	if (HasBit(_display_opt, DO_WAYPOINTS))          SetBit(x,  9);
+	if (HasBit(_display_opt, DO_FULL_ANIMATION))     SetBit(x, 10);
+	if (HasBit(_display_opt, DO_FULL_DETAIL))        SetBit(x, 11);
+	if (IsTransparencySet(TO_HOUSES) && IsTransparencySet(TO_TREES)) SetBit(x, 12);
+	if (IsTransparencySet(TO_SIGNS))                     SetBit(x, 13);
 	WP(w,menu_d).checked_items = x;
 }
 
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1106,7 +1106,7 @@
 
 	switch (e->event) {
 		case WE_CREATE:
-			SETBIT(_no_scroll, SCROLL_EDIT);
+			SetBit(_no_scroll, SCROLL_EDIT);
 			break;
 
 		case WE_PAINT:
@@ -1680,7 +1680,7 @@
 	DeleteWindowById(WC_SAVELOAD, 0);
 
 	_saveload_mode = mode;
-	SETBIT(_no_scroll, SCROLL_SAVE);
+	SetBit(_no_scroll, SCROLL_SAVE);
 
 	switch (mode) {
 		case SLD_SAVE_GAME:     GenerateFileName(); break;
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1686,7 +1686,7 @@
 	switch (e->event) {
 	case WE_CREATE:
 		SendWindowMessage(WC_NEWS_WINDOW, 0, WE_CREATE, w->height, 0);
-		SETBIT(_no_scroll, SCROLL_CHAT); // do not scroll the game with the arrow-keys
+		SetBit(_no_scroll, SCROLL_CHAT); // do not scroll the game with the arrow-keys
 		break;
 
 	case WE_PAINT: {
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -398,7 +398,7 @@
 		config->name      = f->name;
 		config->info      = f->info;
 	}
-	SETBIT(config->flags, GCF_COPY);
+	SetBit(config->flags, GCF_COPY);
 }
 
 // Close UDP connection
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -950,7 +950,7 @@
 					if (dts->ground_sprite == 0) continue;
 					if (HasBit(dts->ground_pal, 15)) {
 						ClrBit(dts->ground_pal, 15);
-						SETBIT(dts->ground_sprite, SPRITE_MODIFIER_USE_OFFSET);
+						SetBit(dts->ground_sprite, SPRITE_MODIFIER_USE_OFFSET);
 					}
 
 					while (buf < *bufp + len) {
@@ -973,16 +973,16 @@
 						/* Remap flags as ours collide */
 						if (HasBit(dtss->pal, 15)) {
 							ClrBit(dtss->pal, 15);
-							SETBIT(dtss->image, SPRITE_MODIFIER_USE_OFFSET);
+							SetBit(dtss->image, SPRITE_MODIFIER_USE_OFFSET);
 						}
 
 						if (HasBit(dtss->image, 15)) {
 							ClrBit(dtss->image, 15);
-							SETBIT(dtss->image, PALETTE_MODIFIER_COLOR);
+							SetBit(dtss->image, PALETTE_MODIFIER_COLOR);
 						}
 						if (HasBit(dtss->image, 14)) {
 							ClrBit(dtss->image, 14);
-							SETBIT(dtss->image, PALETTE_MODIFIER_TRANSPARENT);
+							SetBit(dtss->image, PALETTE_MODIFIER_TRANSPARENT);
 						}
 					}
 				}
@@ -1176,7 +1176,7 @@
 						SpriteID pal   = grf_load_word(&buf);
 
 						if (HasBit(pal, 15)) {
-							SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
+							SetBit(image, PALETTE_MODIFIER_TRANSPARENT);
 						}
 
 						/* Clear old color modifer bit */
@@ -1572,7 +1572,7 @@
 				cs->bitnum = grf_load_byte(&buf);
 				if (cs->IsValid()) {
 					cs->grfid = _cur_grffile->grfid;
-					SETBIT(_cargo_mask, cid + i);
+					SetBit(_cargo_mask, cid + i);
 				} else {
 					ClrBit(_cargo_mask, cid + i);
 				}
@@ -1965,7 +1965,7 @@
 				}
 				/* Install final layout construction in the industry spec */
 				indsp->table = tile_table;
-				SETBIT(indsp->cleanup_flag, 1);
+				SetBit(indsp->cleanup_flag, 1);
 				free(itt);
 			} break;
 
@@ -2017,7 +2017,7 @@
 
 				for (uint8 j = 0; j < indsp->number_of_sounds; j++) sounds[j] = grf_load_byte(&buf);
 				indsp->random_sounds = sounds;
-				SETBIT(indsp->cleanup_flag, 0);
+				SetBit(indsp->cleanup_flag, 0);
 			} break;
 
 			case 0x16: // Conflicting industry types
@@ -2212,7 +2212,7 @@
 		if (prop == 0x0D) return;
 	}
 
-	SETBIT(_cur_grfconfig->flags, GCF_UNSAFE);
+	SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
 
 	/* Skip remainder of GRF */
 	_skip_sprites = -1;
@@ -2584,15 +2584,15 @@
 					/* Remap transparent/colour modifier bits */
 					if (HasBit(group->g.layout.dts->ground_sprite, 14)) {
 						ClrBit(group->g.layout.dts->ground_sprite, 14);
-						SETBIT(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_TRANSPARENT);
+						SetBit(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_TRANSPARENT);
 					}
 					if (HasBit(group->g.layout.dts->ground_sprite, 15)) {
 						ClrBit(group->g.layout.dts->ground_sprite, 15);
-						SETBIT(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_COLOR);
+						SetBit(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_COLOR);
 					}
 					if (HasBit(group->g.layout.dts->ground_pal, 14)) {
 						ClrBit(group->g.layout.dts->ground_pal, 14);
-						SETBIT(group->g.layout.dts->ground_sprite, SPRITE_MODIFIER_OPAQUE);
+						SetBit(group->g.layout.dts->ground_sprite, SPRITE_MODIFIER_OPAQUE);
 					}
 					if (HasBit(group->g.layout.dts->ground_pal, 15)) {
 						/* Bit 31 set means this is a custom sprite, so rewrite it to the
@@ -2614,15 +2614,15 @@
 
 						if (HasBit(seq->image, 14)) {
 							ClrBit(seq->image, 14);
-							SETBIT(seq->image, PALETTE_MODIFIER_TRANSPARENT);
+							SetBit(seq->image, PALETTE_MODIFIER_TRANSPARENT);
 						}
 						if (HasBit(seq->image, 15)) {
 							ClrBit(seq->image, 15);
-							SETBIT(seq->image, PALETTE_MODIFIER_COLOR);
+							SetBit(seq->image, PALETTE_MODIFIER_COLOR);
 						}
 						if (HasBit(seq->pal, 14)) {
 							ClrBit(seq->pal, 14);
-							SETBIT(seq->image, SPRITE_MODIFIER_OPAQUE);
+							SetBit(seq->image, SPRITE_MODIFIER_OPAQUE);
 						}
 						if (HasBit(seq->pal, 15)) {
 							/* Bit 31 set means this is a custom sprite, so rewrite it to the
@@ -3417,9 +3417,9 @@
 		case 0x84: { // GRF loading stage
 			uint32 res = 0;
 
-			if (_cur_stage > GLS_INIT) SETBIT(res, 0);
-			if (_cur_stage == GLS_RESERVE) SETBIT(res, 8);
-			if (_cur_stage == GLS_ACTIVATION) SETBIT(res, 9);
+			if (_cur_stage > GLS_INIT) SetBit(res, 0);
+			if (_cur_stage == GLS_RESERVE) SetBit(res, 8);
+			if (_cur_stage == GLS_ACTIVATION) SetBit(res, 9);
 			return res;
 		}
 
@@ -3734,7 +3734,7 @@
 	_cur_grfconfig->grfid = grfid;
 
 	/* GRF IDs starting with 0xFF are reserved for internal TTDPatch use */
-	if (GB(grfid, 24, 8) == 0xFF) SETBIT(_cur_grfconfig->flags, GCF_SYSTEM);
+	if (GB(grfid, 24, 8) == 0xFF) SetBit(_cur_grfconfig->flags, GCF_SYSTEM);
 
 	len -= 6;
 	const char *name = grf_load_string(&buf, len);
@@ -3958,7 +3958,7 @@
 	 * reserved, it would be marked unsafe anyway. GRM for (e.g. bridge)
 	 * sprites  is considered safe. */
 
-	SETBIT(_cur_grfconfig->flags, GCF_UNSAFE);
+	SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
 
 	/* Skip remainder of GRF */
 	_skip_sprites = -1;
@@ -4313,7 +4313,7 @@
 
 		/* GRF is unsafe it if tries to deactivate other GRFs */
 		if (grfid != _cur_grfconfig->grfid) {
-			SETBIT(_cur_grfconfig->flags, GCF_UNSAFE);
+			SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
 
 			/* Skip remainder of GRF */
 			_skip_sprites = -1;
@@ -4736,7 +4736,7 @@
 /* Used during safety scan on unsafe actions */
 static void GRFUnsafe(byte *buf, int len)
 {
-	SETBIT(_cur_grfconfig->flags, GCF_UNSAFE);
+	SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
 
 	/* Skip remainder of GRF */
 	_skip_sprites = -1;
@@ -5181,7 +5181,7 @@
 					CargoID c = GetCargoIDByLabel(file->cargo_list[i]);
 					if (c == CT_INVALID) continue;
 
-					SETBIT(xor_mask, c);
+					SetBit(xor_mask, c);
 				}
 			} else {
 				/* No cargo table, so use the cargo bitnum values */
@@ -5189,7 +5189,7 @@
 					const CargoSpec *cs = GetCargo(c);
 					if (!cs->IsValid()) continue;
 
-					if (HasBit(_engine_info[engine].refit_mask, cs->bitnum)) SETBIT(xor_mask, c);
+					if (HasBit(_engine_info[engine].refit_mask, cs->bitnum)) SetBit(xor_mask, c);
 				}
 			}
 		}
@@ -5198,8 +5198,8 @@
 			/* Build up the list of cargo types from the set cargo classes. */
 			for (CargoID i = 0; i < NUM_CARGO; i++) {
 				const CargoSpec *cs = GetCargo(i);
-				if (cargo_allowed[engine]    & cs->classes) SETBIT(mask,     i);
-				if (cargo_disallowed[engine] & cs->classes) SETBIT(not_mask, i);
+				if (cargo_allowed[engine]    & cs->classes) SetBit(mask,     i);
+				if (cargo_disallowed[engine] & cs->classes) SetBit(not_mask, i);
 			}
 		} else {
 			/* Don't apply default refit mask to wagons or engines with no capacity */
@@ -5216,7 +5216,7 @@
 					CargoID cargo = GetCargoIDByLabel(cl[i]);
 					if (cargo == CT_INVALID) continue;
 
-					SETBIT(xor_mask, cargo);
+					SetBit(xor_mask, cargo);
 				}
 			}
 		}
@@ -5605,7 +5605,7 @@
 			if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid);
 			LoadNewGRFFile(c, slot++, stage);
 			if (stage == GLS_RESERVE) {
-				SETBIT(c->flags, GCF_RESERVED);
+				SetBit(c->flags, GCF_RESERVED);
 			} else if (stage == GLS_ACTIVATION) {
 				ClrBit(c->flags, GCF_RESERVED);
 				ClearTemporaryNewGRFData();
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -137,7 +137,7 @@
 		}
 
 		ClrBit(c->flags, GCF_INIT_ONLY);
-		if (init_only) SETBIT(c->flags, GCF_INIT_ONLY);
+		if (init_only) SetBit(c->flags, GCF_INIT_ONLY);
 
 		*dst = c;
 		dst = &c->next;
@@ -234,7 +234,7 @@
 			if (f != NULL) {
 				md5sumToString(buf, lastof(buf), c->md5sum);
 				DEBUG(grf, 1, "NewGRF %08X (%s) not found; checksum %s. Compatibility mode on", BSWAP32(c->grfid), c->filename, buf);
-				SETBIT(c->flags, GCF_COMPATIBLE);
+				SetBit(c->flags, GCF_COMPATIBLE);
 
 				/* Non-found has precedence over compatibility load */
 				if (res != GLC_NOT_FOUND) res = GLC_COMPATIBLE;
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -660,7 +660,7 @@
 			 *   bit 8: (Maybe?) Toggled whenever the train reverses.
 			 */
 
-			if (HasBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE)) SETBIT(modflags, 10);
+			if (HasBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE)) SetBit(modflags, 10);
 
 			return variable == 0xFE ? modflags : GB(modflags, 8, 8);
 		}
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -158,7 +158,7 @@
 			/* Fall through */
 
 		default: //use the grfid specified in register 100h
-			SETBIT(param_setID, 7); // bit 7 means it is not an old type
+			SetBit(param_setID, 7); // bit 7 means it is not an old type
 			ind_index = MapNewGRFIndustryType(param_setID, GrfID);
 			break;
 	}
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -311,10 +311,10 @@
 		uint32 ts = GetTileTrackStatus(tile + TileOffsByDir(*dir), TRANSPORT_RAIL, 0);
 		if (ts != 0) {
 			/* If there is any track on the tile, set the bit in the second byte */
-			SETBIT(res, i + 8);
+			SetBit(res, i + 8);
 
 			/* If any track reaches our exit direction, set the bit in the lower byte */
-			if (ts & DiagdirReachesTracks(*diagdir)) SETBIT(res, i);
+			if (ts & DiagdirReachesTracks(*diagdir)) SetBit(res, i);
 		}
 	}
 
@@ -402,26 +402,26 @@
 	switch (variable) {
 		/* Calculated station variables */
 		case 0x40:
-			if (!HasBit(_svc.valid, 0)) { _svc.v40 = GetPlatformInfoHelper(tile, false, false, false); SETBIT(_svc.valid, 0); }
+			if (!HasBit(_svc.valid, 0)) { _svc.v40 = GetPlatformInfoHelper(tile, false, false, false); SetBit(_svc.valid, 0); }
 			return _svc.v40;
 
 		case 0x41:
-			if (!HasBit(_svc.valid, 1)) { _svc.v41 = GetPlatformInfoHelper(tile, true,  false, false); SETBIT(_svc.valid, 1); }
+			if (!HasBit(_svc.valid, 1)) { _svc.v41 = GetPlatformInfoHelper(tile, true,  false, false); SetBit(_svc.valid, 1); }
 			return _svc.v41;
 
 		case 0x42: return GetTerrainType(tile) | (GetRailType(tile) << 8);
 		case 0x43: return st->owner; // Station owner
 		case 0x44: return 2;         // PBS status
 		case 0x45:
-			if (!HasBit(_svc.valid, 2)) { _svc.v45 = GetRailContinuationInfo(tile); SETBIT(_svc.valid, 2); }
+			if (!HasBit(_svc.valid, 2)) { _svc.v45 = GetRailContinuationInfo(tile); SetBit(_svc.valid, 2); }
 			return _svc.v45;
 
 		case 0x46:
-			if (!HasBit(_svc.valid, 3)) { _svc.v46 = GetPlatformInfoHelper(tile, false, false, true); SETBIT(_svc.valid, 3); }
+			if (!HasBit(_svc.valid, 3)) { _svc.v46 = GetPlatformInfoHelper(tile, false, false, true); SetBit(_svc.valid, 3); }
 			return _svc.v46;
 
 		case 0x47:
-			if (!HasBit(_svc.valid, 4)) { _svc.v47 = GetPlatformInfoHelper(tile, true,  false, true); SETBIT(_svc.valid, 4); }
+			if (!HasBit(_svc.valid, 4)) { _svc.v47 = GetPlatformInfoHelper(tile, true,  false, true); SetBit(_svc.valid, 4); }
 			return _svc.v47;
 
 		case 0x48: { // Accepted cargo types
@@ -429,12 +429,12 @@
 			uint32 value = 0;
 
 			for (cargo_type = 0; cargo_type < NUM_CARGO; cargo_type++) {
-				if (HasBit(st->goods[cargo_type].acceptance_pickup, GoodsEntry::PICKUP)) SETBIT(value, cargo_type);
+				if (HasBit(st->goods[cargo_type].acceptance_pickup, GoodsEntry::PICKUP)) SetBit(value, cargo_type);
 			}
 			return value;
 		}
 		case 0x49:
-			if (!HasBit(_svc.valid, 5)) { _svc.v49 = GetPlatformInfoHelper(tile, false, true, false); SETBIT(_svc.valid, 5); }
+			if (!HasBit(_svc.valid, 5)) { _svc.v49 = GetPlatformInfoHelper(tile, false, true, false); SetBit(_svc.valid, 5); }
 			return _svc.v49;
 
 		/* Variables which use the parameter */
--- a/src/npf.h
+++ b/src/npf.h
@@ -121,7 +121,7 @@
 static inline void NPFSetFlag(AyStarNode* node, NPFNodeFlag flag, bool value)
 {
 	if (value)
-		SETBIT(node->user_data[NPF_NODE_FLAGS], flag);
+		SetBit(node->user_data[NPF_NODE_FLAGS], flag);
 	else
 		ClrBit(node->user_data[NPF_NODE_FLAGS], flag);
 }
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1375,7 +1375,7 @@
 					break;
 
 				case MP_STATION: {
-					if (HasBit(_m[t].m6, 3)) SETBIT(_m[t].m6, 2);
+					if (HasBit(_m[t].m6, 3)) SetBit(_m[t].m6, 2);
 					StationGfx gfx = GetStationGfx(t);
 					StationType st;
 					if (       IS_INT_INSIDE(gfx,   0,   8)) { // Railway station
@@ -2146,7 +2146,7 @@
 		Vehicle *v;
 		FOR_ALL_VEHICLES(v) {
 			if (v->type == VEH_ROAD && (v->u.road.state == 250 || v->u.road.state == 251)) {
-				SETBIT(v->u.road.state, RVS_IS_STOPPING);
+				SetBit(v->u.road.state, RVS_IS_STOPPING);
 			}
 		}
 	}
@@ -2188,7 +2188,7 @@
 		FOR_ALL_STATIONS(st) {
 			for (CargoID c = 0; c < NUM_CARGO; c++) {
 				st->goods[c].last_speed = 0;
-				if (st->goods[c].cargo.Count() != 0) SETBIT(st->goods[c].acceptance_pickup, GoodsEntry::PICKUP);
+				if (st->goods[c].cargo.Count() != 0) SetBit(st->goods[c].acceptance_pickup, GoodsEntry::PICKUP);
 			}
 		}
 	}
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -275,7 +275,7 @@
 	if (HasBit(WP(w, livery_d).sel, LS_DEFAULT) && widget == 10) {
 		const Player *p;
 		FOR_ALL_PLAYERS(p) {
-			if (p->is_active && p->index != _local_player) SETBIT(used_colours, p->player_color);
+			if (p->is_active && p->index != _local_player) SetBit(used_colours, p->player_color);
 		}
 	}
 
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -90,8 +90,8 @@
 	PlayerFace pf = 0;
 	GenderEthnicity ge = GE_WM;
 
-	if (HasBit(face, 31)) SetBitT(ge, GENDER_FEMALE);
-	if (HasBit(face, 27) && (HasBit(face, 26) == HasBit(face, 19))) SetBitT(ge, ETHNICITY_BLACK);
+	if (HasBit(face, 31)) SetBit(ge, GENDER_FEMALE);
+	if (HasBit(face, 27) && (HasBit(face, 26) == HasBit(face, 19))) SetBit(ge, ETHNICITY_BLACK);
 
 	SetPlayerFaceBits(pf, PFV_GEN_ETHN,    ge, ge);
 	SetPlayerFaceBits(pf, PFV_HAS_GLASSES, ge, GB(face, 28, 3) <= 1);
@@ -603,7 +603,7 @@
 
 			if (rvi->railveh_type != RAILVEH_WAGON) {
 				assert(rvi->railtype < RAILTYPE_END);
-				SETBIT(rt, rvi->railtype);
+				SetBit(rt, rvi->railtype);
 			}
 		}
 	}
@@ -622,7 +622,7 @@
 
 		if (e->type == VEH_ROAD && HasBit(ei->climates, _opt.landscape) &&
 				(HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) {
-			SETBIT(rt, HasBit(ei->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
+			SetBit(rt, HasBit(ei->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
 		}
 	}
 
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -602,7 +602,7 @@
 		(trdy >= 0 && dy < 0)
 	) {
 		if (!HasBit(*trackdir, 3)) { // first direction is invalid, try the other
-			SetBitT(*trackdir, 3); // reverse the direction
+			SetBit(*trackdir, 3); // reverse the direction
 			trdx = -trdx;
 			trdy = -trdy;
 		} else { // other direction is invalid too, invalid drag
@@ -701,7 +701,7 @@
  */
 CommandCost CmdRemoveRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 {
-	return CmdRailTrackHelper(tile, flags, p1, SETBIT(p2, 7));
+	return CmdRailTrackHelper(tile, flags, p1, SetBit(p2, 7));
 }
 
 /** Build a train depot
@@ -985,8 +985,8 @@
 	}
 
 	byte signal_dir = 0;
-	if (signals & SignalAlongTrackdir(trackdir))   SETBIT(signal_dir, 0);
-	if (signals & SignalAgainstTrackdir(trackdir)) SETBIT(signal_dir, 1);
+	if (signals & SignalAlongTrackdir(trackdir))   SetBit(signal_dir, 0);
+	if (signals & SignalAgainstTrackdir(trackdir)) SetBit(signal_dir, 1);
 
 	/* signal_ctr         - amount of tiles already processed
 	 * signals_density    - patch setting to put signal on every Nth tile (double space on |, -- tracks)
@@ -1121,7 +1121,7 @@
  */
 CommandCost CmdRemoveSignalTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 {
-	return CmdSignalTrackHelper(tile, flags, p1, SETBIT(p2, 5)); // bit 5 is remove bit
+	return CmdSignalTrackHelper(tile, flags, p1, SetBit(p2, 5)); // bit 5 is remove bit
 }
 
 typedef CommandCost DoConvertRailProc(TileIndex tile, RailType totype, bool exec);
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -204,7 +204,7 @@
 	uint32 p1 = _road_station_picker_orientation;
 
 	if (p1 >= DIAGDIR_END) {
-		SETBIT(p2, 1); // It's a drive-through stop
+		SetBit(p2, 1); // It's a drive-through stop
 		p1 -= DIAGDIR_END; // Adjust picker result to actual direction
 	}
 	DoCommandP(tile, p1, p2, CcRoadDepot, cmd);
--- a/src/road_map.h
+++ b/src/road_map.h
@@ -200,7 +200,7 @@
 static inline void BarCrossing(TileIndex t)
 {
 	assert(GetRoadTileType(t) == ROAD_TILE_CROSSING);
-	SETBIT(_m[t].m4, 5);
+	SetBit(_m[t].m4, 5);
 }
 
 static inline bool IsCrossingBarred(TileIndex t)
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -257,7 +257,7 @@
 		v->u.road.cached_veh_length = GetRoadVehLength(v);
 
 		v->vehicle_flags = 0;
-		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SETBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
+		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 
 		v->cargo_cap = GetVehicleProperty(v, 0x0F, rvi->capacity);
 
@@ -511,7 +511,7 @@
 		ClearSlot(v);
 		v->current_order.type = OT_GOTO_DEPOT;
 		v->current_order.flags = OF_NON_STOP;
-		if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
+		if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
 		v->current_order.refit_cargo = CT_INVALID;
 		v->current_order.dest = dep->index;
 		v->dest_tile = dep->xy;
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -435,7 +435,7 @@
 		r = lookup_oneofmany(many, str, s - str);
 		if (r == -1) return (uint32)-1;
 
-		SETBIT(res, r); // value found, set it
+		SetBit(res, r); // value found, set it
 		if (*s == 0) break;
 		str = s + 1;
 	}
@@ -1684,7 +1684,7 @@
 		}
 
 		/* Mark file as static to avoid saving in savegame. */
-		if (is_static) SETBIT(c->flags, GCF_STATIC);
+		if (is_static) SetBit(c->flags, GCF_STATIC);
 
 		/* Add item to list */
 		*curr = c;
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -537,12 +537,12 @@
 			if (x >= 10) {
 				// Increase button clicked
 				val = min(val + info->step, info->max);
-				SETBIT(_difficulty_click_b, btn);
+				SetBit(_difficulty_click_b, btn);
 			} else {
 				// Decrease button clicked
 				val -= info->step;
 				val = max(val,  info->min);
-				SETBIT(_difficulty_click_a, btn);
+				SetBit(_difficulty_click_a, btn);
 			}
 
 			// save value in temporary variable
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -875,7 +875,7 @@
 		v->random_bits = VehicleRandomBits();
 
 		v->vehicle_flags = 0;
-		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SETBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
+		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 
 		v->cargo_cap = GetVehicleProperty(v, 0x0D, svi->capacity);
 
@@ -1039,7 +1039,7 @@
 		v->dest_tile = dep->xy;
 		v->current_order.type = OT_GOTO_DEPOT;
 		v->current_order.flags = OF_NON_STOP;
-		if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
+		if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
 		v->current_order.refit_cargo = CT_INVALID;
 		v->current_order.dest = dep->index;
 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -201,7 +201,7 @@
 
 	switch (e->event) {
 		case WE_CREATE:
-			SETBIT(_no_scroll, SCROLL_EDIT);
+			SetBit(_no_scroll, SCROLL_EDIT);
 			break;
 
 		case WE_PAINT:
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -476,7 +476,7 @@
 void RoadStop::FreeBay(uint nr)
 {
 	assert(nr < MAX_BAY_COUNT);
-	SETBIT(status, nr);
+	SetBit(status, nr);
 }
 
 
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -990,7 +990,7 @@
 		if (!GenerateStationName(st, tile_org, STATIONNAMING_RAIL)) return CMD_ERROR;
 
 		if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) {
-			SETBIT(st->town->have_ratings, _current_player);
+			SetBit(st->town->have_ratings, _current_player);
 		}
 	}
 
@@ -1417,7 +1417,7 @@
 		if (!GenerateStationName(st, tile, STATIONNAMING_ROAD)) return CMD_ERROR;
 
 		if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) {
-			SETBIT(t->have_ratings, _current_player);
+			SetBit(t->have_ratings, _current_player);
 		}
 
 		st->sign.width_1 = 0;
@@ -1715,7 +1715,7 @@
 		st->town = t;
 
 		if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) {
-			SETBIT(t->have_ratings, _current_player);
+			SetBit(t->have_ratings, _current_player);
 		}
 
 		st->sign.width_1 = 0;
@@ -2002,7 +2002,7 @@
 		Town *t = st->town = ClosestTownFromTile(tile, (uint)-1);
 
 		if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) {
-			SETBIT(t->have_ratings, _current_player);
+			SetBit(t->have_ratings, _current_player);
 		}
 
 		st->sign.width_1 = 0;
@@ -2386,14 +2386,14 @@
 					/* Check if the vehicle is stopping at this road stop */
 					if (GetRoadStopType(tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK) &&
 							v->current_order.dest == GetStationIndex(tile)) {
-						SETBIT(v->u.road.state, RVS_IS_STOPPING);
+						SetBit(v->u.road.state, RVS_IS_STOPPING);
 						rs->AllocateDriveThroughBay(side);
 					}
 
 					/* Indicate if vehicle is using second bay. */
-					if (side == 1) SETBIT(v->u.road.state, RVS_USING_SECOND_BAY);
+					if (side == 1) SetBit(v->u.road.state, RVS_USING_SECOND_BAY);
 					/* Indicate a drive-through stop */
-					SETBIT(v->u.road.state, RVS_IN_DT_ROAD_STOP);
+					SetBit(v->u.road.state, RVS_IN_DT_ROAD_STOP);
 					return VETSB_CONTINUE;
 				}
 
@@ -2401,7 +2401,7 @@
 				/* Check if station is busy or if there are no free bays or whether it is a articulated vehicle. */
 				if (rs->IsEntranceBusy() || !rs->HasFreeBay() || RoadVehHasArticPart(v)) return VETSB_CANNOT_ENTER;
 
-				SETBIT(v->u.road.state, RVS_IN_ROAD_STOP);
+				SetBit(v->u.road.state, RVS_IN_ROAD_STOP);
 
 				/* Allocate a bay and update the road state */
 				uint bay_nr = rs->AllocateBay();
@@ -2587,7 +2587,7 @@
 static void UpdateStationWaiting(Station *st, CargoID type, uint amount)
 {
 	st->goods[type].cargo.Append(new CargoPacket(st->index, amount));
-	SETBIT(st->goods[type].acceptance_pickup, GoodsEntry::PICKUP);
+	SetBit(st->goods[type].acceptance_pickup, GoodsEntry::PICKUP);
 
 	InvalidateWindow(WC_STATION_VIEW, st->index);
 	st->MarkTilesDirty(true);
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -406,7 +406,7 @@
 						for (uint i = 0; facilities != 0; i++, facilities >>= 1) {
 							if (HasBit(facilities, 0)) RaiseWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN);
 						}
-						SETBIT(facilities, e->we.click.widget - STATIONLIST_WIDGET_TRAIN);
+						SetBit(facilities, e->we.click.widget - STATIONLIST_WIDGET_TRAIN);
 						LowerWindowWidget(w, e->we.click.widget);
 					}
 					SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
@@ -498,7 +498,7 @@
 							_cargo_filter = 0;
 							include_empty = false;
 
-							SETBIT(_cargo_filter, c);
+							SetBit(_cargo_filter, c);
 							LowerWindowWidget(w, e->we.click.widget);
 						}
 						sl->flags |= SL_REBUILD;
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -121,7 +121,7 @@
 		if (p2 == 1) {
 			/* Start autofilling the timetable, which clears all the current
 			 * timings and clears the "timetable has started" bit. */
-			SETBIT(v->vehicle_flags, VF_AUTOFILL_TIMETABLE);
+			SetBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE);
 			ClrBit(v->vehicle_flags, VF_TIMETABLE_STARTED);
 
 			for (Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
@@ -155,7 +155,7 @@
 	/* Make sure the timetable only starts when the vehicle reaches the first
  	 * order, not when travelling from the depot to the first station. */
  	if (v->cur_order_index == 0 && !HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) {
- 		SETBIT(v->vehicle_flags, VF_TIMETABLE_STARTED);
+ 		SetBit(v->vehicle_flags, VF_TIMETABLE_STARTED);
  		return;
  	}
 
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1725,9 +1725,9 @@
 
 			/* Special houses that there can be only one of. */
 			if (hs->building_flags & BUILDING_IS_CHURCH) {
-				SETBIT(oneof, TOWN_HAS_CHURCH);
+				SetBit(oneof, TOWN_HAS_CHURCH);
 			} else if (hs->building_flags & BUILDING_IS_STADIUM) {
-				SETBIT(oneof, TOWN_HAS_STADIUM);
+				SetBit(oneof, TOWN_HAS_STADIUM);
 			} else {
 				oneof = 0;
 			}
@@ -2012,7 +2012,7 @@
 	TileIndex tile = t->xy;
 
 	if (CircularTileSearch(tile, 9, SearchTileForStatue, t->index))
-		SETBIT(t->statues, _current_player); // Once found and built, "inform" the Town
+		SetBit(t->statues, _current_player); // Once found and built, "inform" the Town
 }
 
 static void TownActionFundBuildings(Town* t)
@@ -2020,7 +2020,7 @@
 	/* Build next tick */
 	t->grow_counter = 1;
 	/* If we were not already growing */
-	SETBIT(t->flags12, TOWN_IS_FUNDED);
+	SetBit(t->flags12, TOWN_IS_FUNDED);
 	/* And grow for 3 months */
 	t->fund_buildings_months = 3;
 }
@@ -2177,7 +2177,7 @@
 	if (m <= t->grow_counter)
 		t->grow_counter = m;
 
-	SETBIT(t->flags12, TOWN_IS_FUNDED);
+	SetBit(t->flags12, TOWN_IS_FUNDED);
 }
 
 static void UpdateTownAmounts(Town *t)
@@ -2267,7 +2267,7 @@
 		return;
 	}
 
-	SETBIT(t->have_ratings, _current_player);
+	SetBit(t->have_ratings, _current_player);
 
 	rating = t->ratings[_current_player];
 
--- a/src/town_map.h
+++ b/src/town_map.h
@@ -88,7 +88,7 @@
  */
 static inline void SetLiftDestination(TileIndex t, byte dest)
 {
-	SETBIT(_me[t].m7, 0);
+	SetBit(_me[t].m7, 0);
 	SB(_me[t].m7, 1, 3, dest);
 }
 
--- a/src/train.h
+++ b/src/train.h
@@ -41,7 +41,7 @@
 static inline void SetFrontEngine(Vehicle *v)
 {
 	assert(v->type == VEH_TRAIN);
-	SETBIT(v->subtype, Train_Front);
+	SetBit(v->subtype, Train_Front);
 }
 
 /** Remove the front engine state
@@ -69,7 +69,7 @@
 static inline void SetArticulatedPart(Vehicle *v)
 {
 	assert(v->type == VEH_TRAIN);
-	SETBIT(v->subtype, Train_Articulated_Part);
+	SetBit(v->subtype, Train_Articulated_Part);
 }
 
 /** Clear a vehicle from being an articulated part
@@ -97,7 +97,7 @@
 static inline void SetTrainWagon(Vehicle *v)
 {
 	assert(v->type == VEH_TRAIN);
-	SETBIT(v->subtype, Train_Wagon);
+	SetBit(v->subtype, Train_Wagon);
 }
 
 /** Clear wagon property
@@ -125,7 +125,7 @@
 static inline void SetTrainEngine(Vehicle *v)
 {
 	assert(v->type == VEH_TRAIN);
-	SETBIT(v->subtype, Train_Engine);
+	SetBit(v->subtype, Train_Engine);
 }
 
 /** Clear engine status
@@ -153,7 +153,7 @@
 static inline void SetFreeWagon(Vehicle *v)
 {
 	assert(v->type == VEH_TRAIN);
-	SETBIT(v->subtype, Train_Free_Wagon);
+	SetBit(v->subtype, Train_Free_Wagon);
 }
 
 /** Clear a vehicle from being a free wagon
@@ -181,7 +181,7 @@
 static inline void SetMultiheaded(Vehicle *v)
 {
 	assert(v->type == VEH_TRAIN);
-	SETBIT(v->subtype, Train_Multiheaded);
+	SetBit(v->subtype, Train_Multiheaded);
 }
 
 /** Clear multiheaded engine property
--- 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->u.rail.cached_vis_effect, 7)) {
 				/* wagon is powered */
-				SETBIT(u->u.rail.flags, VRF_POWEREDWAGON); // cache 'powered' status
+				SetBit(u->u.rail.flags, VRF_POWEREDWAGON); // cache 'powered' status
 			} else {
 				ClrBit(u->u.rail.flags, VRF_POWEREDWAGON);
 			}
@@ -747,7 +747,7 @@
 			v->random_bits = VehicleRandomBits();
 
 			v->vehicle_flags = 0;
-			if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SETBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
+			if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 
 			v->group_id = DEFAULT_GROUP;
 
@@ -1465,14 +1465,14 @@
 
 	/* Reverse the rail-flags (if needed) */
 	if (HasBit(flag1, VRF_GOINGUP)) {
-		SETBIT(*swap_flag2, VRF_GOINGDOWN);
+		SetBit(*swap_flag2, VRF_GOINGDOWN);
 	} else if (HasBit(flag1, VRF_GOINGDOWN)) {
-		SETBIT(*swap_flag2, VRF_GOINGUP);
+		SetBit(*swap_flag2, VRF_GOINGUP);
 	}
 	if (HasBit(flag2, VRF_GOINGUP)) {
-		SETBIT(*swap_flag1, VRF_GOINGDOWN);
+		SetBit(*swap_flag1, VRF_GOINGDOWN);
 	} else if (HasBit(flag2, VRF_GOINGDOWN)) {
-		SETBIT(*swap_flag1, VRF_GOINGUP);
+		SetBit(*swap_flag1, VRF_GOINGUP);
 	}
 }
 
@@ -1940,7 +1940,7 @@
 		v->dest_tile = tfdd.tile;
 		v->current_order.type = OT_GOTO_DEPOT;
 		v->current_order.flags = OF_NON_STOP;
-		if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
+		if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
 		v->current_order.dest = GetDepotByTile(tfdd.tile)->index;
 		v->current_order.refit_cargo = CT_INVALID;
 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@@ -2262,7 +2262,7 @@
 		/* PF didn't find the route */
 		if (!HasBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) {
 			/* it is first time the problem occurred, set the "path not found" flag */
-			SETBIT(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION);
+			SetBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION);
 			/* and notify user about the event */
 			if (_patches.lost_train_warn && v->owner == _local_player) {
 				SetDParam(0, v->unitnumber);
@@ -2570,7 +2570,7 @@
 			/* For some reason tunnel tiles are always given as sloped :(
 			 * But they are not sloped... */
 			if (middle_z != v->z_pos && !IsTunnelTile(TileVirtXY(v->x_pos, v->y_pos))) {
-				SETBIT(v->u.rail.flags, (middle_z > old_z) ? VRF_GOINGUP : VRF_GOINGDOWN);
+				SetBit(v->u.rail.flags, (middle_z > old_z) ? VRF_GOINGUP : VRF_GOINGDOWN);
 			}
 		}
 	}
@@ -3526,7 +3526,7 @@
 	Vehicle *v;
 	FOR_ALL_VEHICLES(v) {
 		if (v->type == VEH_TRAIN) {
-			SETBIT(v->subtype, 7); // indicates that it's the old format and needs to be converted in the next loop
+			SetBit(v->subtype, 7); // indicates that it's the old format and needs to be converted in the next loop
 		}
 	}
 
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -1198,7 +1198,7 @@
 			SpriteID image = psid->sprite;
 			SpriteID pal   = psid->pal;
 			if (IsTransparencySet(TO_BRIDGES)) {
-				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
+				SetBit(image, PALETTE_MODIFIER_TRANSPARENT);
 				pal = PALETTE_TO_TRANSPARENT;
 			}
 
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1755,7 +1755,7 @@
 			w = GetVehicle(_new_vehicle_id);
 
 			if (v->type == VEH_TRAIN && HasBit(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
-				SETBIT(w->u.rail.flags, VRF_REVERSE_DIRECTION);
+				SetBit(w->u.rail.flags, VRF_REVERSE_DIRECTION);
 			}
 
 			if (v->type == VEH_TRAIN && !IsFrontEngine(v)) {
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -179,7 +179,7 @@
 		assert(vp != endof(_viewports));
 		if (vp->width == 0) break;
 	}
-	SETBIT(_active_viewports, bit);
+	SetBit(_active_viewports, bit);
 
 	vp->left = x + w->left;
 	vp->top = y + w->top;
@@ -627,7 +627,7 @@
 
 	/* make the sprites transparent with the right palette */
 	if (transparent) {
-		SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
+		SetBit(image, PALETTE_MODIFIER_TRANSPARENT);
 		pal = PALETTE_TO_TRANSPARENT;
 	}
 
@@ -739,7 +739,7 @@
 
 	/* make the sprites transparent with the right palette */
 	if (transparent) {
-		SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
+		SetBit(image, PALETTE_MODIFIER_TRANSPARENT);
 		pal = PALETTE_TO_TRANSPARENT;
 	}