(svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style

This commit is contained in:
skidd13 2007-11-20 13:35:54 +00:00
parent b8885630aa
commit eeaa348f8b
45 changed files with 161 additions and 166 deletions

View File

@ -3847,7 +3847,7 @@ static void AiHandleTakeover(Player *p)
return; return;
} }
SETBIT(p->bankrupt_asked, best_pl->index); SetBit(p->bankrupt_asked, best_pl->index);
if (best_pl->index == _local_player) { if (best_pl->index == _local_player) {
p->bankrupt_timeout = 4440; p->bankrupt_timeout = 4440;

View File

@ -418,7 +418,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
u->random_bits = VehicleRandomBits(); u->random_bits = VehicleRandomBits();
v->vehicle_flags = 0; 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); UpdateAircraftCache(v);
@ -606,7 +606,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; 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.refit_cargo = CT_INVALID;
v->current_order.dest = next_airport_index; v->current_order.dest = next_airport_index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@ -1960,7 +1960,7 @@ static bool FreeTerminal(Vehicle *v, byte i, byte last_terminal)
if (!HasBit(st->airport_flags, _airport_terminal_flag[i])) { if (!HasBit(st->airport_flags, _airport_terminal_flag[i])) {
/* TERMINAL# HELIPAD# */ /* TERMINAL# HELIPAD# */
v->u.air.state = _airport_terminal_state[i]; // start moving to that 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; return true;
} }
} }

View File

@ -488,14 +488,14 @@ uint32 GetValidAirports()
{ {
uint32 mask = 0; uint32 mask = 0;
if (_cur_year < 1960 || _patches.always_small_airport) SETBIT(mask, 0); // small airport 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 >= 1955) SetBit(mask, 1); // city airport
if (_cur_year >= 1963) SETBIT(mask, 2); // heliport if (_cur_year >= 1963) SetBit(mask, 2); // heliport
if (_cur_year >= 1980) SETBIT(mask, 3); // metropolitan airport if (_cur_year >= 1980) SetBit(mask, 3); // metropolitan airport
if (_cur_year >= 1990) SETBIT(mask, 4); // international airport if (_cur_year >= 1990) SetBit(mask, 4); // international airport
if (_cur_year >= 1983) SETBIT(mask, 5); // commuter airport if (_cur_year >= 1983) SetBit(mask, 5); // commuter airport
if (_cur_year >= 1976) SETBIT(mask, 6); // helidepot if (_cur_year >= 1976) SetBit(mask, 6); // helidepot
if (_cur_year >= 2002) SETBIT(mask, 7); // intercontinental airport if (_cur_year >= 2002) SetBit(mask, 7); // intercontinental airport
if (_cur_year >= 1980) SETBIT(mask, 8); // helistation if (_cur_year >= 1980) SetBit(mask, 8); // helistation
return mask; return mask;
} }

View File

@ -191,7 +191,7 @@ static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost)
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()))) { 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 // 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)) { if (old_v->type == VEH_TRAIN && !IsFrontEngine(old_v)) {

View File

@ -208,7 +208,7 @@ static inline void ClearBridgeMiddle(TileIndex t)
static inline void SetBridgeMiddle(TileIndex t, Axis a) static inline void SetBridgeMiddle(TileIndex t, Axis a)
{ {
assert(MayHaveBridgeAbove(t)); assert(MayHaveBridgeAbove(t));
SETBIT(_m[t].m6, 6 + a); SetBit(_m[t].m6, 6 + a);
} }
/** /**

View File

@ -37,7 +37,7 @@ void SetupCargoForClimate(LandscapeID l)
if (cl < lengthof(_default_cargo)) { if (cl < lengthof(_default_cargo)) {
/* Copy the indexed cargo */ /* Copy the indexed cargo */
_cargo[i] = _default_cargo[cl]; _cargo[i] = _default_cargo[cl];
SETBIT(_cargo_mask, i); SetBit(_cargo_mask, i);
continue; continue;
} }
@ -48,7 +48,7 @@ void SetupCargoForClimate(LandscapeID l)
_cargo[i] = _default_cargo[j]; _cargo[i] = _default_cargo[j];
/* Populate the available cargo mask */ /* Populate the available cargo mask */
SETBIT(_cargo_mask, i); SetBit(_cargo_mask, i);
break; break;
} }
} }

View File

@ -305,7 +305,7 @@ void IConsoleSwitch()
w->height = _screen.height / 3; w->height = _screen.height / 3;
w->width = _screen.width; w->width = _screen.width;
_iconsole_mode = ICONSOLE_OPENED; _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; } break;
case ICONSOLE_OPENED: case ICONSOLE_FULL: case ICONSOLE_OPENED: case ICONSOLE_FULL:
DeleteWindowById(WC_CONSOLE, 0); DeleteWindowById(WC_CONSOLE, 0);

View File

@ -333,7 +333,7 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
// use max of the two ratings. // use max of the two ratings.
t->ratings[new_player] = max(t->ratings[new_player], t->ratings[old_player]); t->ratings[new_player] = max(t->ratings[new_player], t->ratings[old_player]);
} else { } else {
SETBIT(t->have_ratings, new_player); SetBit(t->have_ratings, new_player);
t->ratings[new_player] = t->ratings[old_player]; t->ratings[new_player] = t->ratings[old_player];
} }
} }
@ -1371,7 +1371,7 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID source,
{ {
Player *p = GetPlayer(_current_player); Player *p = GetPlayer(_current_player);
p->cur_economy.delivered_cargo += num_pieces; p->cur_economy.delivered_cargo += num_pieces;
SETBIT(p->cargo_types, cargo_type); SetBit(p->cargo_types, cargo_type);
} }
/* Get station pointers. */ /* Get station pointers. */
@ -1436,7 +1436,7 @@ void VehiclePayment(Vehicle *front_v)
/* All cargo has already been paid for, no need to pay again */ /* All cargo has already been paid for, no need to pay again */
if (!v->cargo.UnpaidCargo()) { if (!v->cargo.UnpaidCargo()) {
SETBIT(v->vehicle_flags, VF_CARGO_UNLOADING); SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
continue; continue;
} }
@ -1460,7 +1460,7 @@ void VehiclePayment(Vehicle *front_v)
result |= 1; 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)) { } else if (front_v->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) {
if (!cp->paid_for && (front_v->current_order.flags & OF_TRANSFER) != 0) { if (!cp->paid_for && (front_v->current_order.flags & OF_TRANSFER) != 0) {
Money profit = GetTransportedGoodsIncome( Money profit = GetTransportedGoodsIncome(
@ -1477,7 +1477,7 @@ void VehiclePayment(Vehicle *front_v)
} }
result |= 2; result |= 2;
SETBIT(v->vehicle_flags, VF_CARGO_UNLOADING); SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
} }
} }
v->cargo.InvalidateCache(); v->cargo.InvalidateCache();
@ -1527,7 +1527,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
if (v->type == VEH_TRAIN && !IsTileType(v->tile, MP_STATION)) { if (v->type == VEH_TRAIN && !IsTileType(v->tile, MP_STATION)) {
/* The train reversed in the station. Take the "easy" way /* The train reversed in the station. Take the "easy" way
* out and let the train just leave as it always did. */ * 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; return;
} }
@ -1570,7 +1570,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
result |= 1; result |= 1;
} else if (u->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) { } else if (u->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) {
remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded); remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded);
SETBIT(ge->acceptance_pickup, GoodsEntry::PICKUP); SetBit(ge->acceptance_pickup, GoodsEntry::PICKUP);
result |= 2; result |= 2;
} else { } else {
@ -1621,7 +1621,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
/* Skip loading this vehicle if another train/vehicle is already handling /* Skip loading this vehicle if another train/vehicle is already handling
* the same cargo type at this station */ * the same cargo type at this station */
if (_patches.improved_load && cargo_left[v->cargo_type] <= 0) { 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; continue;
} }
@ -1656,9 +1656,9 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
} }
if (v->cargo.Count() == v->cargo_cap) { if (v->cargo.Count() == v->cargo_cap) {
SETBIT(cargo_full, v->cargo_type); SetBit(cargo_full, v->cargo_type);
} else { } else {
SETBIT(cargo_not_full, v->cargo_type); SetBit(cargo_not_full, v->cargo_type);
} }
} }

View File

@ -274,7 +274,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
/* track found, if track is in the neighbour tile, adjust the number /* track found, if track is in the neighbour tile, adjust the number
* of the PCP for preferred/allowed determination*/ * of the PCP for preferred/allowed determination*/
DiagDirection PCPpos = (TrackSourceTile[i][k] == TS_HOME) ? i : ReverseDiagDir(i); 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]; PPPpreferred[i] &= PreferredPPPofTrackAtPCP[TracksAtPCP[i][k]][PCPpos];
PPPallowed[i] &= ~DisallowedPPPofTrackAtPCP[TracksAtPCP[i][k]][PCPpos]; PPPallowed[i] &= ~DisallowedPPPofTrackAtPCP[TracksAtPCP[i][k]][PCPpos];
@ -322,7 +322,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
if ((height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) && if ((height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) &&
(i == PCPpositions[bridgetrack][0] || i == PCPpositions[bridgetrack][1])) { (i == PCPpositions[bridgetrack][0] || i == PCPpositions[bridgetrack][1])) {
SETBIT(OverridePCP, i); SetBit(OverridePCP, i);
} }
} }
@ -504,7 +504,7 @@ int32 SettingsDisableElrail(int32 p1)
* so add there also normal rail compatibility */ * so add there also normal rail compatibility */
v->u.rail.compatible_railtypes |= (1 << RAILTYPE_RAIL); v->u.rail.compatible_railtypes |= (1 << RAILTYPE_RAIL);
v->u.rail.railtype = 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);
} }
} }
} }

View File

@ -183,14 +183,14 @@ static void AcceptEnginePreview(EngineID eid, PlayerID player)
Engine *e = GetEngine(eid); Engine *e = GetEngine(eid);
Player *p = GetPlayer(player); Player *p = GetPlayer(player);
SETBIT(e->player_avail, player); SetBit(e->player_avail, player);
if (e->type == VEH_TRAIN) { if (e->type == VEH_TRAIN) {
const RailVehicleInfo *rvi = RailVehInfo(eid); const RailVehicleInfo *rvi = RailVehInfo(eid);
assert(rvi->railtype < RAILTYPE_END); assert(rvi->railtype < RAILTYPE_END);
SETBIT(p->avail_railtypes, rvi->railtype); SetBit(p->avail_railtypes, rvi->railtype);
} else if (e->type == VEH_ROAD) { } 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; e->preview_player = INVALID_PLAYER;
@ -219,7 +219,7 @@ static PlayerID GetBestPlayer(PlayerID pp)
if (best_player == PLAYER_SPECTATOR) return PLAYER_SPECTATOR; if (best_player == PLAYER_SPECTATOR) return PLAYER_SPECTATOR;
SETBIT(mask, best_player); SetBit(mask, best_player);
} while (pp--, pp != 0); } while (pp--, pp != 0);
return best_player; return best_player;
@ -332,13 +332,13 @@ static void NewVehicleAvailable(Engine *e)
RailType railtype = RailVehInfo(index)->railtype; RailType railtype = RailVehInfo(index)->railtype;
assert(railtype < RAILTYPE_END); assert(railtype < RAILTYPE_END);
FOR_ALL_PLAYERS(p) { 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) { if ((index - NUM_TRAIN_ENGINES) < NUM_ROAD_ENGINES) {
/* maybe make another road type available */ /* maybe make another road type available */
FOR_ALL_PLAYERS(p) { 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); AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL), 0, 0);

View File

@ -260,7 +260,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
FOR_ALL_PLAYERS(p) { FOR_ALL_PLAYERS(p) {
if (p->is_active) continue; if (p->is_active) continue;
SETBIT(_legend_excluded_players, p->index); SetBit(_legend_excluded_players, p->index);
RaiseWindowWidget(w, p->index + 3); RaiseWindowWidget(w, p->index + 3);
} }
@ -334,7 +334,7 @@ static void SetupGraphDrawerForPlayers(GraphDrawer *gd)
/* Exclude the players which aren't valid */ /* Exclude the players which aren't valid */
FOR_ALL_PLAYERS(p) { 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->excluded_data = excluded_players;
gd->num_vert_lines = 24; gd->num_vert_lines = 24;

View File

@ -149,11 +149,6 @@ template <typename Tenum_t> struct TinyEnumT
} }
}; };
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) template <typename T> void ToggleBitT(T &t, int bit_index)
{ {
t = (T)(t ^ ((T)1 << bit_index)); t = (T)(t ^ ((T)1 << bit_index));

View File

@ -247,9 +247,9 @@ template<typename T> static inline bool HasBit(const T x, const uint8 y)
* @param y The bit position to set * @param y The bit position to set
* @return The new value of the old value with the bit 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));
} }
/** /**

View File

@ -971,14 +971,14 @@ static void ToolbarOptionsClick(Window *w)
w = PopupMainToolbMenu(w, 2, STR_02C3_GAME_OPTIONS, 14, 0); 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_TOWN_NAMES)) SetBit(x, 6);
if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SETBIT(x, 7); 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_SHOW_SIGNS)) SetBit(x, 8);
if (HasBit(_display_opt, DO_WAYPOINTS)) SETBIT(x, 9); 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_ANIMATION)) SetBit(x, 10);
if (HasBit(_display_opt, DO_FULL_DETAIL)) SETBIT(x, 11); if (HasBit(_display_opt, DO_FULL_DETAIL)) SetBit(x, 11);
if (IsTransparencySet(TO_HOUSES) && IsTransparencySet(TO_TREES)) SETBIT(x, 12); if (IsTransparencySet(TO_HOUSES) && IsTransparencySet(TO_TREES)) SetBit(x, 12);
if (IsTransparencySet(TO_SIGNS)) SETBIT(x, 13); if (IsTransparencySet(TO_SIGNS)) SetBit(x, 13);
WP(w,menu_d).checked_items = x; WP(w,menu_d).checked_items = x;
} }

View File

@ -1106,7 +1106,7 @@ static void QueryStringWndProc(Window *w, WindowEvent *e)
switch (e->event) { switch (e->event) {
case WE_CREATE: case WE_CREATE:
SETBIT(_no_scroll, SCROLL_EDIT); SetBit(_no_scroll, SCROLL_EDIT);
break; break;
case WE_PAINT: case WE_PAINT:
@ -1680,7 +1680,7 @@ void ShowSaveLoadDialog(int mode)
DeleteWindowById(WC_SAVELOAD, 0); DeleteWindowById(WC_SAVELOAD, 0);
_saveload_mode = mode; _saveload_mode = mode;
SETBIT(_no_scroll, SCROLL_SAVE); SetBit(_no_scroll, SCROLL_SAVE);
switch (mode) { switch (mode) {
case SLD_SAVE_GAME: GenerateFileName(); break; case SLD_SAVE_GAME: GenerateFileName(); break;

View File

@ -1686,7 +1686,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
switch (e->event) { switch (e->event) {
case WE_CREATE: case WE_CREATE:
SendWindowMessage(WC_NEWS_WINDOW, 0, WE_CREATE, w->height, 0); 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; break;
case WE_PAINT: { case WE_PAINT: {

View File

@ -398,7 +398,7 @@ void ClientNetworkUDPSocketHandler::HandleIncomingNetworkGameInfoGRFConfig(GRFCo
config->name = f->name; config->name = f->name;
config->info = f->info; config->info = f->info;
} }
SETBIT(config->flags, GCF_COPY); SetBit(config->flags, GCF_COPY);
} }
// Close UDP connection // Close UDP connection

View File

@ -950,7 +950,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
if (dts->ground_sprite == 0) continue; if (dts->ground_sprite == 0) continue;
if (HasBit(dts->ground_pal, 15)) { if (HasBit(dts->ground_pal, 15)) {
ClrBit(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) { while (buf < *bufp + len) {
@ -973,16 +973,16 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
/* Remap flags as ours collide */ /* Remap flags as ours collide */
if (HasBit(dtss->pal, 15)) { if (HasBit(dtss->pal, 15)) {
ClrBit(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)) { if (HasBit(dtss->image, 15)) {
ClrBit(dtss->image, 15); ClrBit(dtss->image, 15);
SETBIT(dtss->image, PALETTE_MODIFIER_COLOR); SetBit(dtss->image, PALETTE_MODIFIER_COLOR);
} }
if (HasBit(dtss->image, 14)) { if (HasBit(dtss->image, 14)) {
ClrBit(dtss->image, 14); ClrBit(dtss->image, 14);
SETBIT(dtss->image, PALETTE_MODIFIER_TRANSPARENT); SetBit(dtss->image, PALETTE_MODIFIER_TRANSPARENT);
} }
} }
} }
@ -1176,7 +1176,7 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int
SpriteID pal = grf_load_word(&buf); SpriteID pal = grf_load_word(&buf);
if (HasBit(pal, 15)) { if (HasBit(pal, 15)) {
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT); SetBit(image, PALETTE_MODIFIER_TRANSPARENT);
} }
/* Clear old color modifer bit */ /* Clear old color modifer bit */
@ -1572,7 +1572,7 @@ static bool CargoChangeInfo(uint cid, int numinfo, int prop, byte **bufp, int le
cs->bitnum = grf_load_byte(&buf); cs->bitnum = grf_load_byte(&buf);
if (cs->IsValid()) { if (cs->IsValid()) {
cs->grfid = _cur_grffile->grfid; cs->grfid = _cur_grffile->grfid;
SETBIT(_cargo_mask, cid + i); SetBit(_cargo_mask, cid + i);
} else { } else {
ClrBit(_cargo_mask, cid + i); ClrBit(_cargo_mask, cid + i);
} }
@ -1965,7 +1965,7 @@ static bool IndustriesChangeInfo(uint indid, int numinfo, int prop, byte **bufp,
} }
/* Install final layout construction in the industry spec */ /* Install final layout construction in the industry spec */
indsp->table = tile_table; indsp->table = tile_table;
SETBIT(indsp->cleanup_flag, 1); SetBit(indsp->cleanup_flag, 1);
free(itt); free(itt);
} break; } break;
@ -2017,7 +2017,7 @@ static bool IndustriesChangeInfo(uint indid, int numinfo, int prop, byte **bufp,
for (uint8 j = 0; j < indsp->number_of_sounds; j++) sounds[j] = grf_load_byte(&buf); for (uint8 j = 0; j < indsp->number_of_sounds; j++) sounds[j] = grf_load_byte(&buf);
indsp->random_sounds = sounds; indsp->random_sounds = sounds;
SETBIT(indsp->cleanup_flag, 0); SetBit(indsp->cleanup_flag, 0);
} break; } break;
case 0x16: // Conflicting industry types case 0x16: // Conflicting industry types
@ -2212,7 +2212,7 @@ static void SafeChangeInfo(byte *buf, int len)
if (prop == 0x0D) return; if (prop == 0x0D) return;
} }
SETBIT(_cur_grfconfig->flags, GCF_UNSAFE); SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
/* Skip remainder of GRF */ /* Skip remainder of GRF */
_skip_sprites = -1; _skip_sprites = -1;
@ -2584,15 +2584,15 @@ static void NewSpriteGroup(byte *buf, int len)
/* Remap transparent/colour modifier bits */ /* Remap transparent/colour modifier bits */
if (HasBit(group->g.layout.dts->ground_sprite, 14)) { if (HasBit(group->g.layout.dts->ground_sprite, 14)) {
ClrBit(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)) { if (HasBit(group->g.layout.dts->ground_sprite, 15)) {
ClrBit(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)) { if (HasBit(group->g.layout.dts->ground_pal, 14)) {
ClrBit(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)) { if (HasBit(group->g.layout.dts->ground_pal, 15)) {
/* Bit 31 set means this is a custom sprite, so rewrite it to the /* Bit 31 set means this is a custom sprite, so rewrite it to the
@ -2614,15 +2614,15 @@ static void NewSpriteGroup(byte *buf, int len)
if (HasBit(seq->image, 14)) { if (HasBit(seq->image, 14)) {
ClrBit(seq->image, 14); ClrBit(seq->image, 14);
SETBIT(seq->image, PALETTE_MODIFIER_TRANSPARENT); SetBit(seq->image, PALETTE_MODIFIER_TRANSPARENT);
} }
if (HasBit(seq->image, 15)) { if (HasBit(seq->image, 15)) {
ClrBit(seq->image, 15); ClrBit(seq->image, 15);
SETBIT(seq->image, PALETTE_MODIFIER_COLOR); SetBit(seq->image, PALETTE_MODIFIER_COLOR);
} }
if (HasBit(seq->pal, 14)) { if (HasBit(seq->pal, 14)) {
ClrBit(seq->pal, 14); ClrBit(seq->pal, 14);
SETBIT(seq->image, SPRITE_MODIFIER_OPAQUE); SetBit(seq->image, SPRITE_MODIFIER_OPAQUE);
} }
if (HasBit(seq->pal, 15)) { if (HasBit(seq->pal, 15)) {
/* Bit 31 set means this is a custom sprite, so rewrite it to the /* Bit 31 set means this is a custom sprite, so rewrite it to the
@ -3417,9 +3417,9 @@ static uint32 GetParamVal(byte param, uint32 *cond_val)
case 0x84: { // GRF loading stage case 0x84: { // GRF loading stage
uint32 res = 0; uint32 res = 0;
if (_cur_stage > GLS_INIT) SETBIT(res, 0); if (_cur_stage > GLS_INIT) SetBit(res, 0);
if (_cur_stage == GLS_RESERVE) SETBIT(res, 8); if (_cur_stage == GLS_RESERVE) SetBit(res, 8);
if (_cur_stage == GLS_ACTIVATION) SETBIT(res, 9); if (_cur_stage == GLS_ACTIVATION) SetBit(res, 9);
return res; return res;
} }
@ -3734,7 +3734,7 @@ static void ScanInfo(byte *buf, int len)
_cur_grfconfig->grfid = grfid; _cur_grfconfig->grfid = grfid;
/* GRF IDs starting with 0xFF are reserved for internal TTDPatch use */ /* 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; len -= 6;
const char *name = grf_load_string(&buf, len); const char *name = grf_load_string(&buf, len);
@ -3958,7 +3958,7 @@ static void SafeParamSet(byte *buf, int len)
* reserved, it would be marked unsafe anyway. GRM for (e.g. bridge) * reserved, it would be marked unsafe anyway. GRM for (e.g. bridge)
* sprites is considered safe. */ * sprites is considered safe. */
SETBIT(_cur_grfconfig->flags, GCF_UNSAFE); SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
/* Skip remainder of GRF */ /* Skip remainder of GRF */
_skip_sprites = -1; _skip_sprites = -1;
@ -4313,7 +4313,7 @@ static void SafeGRFInhibit(byte *buf, int len)
/* GRF is unsafe it if tries to deactivate other GRFs */ /* GRF is unsafe it if tries to deactivate other GRFs */
if (grfid != _cur_grfconfig->grfid) { if (grfid != _cur_grfconfig->grfid) {
SETBIT(_cur_grfconfig->flags, GCF_UNSAFE); SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
/* Skip remainder of GRF */ /* Skip remainder of GRF */
_skip_sprites = -1; _skip_sprites = -1;
@ -4736,7 +4736,7 @@ static void GRFDataBlock(byte *buf, int len)
/* Used during safety scan on unsafe actions */ /* Used during safety scan on unsafe actions */
static void GRFUnsafe(byte *buf, int len) static void GRFUnsafe(byte *buf, int len)
{ {
SETBIT(_cur_grfconfig->flags, GCF_UNSAFE); SetBit(_cur_grfconfig->flags, GCF_UNSAFE);
/* Skip remainder of GRF */ /* Skip remainder of GRF */
_skip_sprites = -1; _skip_sprites = -1;
@ -5181,7 +5181,7 @@ static void CalculateRefitMasks()
CargoID c = GetCargoIDByLabel(file->cargo_list[i]); CargoID c = GetCargoIDByLabel(file->cargo_list[i]);
if (c == CT_INVALID) continue; if (c == CT_INVALID) continue;
SETBIT(xor_mask, c); SetBit(xor_mask, c);
} }
} else { } else {
/* No cargo table, so use the cargo bitnum values */ /* No cargo table, so use the cargo bitnum values */
@ -5189,7 +5189,7 @@ static void CalculateRefitMasks()
const CargoSpec *cs = GetCargo(c); const CargoSpec *cs = GetCargo(c);
if (!cs->IsValid()) continue; 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 @@ static void CalculateRefitMasks()
/* Build up the list of cargo types from the set cargo classes. */ /* Build up the list of cargo types from the set cargo classes. */
for (CargoID i = 0; i < NUM_CARGO; i++) { for (CargoID i = 0; i < NUM_CARGO; i++) {
const CargoSpec *cs = GetCargo(i); const CargoSpec *cs = GetCargo(i);
if (cargo_allowed[engine] & cs->classes) SETBIT(mask, i); if (cargo_allowed[engine] & cs->classes) SetBit(mask, i);
if (cargo_disallowed[engine] & cs->classes) SETBIT(not_mask, i); if (cargo_disallowed[engine] & cs->classes) SetBit(not_mask, i);
} }
} else { } else {
/* Don't apply default refit mask to wagons or engines with no capacity */ /* Don't apply default refit mask to wagons or engines with no capacity */
@ -5216,7 +5216,7 @@ static void CalculateRefitMasks()
CargoID cargo = GetCargoIDByLabel(cl[i]); CargoID cargo = GetCargoIDByLabel(cl[i]);
if (cargo == CT_INVALID) continue; if (cargo == CT_INVALID) continue;
SETBIT(xor_mask, cargo); SetBit(xor_mask, cargo);
} }
} }
} }
@ -5605,7 +5605,7 @@ void LoadNewGRF(uint load_index, uint file_index)
if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid); if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid);
LoadNewGRFFile(c, slot++, stage); LoadNewGRFFile(c, slot++, stage);
if (stage == GLS_RESERVE) { if (stage == GLS_RESERVE) {
SETBIT(c->flags, GCF_RESERVED); SetBit(c->flags, GCF_RESERVED);
} else if (stage == GLS_ACTIVATION) { } else if (stage == GLS_ACTIVATION) {
ClrBit(c->flags, GCF_RESERVED); ClrBit(c->flags, GCF_RESERVED);
ClearTemporaryNewGRFData(); ClearTemporaryNewGRFData();

View File

@ -137,7 +137,7 @@ GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_o
} }
ClrBit(c->flags, GCF_INIT_ONLY); 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;
dst = &c->next; dst = &c->next;
@ -234,7 +234,7 @@ GRFListCompatibility IsGoodGRFConfigList()
if (f != NULL) { if (f != NULL) {
md5sumToString(buf, lastof(buf), c->md5sum); 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); 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 */ /* Non-found has precedence over compatibility load */
if (res != GLC_NOT_FOUND) res = GLC_COMPATIBLE; if (res != GLC_NOT_FOUND) res = GLC_COMPATIBLE;

View File

@ -660,7 +660,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
* bit 8: (Maybe?) Toggled whenever the train reverses. * 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); return variable == 0xFE ? modflags : GB(modflags, 8, 8);
} }

View File

@ -158,7 +158,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
/* Fall through */ /* Fall through */
default: //use the grfid specified in register 100h 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); ind_index = MapNewGRFIndustryType(param_setID, GrfID);
break; break;
} }

View File

@ -311,10 +311,10 @@ static uint32 GetRailContinuationInfo(TileIndex tile)
uint32 ts = GetTileTrackStatus(tile + TileOffsByDir(*dir), TRANSPORT_RAIL, 0); uint32 ts = GetTileTrackStatus(tile + TileOffsByDir(*dir), TRANSPORT_RAIL, 0);
if (ts != 0) { if (ts != 0) {
/* If there is any track on the tile, set the bit in the second byte */ /* 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 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 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
switch (variable) { switch (variable) {
/* Calculated station variables */ /* Calculated station variables */
case 0x40: 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; return _svc.v40;
case 0x41: 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; return _svc.v41;
case 0x42: return GetTerrainType(tile) | (GetRailType(tile) << 8); case 0x42: return GetTerrainType(tile) | (GetRailType(tile) << 8);
case 0x43: return st->owner; // Station owner case 0x43: return st->owner; // Station owner
case 0x44: return 2; // PBS status case 0x44: return 2; // PBS status
case 0x45: 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; return _svc.v45;
case 0x46: 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; return _svc.v46;
case 0x47: 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; return _svc.v47;
case 0x48: { // Accepted cargo types case 0x48: { // Accepted cargo types
@ -429,12 +429,12 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
uint32 value = 0; uint32 value = 0;
for (cargo_type = 0; cargo_type < NUM_CARGO; cargo_type++) { 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; return value;
} }
case 0x49: 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; return _svc.v49;
/* Variables which use the parameter */ /* Variables which use the parameter */

View File

@ -121,7 +121,7 @@ static inline bool NPFGetFlag(const AyStarNode* node, NPFNodeFlag flag)
static inline void NPFSetFlag(AyStarNode* node, NPFNodeFlag flag, bool value) static inline void NPFSetFlag(AyStarNode* node, NPFNodeFlag flag, bool value)
{ {
if (value) if (value)
SETBIT(node->user_data[NPF_NODE_FLAGS], flag); SetBit(node->user_data[NPF_NODE_FLAGS], flag);
else else
ClrBit(node->user_data[NPF_NODE_FLAGS], flag); ClrBit(node->user_data[NPF_NODE_FLAGS], flag);
} }

View File

@ -1375,7 +1375,7 @@ bool AfterLoadGame()
break; break;
case MP_STATION: { 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); StationGfx gfx = GetStationGfx(t);
StationType st; StationType st;
if ( IS_INT_INSIDE(gfx, 0, 8)) { // Railway station if ( IS_INT_INSIDE(gfx, 0, 8)) { // Railway station
@ -2146,7 +2146,7 @@ bool AfterLoadGame()
Vehicle *v; Vehicle *v;
FOR_ALL_VEHICLES(v) { FOR_ALL_VEHICLES(v) {
if (v->type == VEH_ROAD && (v->u.road.state == 250 || v->u.road.state == 251)) { 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 @@ bool AfterLoadGame()
FOR_ALL_STATIONS(st) { FOR_ALL_STATIONS(st) {
for (CargoID c = 0; c < NUM_CARGO; c++) { for (CargoID c = 0; c < NUM_CARGO; c++) {
st->goods[c].last_speed = 0; 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);
} }
} }
} }

View File

@ -275,7 +275,7 @@ static void ShowColourDropDownMenu(Window *w, uint32 widget)
if (HasBit(WP(w, livery_d).sel, LS_DEFAULT) && widget == 10) { if (HasBit(WP(w, livery_d).sel, LS_DEFAULT) && widget == 10) {
const Player *p; const Player *p;
FOR_ALL_PLAYERS(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);
} }
} }

View File

@ -90,8 +90,8 @@ PlayerFace ConvertFromOldPlayerFace(uint32 face)
PlayerFace pf = 0; PlayerFace pf = 0;
GenderEthnicity ge = GE_WM; GenderEthnicity ge = GE_WM;
if (HasBit(face, 31)) SetBitT(ge, GENDER_FEMALE); if (HasBit(face, 31)) SetBit(ge, GENDER_FEMALE);
if (HasBit(face, 27) && (HasBit(face, 26) == HasBit(face, 19))) SetBitT(ge, ETHNICITY_BLACK); if (HasBit(face, 27) && (HasBit(face, 26) == HasBit(face, 19))) SetBit(ge, ETHNICITY_BLACK);
SetPlayerFaceBits(pf, PFV_GEN_ETHN, ge, ge); SetPlayerFaceBits(pf, PFV_GEN_ETHN, ge, ge);
SetPlayerFaceBits(pf, PFV_HAS_GLASSES, ge, GB(face, 28, 3) <= 1); SetPlayerFaceBits(pf, PFV_HAS_GLASSES, ge, GB(face, 28, 3) <= 1);
@ -603,7 +603,7 @@ byte GetPlayerRailtypes(PlayerID p)
if (rvi->railveh_type != RAILVEH_WAGON) { if (rvi->railveh_type != RAILVEH_WAGON) {
assert(rvi->railtype < RAILTYPE_END); assert(rvi->railtype < RAILTYPE_END);
SETBIT(rt, rvi->railtype); SetBit(rt, rvi->railtype);
} }
} }
} }
@ -622,7 +622,7 @@ byte GetPlayerRoadtypes(PlayerID p)
if (e->type == VEH_ROAD && HasBit(ei->climates, _opt.landscape) && if (e->type == VEH_ROAD && HasBit(ei->climates, _opt.landscape) &&
(HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) { (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);
} }
} }

View File

@ -602,7 +602,7 @@ static CommandCost ValidateAutoDrag(Trackdir *trackdir, TileIndex start, TileInd
(trdy >= 0 && dy < 0) (trdy >= 0 && dy < 0)
) { ) {
if (!HasBit(*trackdir, 3)) { // first direction is invalid, try the other 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; trdx = -trdx;
trdy = -trdy; trdy = -trdy;
} else { // other direction is invalid too, invalid drag } else { // other direction is invalid too, invalid drag
@ -701,7 +701,7 @@ CommandCost CmdBuildRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint3
*/ */
CommandCost CmdRemoveRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) 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 /** Build a train depot
@ -985,8 +985,8 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1,
} }
byte signal_dir = 0; byte signal_dir = 0;
if (signals & SignalAlongTrackdir(trackdir)) SETBIT(signal_dir, 0); if (signals & SignalAlongTrackdir(trackdir)) SetBit(signal_dir, 0);
if (signals & SignalAgainstTrackdir(trackdir)) SETBIT(signal_dir, 1); if (signals & SignalAgainstTrackdir(trackdir)) SetBit(signal_dir, 1);
/* signal_ctr - amount of tiles already processed /* signal_ctr - amount of tiles already processed
* signals_density - patch setting to put signal on every Nth tile (double space on |, -- tracks) * signals_density - patch setting to put signal on every Nth tile (double space on |, -- tracks)
@ -1121,7 +1121,7 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint3
*/ */
CommandCost CmdRemoveSignalTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) 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); typedef CommandCost DoConvertRailProc(TileIndex tile, RailType totype, bool exec);

View File

@ -204,7 +204,7 @@ static void PlaceRoadStop(TileIndex tile, uint32 p2, uint32 cmd)
uint32 p1 = _road_station_picker_orientation; uint32 p1 = _road_station_picker_orientation;
if (p1 >= DIAGDIR_END) { 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 p1 -= DIAGDIR_END; // Adjust picker result to actual direction
} }
DoCommandP(tile, p1, p2, CcRoadDepot, cmd); DoCommandP(tile, p1, p2, CcRoadDepot, cmd);

View File

@ -200,7 +200,7 @@ static inline void UnbarCrossing(TileIndex t)
static inline void BarCrossing(TileIndex t) static inline void BarCrossing(TileIndex t)
{ {
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING); assert(GetRoadTileType(t) == ROAD_TILE_CROSSING);
SETBIT(_m[t].m4, 5); SetBit(_m[t].m4, 5);
} }
static inline bool IsCrossingBarred(TileIndex t) static inline bool IsCrossingBarred(TileIndex t)

View File

@ -257,7 +257,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->u.road.cached_veh_length = GetRoadVehLength(v); v->u.road.cached_veh_length = GetRoadVehLength(v);
v->vehicle_flags = 0; 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); v->cargo_cap = GetVehicleProperty(v, 0x0F, rvi->capacity);
@ -511,7 +511,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
ClearSlot(v); ClearSlot(v);
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; 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.refit_cargo = CT_INVALID;
v->current_order.dest = dep->index; v->current_order.dest = dep->index;
v->dest_tile = dep->xy; v->dest_tile = dep->xy;

View File

@ -435,7 +435,7 @@ static uint32 lookup_manyofmany(const char *many, const char *str)
r = lookup_oneofmany(many, str, s - str); r = lookup_oneofmany(many, str, s - str);
if (r == -1) return (uint32)-1; if (r == -1) return (uint32)-1;
SETBIT(res, r); // value found, set it SetBit(res, r); // value found, set it
if (*s == 0) break; if (*s == 0) break;
str = s + 1; str = s + 1;
} }
@ -1684,7 +1684,7 @@ static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_stati
} }
/* Mark file as static to avoid saving in savegame. */ /* 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 */ /* Add item to list */
*curr = c; *curr = c;

View File

@ -537,12 +537,12 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
if (x >= 10) { if (x >= 10) {
// Increase button clicked // Increase button clicked
val = min(val + info->step, info->max); val = min(val + info->step, info->max);
SETBIT(_difficulty_click_b, btn); SetBit(_difficulty_click_b, btn);
} else { } else {
// Decrease button clicked // Decrease button clicked
val -= info->step; val -= info->step;
val = max(val, info->min); val = max(val, info->min);
SETBIT(_difficulty_click_a, btn); SetBit(_difficulty_click_a, btn);
} }
// save value in temporary variable // save value in temporary variable

View File

@ -875,7 +875,7 @@ CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->random_bits = VehicleRandomBits(); v->random_bits = VehicleRandomBits();
v->vehicle_flags = 0; 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); v->cargo_cap = GetVehicleProperty(v, 0x0D, svi->capacity);
@ -1039,7 +1039,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
v->dest_tile = dep->xy; v->dest_tile = dep->xy;
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; 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.refit_cargo = CT_INVALID;
v->current_order.dest = dep->index; v->current_order.dest = dep->index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);

View File

@ -201,7 +201,7 @@ static void QuerySignEditWndProc(Window *w, WindowEvent *e)
switch (e->event) { switch (e->event) {
case WE_CREATE: case WE_CREATE:
SETBIT(_no_scroll, SCROLL_EDIT); SetBit(_no_scroll, SCROLL_EDIT);
break; break;
case WE_PAINT: case WE_PAINT:

View File

@ -476,7 +476,7 @@ void RoadStop::AllocateDriveThroughBay(uint nr)
void RoadStop::FreeBay(uint nr) void RoadStop::FreeBay(uint nr)
{ {
assert(nr < MAX_BAY_COUNT); assert(nr < MAX_BAY_COUNT);
SETBIT(status, nr); SetBit(status, nr);
} }

View File

@ -990,7 +990,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
if (!GenerateStationName(st, tile_org, STATIONNAMING_RAIL)) return CMD_ERROR; if (!GenerateStationName(st, tile_org, STATIONNAMING_RAIL)) return CMD_ERROR;
if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) { 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 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!GenerateStationName(st, tile, STATIONNAMING_ROAD)) return CMD_ERROR; if (!GenerateStationName(st, tile, STATIONNAMING_ROAD)) return CMD_ERROR;
if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) { 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; st->sign.width_1 = 0;
@ -1715,7 +1715,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
st->town = t; st->town = t;
if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) { 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; st->sign.width_1 = 0;
@ -2002,7 +2002,7 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Town *t = st->town = ClosestTownFromTile(tile, (uint)-1); Town *t = st->town = ClosestTownFromTile(tile, (uint)-1);
if (IsValidPlayer(_current_player) && (flags & DC_EXEC) != 0) { 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; st->sign.width_1 = 0;
@ -2386,14 +2386,14 @@ static uint32 VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
/* Check if the vehicle is stopping at this road stop */ /* Check if the vehicle is stopping at this road stop */
if (GetRoadStopType(tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK) && if (GetRoadStopType(tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK) &&
v->current_order.dest == GetStationIndex(tile)) { 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); rs->AllocateDriveThroughBay(side);
} }
/* Indicate if vehicle is using second bay. */ /* 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 */ /* 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; return VETSB_CONTINUE;
} }
@ -2401,7 +2401,7 @@ static uint32 VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
/* Check if station is busy or if there are no free bays or whether it is a articulated vehicle. */ /* 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; 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 */ /* Allocate a bay and update the road state */
uint bay_nr = rs->AllocateBay(); uint bay_nr = rs->AllocateBay();
@ -2587,7 +2587,7 @@ void ModifyStationRatingAround(TileIndex tile, PlayerID owner, int amount, uint
static void UpdateStationWaiting(Station *st, CargoID type, uint amount) static void UpdateStationWaiting(Station *st, CargoID type, uint amount)
{ {
st->goods[type].cargo.Append(new CargoPacket(st->index, 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); InvalidateWindow(WC_STATION_VIEW, st->index);
st->MarkTilesDirty(true); st->MarkTilesDirty(true);

View File

@ -406,7 +406,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
for (uint i = 0; facilities != 0; i++, facilities >>= 1) { for (uint i = 0; facilities != 0; i++, facilities >>= 1) {
if (HasBit(facilities, 0)) RaiseWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN); 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); LowerWindowWidget(w, e->we.click.widget);
} }
SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK)); SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
@ -498,7 +498,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
_cargo_filter = 0; _cargo_filter = 0;
include_empty = false; include_empty = false;
SETBIT(_cargo_filter, c); SetBit(_cargo_filter, c);
LowerWindowWidget(w, e->we.click.widget); LowerWindowWidget(w, e->we.click.widget);
} }
sl->flags |= SL_REBUILD; sl->flags |= SL_REBUILD;

View File

@ -121,7 +121,7 @@ CommandCost CmdAutofillTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32
if (p2 == 1) { if (p2 == 1) {
/* Start autofilling the timetable, which clears all the current /* Start autofilling the timetable, which clears all the current
* timings and clears the "timetable has started" bit. */ * 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); ClrBit(v->vehicle_flags, VF_TIMETABLE_STARTED);
for (Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) { for (Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
@ -155,7 +155,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
/* Make sure the timetable only starts when the vehicle reaches the first /* Make sure the timetable only starts when the vehicle reaches the first
* order, not when travelling from the depot to the first station. */ * order, not when travelling from the depot to the first station. */
if (v->cur_order_index == 0 && !HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) { 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; return;
} }

View File

@ -1725,9 +1725,9 @@ static void DoBuildTownHouse(Town *t, TileIndex tile)
/* Special houses that there can be only one of. */ /* Special houses that there can be only one of. */
if (hs->building_flags & BUILDING_IS_CHURCH) { 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) { } else if (hs->building_flags & BUILDING_IS_STADIUM) {
SETBIT(oneof, TOWN_HAS_STADIUM); SetBit(oneof, TOWN_HAS_STADIUM);
} else { } else {
oneof = 0; oneof = 0;
} }
@ -2012,7 +2012,7 @@ static void TownActionBuildStatue(Town* t)
TileIndex tile = t->xy; TileIndex tile = t->xy;
if (CircularTileSearch(tile, 9, SearchTileForStatue, t->index)) 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) static void TownActionFundBuildings(Town* t)
@ -2020,7 +2020,7 @@ static void TownActionFundBuildings(Town* t)
/* Build next tick */ /* Build next tick */
t->grow_counter = 1; t->grow_counter = 1;
/* If we were not already growing */ /* If we were not already growing */
SETBIT(t->flags12, TOWN_IS_FUNDED); SetBit(t->flags12, TOWN_IS_FUNDED);
/* And grow for 3 months */ /* And grow for 3 months */
t->fund_buildings_months = 3; t->fund_buildings_months = 3;
} }
@ -2177,7 +2177,7 @@ static void UpdateTownGrowRate(Town *t)
if (m <= t->grow_counter) if (m <= t->grow_counter)
t->grow_counter = m; t->grow_counter = m;
SETBIT(t->flags12, TOWN_IS_FUNDED); SetBit(t->flags12, TOWN_IS_FUNDED);
} }
static void UpdateTownAmounts(Town *t) static void UpdateTownAmounts(Town *t)
@ -2267,7 +2267,7 @@ void ChangeTownRating(Town *t, int add, int max)
return; return;
} }
SETBIT(t->have_ratings, _current_player); SetBit(t->have_ratings, _current_player);
rating = t->ratings[_current_player]; rating = t->ratings[_current_player];

View File

@ -88,7 +88,7 @@ static inline bool LiftHasDestination(TileIndex t)
*/ */
static inline void SetLiftDestination(TileIndex t, byte dest) 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); SB(_me[t].m7, 1, 3, dest);
} }

View File

@ -41,7 +41,7 @@ static inline bool IsFrontEngine(const Vehicle *v)
static inline void SetFrontEngine(Vehicle *v) static inline void SetFrontEngine(Vehicle *v)
{ {
assert(v->type == VEH_TRAIN); assert(v->type == VEH_TRAIN);
SETBIT(v->subtype, Train_Front); SetBit(v->subtype, Train_Front);
} }
/** Remove the front engine state /** Remove the front engine state
@ -69,7 +69,7 @@ static inline bool IsArticulatedPart(const Vehicle *v)
static inline void SetArticulatedPart(Vehicle *v) static inline void SetArticulatedPart(Vehicle *v)
{ {
assert(v->type == VEH_TRAIN); 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 /** Clear a vehicle from being an articulated part
@ -97,7 +97,7 @@ static inline bool IsTrainWagon(const Vehicle *v)
static inline void SetTrainWagon(Vehicle *v) static inline void SetTrainWagon(Vehicle *v)
{ {
assert(v->type == VEH_TRAIN); assert(v->type == VEH_TRAIN);
SETBIT(v->subtype, Train_Wagon); SetBit(v->subtype, Train_Wagon);
} }
/** Clear wagon property /** Clear wagon property
@ -125,7 +125,7 @@ static inline bool IsTrainEngine(const Vehicle *v)
static inline void SetTrainEngine(Vehicle *v) static inline void SetTrainEngine(Vehicle *v)
{ {
assert(v->type == VEH_TRAIN); assert(v->type == VEH_TRAIN);
SETBIT(v->subtype, Train_Engine); SetBit(v->subtype, Train_Engine);
} }
/** Clear engine status /** Clear engine status
@ -153,7 +153,7 @@ static inline bool IsFreeWagon(const Vehicle *v)
static inline void SetFreeWagon(Vehicle *v) static inline void SetFreeWagon(Vehicle *v)
{ {
assert(v->type == VEH_TRAIN); 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 /** Clear a vehicle from being a free wagon
@ -181,7 +181,7 @@ static inline bool IsMultiheaded(const Vehicle *v)
static inline void SetMultiheaded(Vehicle *v) static inline void SetMultiheaded(Vehicle *v)
{ {
assert(v->type == VEH_TRAIN); assert(v->type == VEH_TRAIN);
SETBIT(v->subtype, Train_Multiheaded); SetBit(v->subtype, Train_Multiheaded);
} }
/** Clear multiheaded engine property /** Clear multiheaded engine property

View File

@ -206,7 +206,7 @@ void TrainConsistChanged(Vehicle* v)
if (rvi_v->pow_wag_power != 0 && rvi_u->railveh_type == RAILVEH_WAGON && if (rvi_v->pow_wag_power != 0 && rvi_u->railveh_type == RAILVEH_WAGON &&
UsesWagonOverride(u) && !HasBit(u->u.rail.cached_vis_effect, 7)) { UsesWagonOverride(u) && !HasBit(u->u.rail.cached_vis_effect, 7)) {
/* wagon is powered */ /* wagon is powered */
SETBIT(u->u.rail.flags, VRF_POWEREDWAGON); // cache 'powered' status SetBit(u->u.rail.flags, VRF_POWEREDWAGON); // cache 'powered' status
} else { } else {
ClrBit(u->u.rail.flags, VRF_POWEREDWAGON); ClrBit(u->u.rail.flags, VRF_POWEREDWAGON);
} }
@ -747,7 +747,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
v->random_bits = VehicleRandomBits(); v->random_bits = VehicleRandomBits();
v->vehicle_flags = 0; 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; v->group_id = DEFAULT_GROUP;
@ -1465,14 +1465,14 @@ static void SwapTrainFlags(byte *swap_flag1, byte *swap_flag2)
/* Reverse the rail-flags (if needed) */ /* Reverse the rail-flags (if needed) */
if (HasBit(flag1, VRF_GOINGUP)) { if (HasBit(flag1, VRF_GOINGUP)) {
SETBIT(*swap_flag2, VRF_GOINGDOWN); SetBit(*swap_flag2, VRF_GOINGDOWN);
} else if (HasBit(flag1, VRF_GOINGDOWN)) { } else if (HasBit(flag1, VRF_GOINGDOWN)) {
SETBIT(*swap_flag2, VRF_GOINGUP); SetBit(*swap_flag2, VRF_GOINGUP);
} }
if (HasBit(flag2, VRF_GOINGUP)) { if (HasBit(flag2, VRF_GOINGUP)) {
SETBIT(*swap_flag1, VRF_GOINGDOWN); SetBit(*swap_flag1, VRF_GOINGDOWN);
} else if (HasBit(flag2, VRF_GOINGDOWN)) { } else if (HasBit(flag2, VRF_GOINGDOWN)) {
SETBIT(*swap_flag1, VRF_GOINGUP); SetBit(*swap_flag1, VRF_GOINGUP);
} }
} }
@ -1940,7 +1940,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
v->dest_tile = tfdd.tile; v->dest_tile = tfdd.tile;
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; 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.dest = GetDepotByTile(tfdd.tile)->index;
v->current_order.refit_cargo = CT_INVALID; v->current_order.refit_cargo = CT_INVALID;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@ -2262,7 +2262,7 @@ static Track ChooseTrainTrack(Vehicle* v, TileIndex tile, DiagDirection enterdir
/* PF didn't find the route */ /* PF didn't find the route */
if (!HasBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) { if (!HasBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) {
/* it is first time the problem occurred, set the "path not found" flag */ /* 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 */ /* and notify user about the event */
if (_patches.lost_train_warn && v->owner == _local_player) { if (_patches.lost_train_warn && v->owner == _local_player) {
SetDParam(0, v->unitnumber); SetDParam(0, v->unitnumber);
@ -2570,7 +2570,7 @@ static byte AfterSetTrainPos(Vehicle *v, bool new_tile)
/* For some reason tunnel tiles are always given as sloped :( /* For some reason tunnel tiles are always given as sloped :(
* But they are not sloped... */ * But they are not sloped... */
if (middle_z != v->z_pos && !IsTunnelTile(TileVirtXY(v->x_pos, v->y_pos))) { 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 @@ void ConvertOldMultiheadToNew()
Vehicle *v; Vehicle *v;
FOR_ALL_VEHICLES(v) { FOR_ALL_VEHICLES(v) {
if (v->type == VEH_TRAIN) { 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
} }
} }

View File

@ -1198,7 +1198,7 @@ void DrawBridgeMiddle(const TileInfo* ti)
SpriteID image = psid->sprite; SpriteID image = psid->sprite;
SpriteID pal = psid->pal; SpriteID pal = psid->pal;
if (IsTransparencySet(TO_BRIDGES)) { if (IsTransparencySet(TO_BRIDGES)) {
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT); SetBit(image, PALETTE_MODIFIER_TRANSPARENT);
pal = PALETTE_TO_TRANSPARENT; pal = PALETTE_TO_TRANSPARENT;
} }

View File

@ -1755,7 +1755,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
w = GetVehicle(_new_vehicle_id); w = GetVehicle(_new_vehicle_id);
if (v->type == VEH_TRAIN && HasBit(v->u.rail.flags, VRF_REVERSE_DIRECTION)) { 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)) { if (v->type == VEH_TRAIN && !IsFrontEngine(v)) {

View File

@ -179,7 +179,7 @@ void AssignWindowViewport(Window *w, int x, int y,
assert(vp != endof(_viewports)); assert(vp != endof(_viewports));
if (vp->width == 0) break; if (vp->width == 0) break;
} }
SETBIT(_active_viewports, bit); SetBit(_active_viewports, bit);
vp->left = x + w->left; vp->left = x + w->left;
vp->top = y + w->top; vp->top = y + w->top;
@ -627,7 +627,7 @@ void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w,
/* make the sprites transparent with the right palette */ /* make the sprites transparent with the right palette */
if (transparent) { if (transparent) {
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT); SetBit(image, PALETTE_MODIFIER_TRANSPARENT);
pal = PALETTE_TO_TRANSPARENT; pal = PALETTE_TO_TRANSPARENT;
} }
@ -739,7 +739,7 @@ void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool trans
/* make the sprites transparent with the right palette */ /* make the sprites transparent with the right palette */
if (transparent) { if (transparent) {
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT); SetBit(image, PALETTE_MODIFIER_TRANSPARENT);
pal = PALETTE_TO_TRANSPARENT; pal = PALETTE_TO_TRANSPARENT;
} }