summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2007-11-19 21:32:20 +0000
committerskidd13 <skidd13@openttd.org>2007-11-19 21:32:20 +0000
commit6801cceda1cb1d81c627b6d30c19933d81179ce9 (patch)
tree7d43b1e4a7bf1344b1d4cfb2dc2618720a0040e8
parentc0a2c0c23e129cb81400c5204fc9d0eedd9afb85 (diff)
downloadopenttd-6801cceda1cb1d81c627b6d30c19933d81179ce9.tar.xz
(svn r11482) -Codechange: Remove the doubled function ClrBitT and rename the remaining to fit with the naming style
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/bridge_map.h2
-rw-r--r--src/console.cpp2
-rw-r--r--src/economy.cpp8
-rw-r--r--src/elrail.cpp2
-rw-r--r--src/gfxinit.cpp2
-rw-r--r--src/helpers.hpp5
-rw-r--r--src/macros.h4
-rw-r--r--src/main_gui.cpp8
-rw-r--r--src/misc_gui.cpp4
-rw-r--r--src/network/network_gui.cpp2
-rw-r--r--src/newgrf.cpp40
-rw-r--r--src/newgrf_config.cpp2
-rw-r--r--src/npf.h2
-rw-r--r--src/oldloader.cpp2
-rw-r--r--src/openttd.cpp22
-rw-r--r--src/order_cmd.cpp4
-rw-r--r--src/rail.h4
-rw-r--r--src/rail_cmd.cpp4
-rw-r--r--src/road_map.h2
-rw-r--r--src/roadveh_cmd.cpp4
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/station.cpp4
-rw-r--r--src/station_cmd.cpp2
-rw-r--r--src/timetable_cmd.cpp6
-rw-r--r--src/town_cmd.cpp6
-rw-r--r--src/train.h12
-rw-r--r--src/train_cmd.cpp22
-rw-r--r--src/tunnelbridge_cmd.cpp4
-rw-r--r--src/unmovable_cmd.cpp2
-rw-r--r--src/viewport.cpp2
32 files changed, 93 insertions, 98 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 41116eb9d..5afad4f3f 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -573,7 +573,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
* Now we change the setting to apply the new one and let the vehicle head for the same hangar.
* Note: the if is (true for requesting service == true for ordered to stop in hangar) */
if (flags & DC_EXEC) {
- CLRBIT(v->current_order.flags, OFB_PART_OF_ORDERS);
+ ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS);
TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
diff --git a/src/bridge_map.h b/src/bridge_map.h
index be4354fe7..d381762fb 100644
--- a/src/bridge_map.h
+++ b/src/bridge_map.h
@@ -184,7 +184,7 @@ uint GetBridgeHeight(TileIndex tile);
static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a)
{
assert(MayHaveBridgeAbove(t));
- CLRBIT(_m[t].m6, 6 + a);
+ ClrBit(_m[t].m6, 6 + a);
}
diff --git a/src/console.cpp b/src/console.cpp
index 98a017c83..5f0a523ea 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -310,7 +310,7 @@ void IConsoleSwitch()
case ICONSOLE_OPENED: case ICONSOLE_FULL:
DeleteWindowById(WC_CONSOLE, 0);
_iconsole_mode = ICONSOLE_CLOSED;
- CLRBIT(_no_scroll, SCROLL_CON);
+ ClrBit(_no_scroll, SCROLL_CON);
break;
}
diff --git a/src/economy.cpp b/src/economy.cpp
index 72f69b698..63cc2d0db 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -341,7 +341,7 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
/* Reset the ratings for the old player */
t->ratings[old_player] = 500;
- CLRBIT(t->have_ratings, old_player);
+ ClrBit(t->have_ratings, old_player);
}
{
@@ -1425,7 +1425,7 @@ void VehiclePayment(Vehicle *front_v)
_current_player = front_v->owner;
/* At this moment loading cannot be finished */
- CLRBIT(front_v->vehicle_flags, VF_LOADING_FINISHED);
+ ClrBit(front_v->vehicle_flags, VF_LOADING_FINISHED);
/* Start unloading in at the first possible moment */
front_v->load_unload_time_rem = 1;
@@ -1576,7 +1576,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
} else {
/* The order changed while unloading (unset unload/transfer) or the
* station does not accept goods anymore. */
- CLRBIT(v->vehicle_flags, VF_CARGO_UNLOADING);
+ ClrBit(v->vehicle_flags, VF_CARGO_UNLOADING);
continue;
}
@@ -1590,7 +1590,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
completely_empty = false;
} else {
/* We have finished unloading (cargo count == 0) */
- CLRBIT(v->vehicle_flags, VF_CARGO_UNLOADING);
+ ClrBit(v->vehicle_flags, VF_CARGO_UNLOADING);
}
continue;
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 4e505a80e..b62c23456 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -307,7 +307,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
/* Level means that the slope is the same, or the track is flat */
if (tileh[TS_HOME] == tileh[TS_NEIGHBOUR] || (isflat[TS_HOME] && isflat[TS_NEIGHBOUR])) {
for (k = 0; k < NUM_IGNORE_GROUPS; k++)
- if (PPPpreferred[i] == IgnoredPCP[k][tlg][i]) CLRBIT(PCPstatus, i);
+ if (PPPpreferred[i] == IgnoredPCP[k][tlg][i]) ClrBit(PCPstatus, i);
}
/* Now decide where we draw our pylons. First try the preferred PPPs, but they may not exist.
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index 1175c21a8..8adc256c2 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -375,7 +375,7 @@ static void LoadSpriteTables()
GRFConfig *master = CallocT<GRFConfig>(1);
master->filename = strdup(files->openttd.filename);
FillGRFDetails(master, false);
- ClrBitT(master->flags, GCF_INIT_ONLY);
+ ClrBit(master->flags, GCF_INIT_ONLY);
master->next = top;
_grfconfig = master;
diff --git a/src/helpers.hpp b/src/helpers.hpp
index b69f17ae9..d7834c47d 100644
--- a/src/helpers.hpp
+++ b/src/helpers.hpp
@@ -149,11 +149,6 @@ template <typename Tenum_t> struct TinyEnumT
}
};
-template <typename T> void ClrBitT(T &t, int bit_index)
-{
- t = (T)(t & ~((T)1 << bit_index));
-}
-
template <typename T> void SetBitT(T &t, int bit_index)
{
t = (T)(t | ((T)1 << bit_index));
diff --git a/src/macros.h b/src/macros.h
index 5be50cb13..f2d6d89dd 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -263,9 +263,9 @@ template<typename T> static inline T SETBIT(T& x, const uint8 y)
* @param y The bit position to clear
* @return The new value of the old value with the bit cleared
*/
-template<typename T> static inline T CLRBIT(T& x, const uint8 y)
+template<typename T> static inline T ClrBit(T& x, const uint8 y)
{
- return x &= ~((T)1U << y);
+ return x = (T)(x & ~((T)1U << y));
}
/**
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 02af27d71..5f7c8ea5d 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -822,7 +822,7 @@ static void ToolbarTrainClick(Window *w)
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_TRAIN && IsFrontEngine(v)) CLRBIT(dis, v->owner);
+ if (v->type == VEH_TRAIN && IsFrontEngine(v)) ClrBit(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 13, dis);
}
@@ -833,7 +833,7 @@ static void ToolbarRoadClick(Window *w)
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_ROAD && IsRoadVehFront(v)) CLRBIT(dis, v->owner);
+ if (v->type == VEH_ROAD && IsRoadVehFront(v)) ClrBit(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 14, dis);
}
@@ -844,7 +844,7 @@ static void ToolbarShipClick(Window *w)
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_SHIP) CLRBIT(dis, v->owner);
+ if (v->type == VEH_SHIP) ClrBit(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 15, dis);
}
@@ -855,7 +855,7 @@ static void ToolbarAirClick(Window *w)
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_AIRCRAFT) CLRBIT(dis, v->owner);
+ if (v->type == VEH_AIRCRAFT) ClrBit(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 16, dis);
}
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 5130320cc..bc8b9384c 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1162,7 +1162,7 @@ static void QueryStringWndProc(Window *w, WindowEvent *e)
e.event = WE_ON_EDIT_TEXT_CANCEL;
parent->wndproc(parent, &e);
}
- CLRBIT(_no_scroll, SCROLL_EDIT);
+ ClrBit(_no_scroll, SCROLL_EDIT);
break;
}
}
@@ -1624,7 +1624,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
}
FiosFreeSavegameList();
- CLRBIT(_no_scroll, SCROLL_SAVE);
+ ClrBit(_no_scroll, SCROLL_SAVE);
break;
case WE_RESIZE: {
/* Widget 2 and 3 have to go with halve speed, make it so obiwan */
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index f1a2416f6..09f904ebd 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1738,7 +1738,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
case WE_DESTROY:
SendWindowMessage(WC_NEWS_WINDOW, 0, WE_DESTROY, 0, 0);
- CLRBIT(_no_scroll, SCROLL_CHAT);
+ ClrBit(_no_scroll, SCROLL_CHAT);
break;
}
}
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index d7c4abda2..eb462b706 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -949,7 +949,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
dts->ground_pal = grf_load_word(&buf);
if (dts->ground_sprite == 0) continue;
if (HasBit(dts->ground_pal, 15)) {
- CLRBIT(dts->ground_pal, 15);
+ ClrBit(dts->ground_pal, 15);
SETBIT(dts->ground_sprite, SPRITE_MODIFIER_USE_OFFSET);
}
@@ -972,16 +972,16 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
/* Remap flags as ours collide */
if (HasBit(dtss->pal, 15)) {
- CLRBIT(dtss->pal, 15);
+ ClrBit(dtss->pal, 15);
SETBIT(dtss->image, SPRITE_MODIFIER_USE_OFFSET);
}
if (HasBit(dtss->image, 15)) {
- CLRBIT(dtss->image, 15);
+ ClrBit(dtss->image, 15);
SETBIT(dtss->image, PALETTE_MODIFIER_COLOR);
}
if (HasBit(dtss->image, 14)) {
- CLRBIT(dtss->image, 14);
+ ClrBit(dtss->image, 14);
SETBIT(dtss->image, PALETTE_MODIFIER_TRANSPARENT);
}
}
@@ -1180,7 +1180,7 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int
}
/* Clear old color modifer bit */
- CLRBIT(image, 15);
+ ClrBit(image, 15);
bridge->sprite_table[tableid][sprite].sprite = image;
bridge->sprite_table[tableid][sprite].pal = pal;
@@ -1574,7 +1574,7 @@ static bool CargoChangeInfo(uint cid, int numinfo, int prop, byte **bufp, int le
cs->grfid = _cur_grffile->grfid;
SETBIT(_cargo_mask, cid + i);
} else {
- CLRBIT(_cargo_mask, cid + i);
+ ClrBit(_cargo_mask, cid + i);
}
break;
@@ -2583,15 +2583,15 @@ static void NewSpriteGroup(byte *buf, int len)
group->g.layout.dts->ground_pal = grf_load_word(&buf);
/* Remap transparent/colour modifier bits */
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);
}
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);
}
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);
}
if (HasBit(group->g.layout.dts->ground_pal, 15)) {
@@ -2599,7 +2599,7 @@ static void NewSpriteGroup(byte *buf, int len)
* last spriteset defined. */
SpriteID sprite = _cur_grffile->spriteset_start + GB(group->g.layout.dts->ground_sprite, 0, 14) * sprites;
SB(group->g.layout.dts->ground_sprite, 0, SPRITE_WIDTH, sprite);
- CLRBIT(group->g.layout.dts->ground_pal, 15);
+ ClrBit(group->g.layout.dts->ground_pal, 15);
}
group->g.layout.dts->seq = CallocT<DrawTileSeqStruct>(num_sprites + 1);
@@ -2613,15 +2613,15 @@ static void NewSpriteGroup(byte *buf, int len)
seq->delta_y = grf_load_byte(&buf);
if (HasBit(seq->image, 14)) {
- CLRBIT(seq->image, 14);
+ ClrBit(seq->image, 14);
SETBIT(seq->image, PALETTE_MODIFIER_TRANSPARENT);
}
if (HasBit(seq->image, 15)) {
- CLRBIT(seq->image, 15);
+ ClrBit(seq->image, 15);
SETBIT(seq->image, PALETTE_MODIFIER_COLOR);
}
if (HasBit(seq->pal, 14)) {
- CLRBIT(seq->pal, 14);
+ ClrBit(seq->pal, 14);
SETBIT(seq->image, SPRITE_MODIFIER_OPAQUE);
}
if (HasBit(seq->pal, 15)) {
@@ -2629,7 +2629,7 @@ static void NewSpriteGroup(byte *buf, int len)
* last spriteset defined. */
SpriteID sprite = _cur_grffile->spriteset_start + GB(seq->image, 0, 14) * sprites;
SB(seq->image, 0, SPRITE_WIDTH, sprite);
- CLRBIT(seq->pal, 15);
+ ClrBit(seq->pal, 15);
}
if (type > 0) {
@@ -3115,7 +3115,7 @@ static void FeatureNewName(byte *buf, int len)
bool generic = HasBit(lang, 7);
uint16 id = generic ? grf_load_word(&buf) : grf_load_byte(&buf);
- CLRBIT(lang, 7);
+ ClrBit(lang, 7);
if (feature <= GSF_AIRCRAFT && id < _vehcounts[feature]) {
id += _vehshifts[feature];
@@ -3257,7 +3257,7 @@ static void GraphicsNew(byte *buf, int len)
uint16 num = grf_load_extended(&buf);
uint16 skip_num = 0;
uint16 offset = HasBit(type, 7) ? grf_load_extended(&buf) : 0;
- CLRBIT(type, 7); // Clear the high bit as that only indicates whether there is an offset.
+ ClrBit(type, 7); // Clear the high bit as that only indicates whether there is an offset.
switch (type) {
case 0x04: // Signal graphics
@@ -3874,7 +3874,7 @@ static void GRFLoadError(byte *buf, int len)
grfmsg(7, "GRFLoadError: Skipping non-fatal GRFLoadError in stage %d", _cur_stage);
return;
}
- CLRBIT(severity, 7);
+ ClrBit(severity, 7);
if (severity >= lengthof(sevstr)) {
grfmsg(7, "GRFLoadError: Invalid severity id %d. Setting to 2 (non-fatal error).", severity);
@@ -4371,7 +4371,7 @@ static void FeatureTownName(byte *buf, int len)
if (HasBit(id, 7)) {
/* Final definition */
- CLRBIT(id, 7);
+ ClrBit(id, 7);
bool new_scheme = _cur_grffile->grf_version >= 7;
if (!check_length(len, 1, "FeatureTownName: lang_id")) return;
@@ -4380,7 +4380,7 @@ static void FeatureTownName(byte *buf, int len)
byte nb_gen = townname->nb_gen;
do {
- CLRBIT(lang, 7);
+ ClrBit(lang, 7);
if (!check_length(len, 1, "FeatureTownName: style name")) return;
const char *name = grf_load_string(&buf, len);
@@ -5607,7 +5607,7 @@ void LoadNewGRF(uint load_index, uint file_index)
if (stage == GLS_RESERVE) {
SETBIT(c->flags, GCF_RESERVED);
} else if (stage == GLS_ACTIVATION) {
- CLRBIT(c->flags, GCF_RESERVED);
+ ClrBit(c->flags, GCF_RESERVED);
ClearTemporaryNewGRFData();
BuildCargoTranslationMap();
DEBUG(sprite, 2, "LoadNewGRF: Currently %i sprites are loaded", _cur_spriteid);
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index dda46f74d..4d9de7489 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -136,7 +136,7 @@ GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_o
if (src->error->custom_message != NULL) c->error->custom_message = strdup(src->error->custom_message);
}
- CLRBIT(c->flags, GCF_INIT_ONLY);
+ ClrBit(c->flags, GCF_INIT_ONLY);
if (init_only) SETBIT(c->flags, GCF_INIT_ONLY);
*dst = c;
diff --git a/src/npf.h b/src/npf.h
index f0ec75ac3..ad30adf8c 100644
--- a/src/npf.h
+++ b/src/npf.h
@@ -123,7 +123,7 @@ static inline void NPFSetFlag(AyStarNode* node, NPFNodeFlag flag, bool value)
if (value)
SETBIT(node->user_data[NPF_NODE_FLAGS], flag);
else
- CLRBIT(node->user_data[NPF_NODE_FLAGS], flag);
+ ClrBit(node->user_data[NPF_NODE_FLAGS], flag);
}
#endif /* NPF_H */
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index 885c4c824..3944bc284 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -333,7 +333,7 @@ static void FixOldVehicles()
if (v->type == VEH_ROAD &&
v->u.road.state != RVSB_IN_DEPOT &&
v->u.road.state != RVSB_WORMHOLE) {
- CLRBIT(v->u.road.state, RVS_IS_STOPPING);
+ ClrBit(v->u.road.state, RVS_IS_STOPPING);
}
FOR_ALL_VEHICLES_FROM(u, v->index + 1) {
diff --git a/src/openttd.cpp b/src/openttd.cpp
index ee4796826..7dfc91b6e 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1536,8 +1536,8 @@ bool AfterLoadGame()
SB(_m[t].m2, 0, 4, tmp);
} else if (HasBit(_m[t].m5, 2)) {
/* Split waypoint and depot rail type and remove the subtype. */
- CLRBIT(_m[t].m5, 2);
- CLRBIT(_m[t].m5, 6);
+ ClrBit(_m[t].m5, 2);
+ ClrBit(_m[t].m5, 6);
}
break;
@@ -1776,23 +1776,23 @@ bool AfterLoadGame()
/* move the signal variant back */
SetSignalVariant(t, TRACK_X, HasBit(_m[t].m2, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC);
- CLRBIT(_m[t].m2, 3);
+ ClrBit(_m[t].m2, 3);
}
/* Clear PBS reservation on track */
if (!IsTileDepotType(t, TRANSPORT_RAIL)) {
SB(_m[t].m4, 4, 4, 0);
} else {
- CLRBIT(_m[t].m3, 6);
+ ClrBit(_m[t].m3, 6);
}
break;
case MP_ROAD: /* Clear PBS reservation on crossing */
- if (IsLevelCrossing(t)) CLRBIT(_m[t].m5, 0);
+ if (IsLevelCrossing(t)) ClrBit(_m[t].m5, 0);
break;
case MP_STATION: /* Clear PBS reservation on station */
- CLRBIT(_m[t].m3, 6);
+ ClrBit(_m[t].m3, 6);
break;
default: break;
@@ -1939,11 +1939,11 @@ bool AfterLoadGame()
/* The "lift has destination" bit has been moved from
* m5[7] to m7[0]. */
SB(_me[t].m7, 0, 1, HasBit(_m[t].m5, 7));
- CLRBIT(_m[t].m5, 7);
+ ClrBit(_m[t].m5, 7);
/* The "lift is moving" bit has been removed, as it does
* the same job as the "lift has destination" bit. */
- CLRBIT(_m[t].m1, 7);
+ ClrBit(_m[t].m1, 7);
/* The position of the lift goes from m1[7..0] to m6[7..2],
* making m1 totally free, now. The lift position does not
@@ -2039,7 +2039,7 @@ bool AfterLoadGame()
CargoPacket *cp = *it;
cp->paid_for = HasBit(v->vehicle_flags, 2);
}
- CLRBIT(v->vehicle_flags, 2);
+ ClrBit(v->vehicle_flags, 2);
v->cargo.InvalidateCache();
}
}
@@ -2101,7 +2101,7 @@ bool AfterLoadGame()
/* The loading finished flag is *only* set when actually completely
* finished. Because the vehicle is loading, it is not finished. */
- CLRBIT(v->vehicle_flags, VF_LOADING_FINISHED);
+ ClrBit(v->vehicle_flags, VF_LOADING_FINISHED);
}
}
} else if (CheckSavegameVersion(59)) {
@@ -2136,7 +2136,7 @@ bool AfterLoadGame()
SetSignalStates(t, GB(_m[t].m2, 4, 4));
SetSignalVariant(t, INVALID_TRACK, GetSignalVariant(t, TRACK_X));
SetSignalType(t, INVALID_TRACK, GetSignalType(t, TRACK_X));
- CLRBIT(_m[t].m2, 7);
+ ClrBit(_m[t].m2, 7);
}
}
}
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index bcc458fa0..c342164bf 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -686,11 +686,11 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
switch (p2) {
case OFB_FULL_LOAD:
TOGGLEBIT(order->flags, OFB_FULL_LOAD);
- if (order->type != OT_GOTO_DEPOT) CLRBIT(order->flags, OFB_UNLOAD);
+ if (order->type != OT_GOTO_DEPOT) ClrBit(order->flags, OFB_UNLOAD);
break;
case OFB_UNLOAD:
TOGGLEBIT(order->flags, OFB_UNLOAD);
- CLRBIT(order->flags, OFB_FULL_LOAD);
+ ClrBit(order->flags, OFB_FULL_LOAD);
break;
case OFB_NON_STOP:
TOGGLEBIT(order->flags, OFB_NON_STOP);
diff --git a/src/rail.h b/src/rail.h
index 4503b0a94..b24714f9d 100644
--- a/src/rail.h
+++ b/src/rail.h
@@ -312,7 +312,7 @@ static inline Track RemoveFirstTrack(TrackBits *tracks)
{
if (*tracks != TRACK_BIT_NONE && *tracks != INVALID_TRACK_BIT) {
Track first = (Track)FIND_FIRST_BIT(*tracks);
- ClrBitT(*tracks, first);
+ ClrBit(*tracks, first);
return first;
}
return INVALID_TRACK;
@@ -336,7 +336,7 @@ static inline Trackdir RemoveFirstTrackdir(TrackdirBits *trackdirs)
{
if (*trackdirs != TRACKDIR_BIT_NONE && *trackdirs != INVALID_TRACKDIR_BIT) {
Trackdir first = (Trackdir)FindFirstBit2x64(*trackdirs);
- ClrBitT(*trackdirs, first);
+ ClrBit(*trackdirs, first);
return first;
}
return INVALID_TRACKDIR;
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 19895e230..e9422b21d 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -685,7 +685,7 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, uint32 flags, uint32 p1, u
*/
CommandCost CmdBuildRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- return CmdRailTrackHelper(tile, flags, p1, CLRBIT(p2, 7));
+ return CmdRailTrackHelper(tile, flags, p1, ClrBit(p2, 7));
}
/** Build rail on a stretch of track.
@@ -895,7 +895,7 @@ static bool CheckSignalAutoFill(TileIndex &tile, Trackdir &trackdir, int &signal
if (IsDiagonalTrackdir(trackdir)) {
signal_ctr++;
/* Ensure signal_ctr even so X and Y pieces get signals */
- CLRBIT(signal_ctr, 0);
+ ClrBit(signal_ctr, 0);
}
return true;
diff --git a/src/road_map.h b/src/road_map.h
index f68ef8322..99aef132e 100644
--- a/src/road_map.h
+++ b/src/road_map.h
@@ -194,7 +194,7 @@ static inline TrackBits GetCrossingRailBits(TileIndex tile)
static inline void UnbarCrossing(TileIndex t)
{
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING);
- CLRBIT(_m[t].m4, 5);
+ ClrBit(_m[t].m4, 5);
}
static inline void BarCrossing(TileIndex t)
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index cd4d0a572..93ab47985 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -481,7 +481,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
- CLRBIT(v->current_order.flags, OFB_PART_OF_ORDERS);
+ ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS);
TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
@@ -1657,7 +1657,7 @@ again:
* For drive-through stops, only do it if the vehicle stopped here */
if (IsStandardRoadStopTile(v->tile) || HasBit(v->u.road.state, RVS_IS_STOPPING)) {
rs->FreeBay(HasBit(v->u.road.state, RVS_USING_SECOND_BAY));
- CLRBIT(v->u.road.state, RVS_IS_STOPPING);
+ ClrBit(v->u.road.state, RVS_IS_STOPPING);
}
if (IsStandardRoadStopTile(v->tile)) rs->SetEntranceBusy(false);
}
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 331f91cbb..5cae48f59 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -1009,7 +1009,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
- CLRBIT(v->current_order.flags, OFB_PART_OF_ORDERS);
+ ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS);
TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 440749743..79eca1899 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -276,7 +276,7 @@ static void QuerySignEditWndProc(Window *w, WindowEvent *e)
break;
case WE_DESTROY:
- CLRBIT(_no_scroll, SCROLL_EDIT);
+ ClrBit(_no_scroll, SCROLL_EDIT);
break;
}
}
diff --git a/src/station.cpp b/src/station.cpp
index a00fc232b..4eb56a776 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -455,7 +455,7 @@ uint RoadStop::AllocateBay()
uint bay_nr = 0;
while (!HasBit(status, bay_nr)) bay_nr++;
- CLRBIT(status, bay_nr);
+ ClrBit(status, bay_nr);
return bay_nr;
}
@@ -466,7 +466,7 @@ uint RoadStop::AllocateBay()
void RoadStop::AllocateDriveThroughBay(uint nr)
{
assert(nr < MAX_BAY_COUNT);
- CLRBIT(status, nr);
+ ClrBit(status, nr);
}
/**
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index bd6129d28..8e63b1a89 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -262,7 +262,7 @@ static bool GenerateStationName(Station *st, TileIndex tile, int flag)
if (str <= 0x20) {
if (str == M(STR_SV_STNAME_FOREST))
str = M(STR_SV_STNAME_WOODS);
- CLRBIT(free_names, str);
+ ClrBit(free_names, str);
}
}
}
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index b5ebecff8..ceb82bd26 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -122,7 +122,7 @@ CommandCost CmdAutofillTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32
/* Start autofilling the timetable, which clears all the current
* timings and clears the "timetable has started" bit. */
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) {
order->wait_time = 0;
@@ -132,7 +132,7 @@ CommandCost CmdAutofillTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32
v->current_order.wait_time = 0;
v->current_order.travel_time = 0;
} else {
- CLRBIT(v->vehicle_flags, VF_AUTOFILL_TIMETABLE);
+ ClrBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE);
}
}
@@ -173,7 +173,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
} else if (v->cur_order_index == 0) {
/* Otherwise if we're at the beginning and it already has a value,
* assume that autofill is finished and turn it off again. */
- CLRBIT(v->vehicle_flags, VF_AUTOFILL_TIMETABLE);
+ ClrBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE);
}
}
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 464685635..76677f9e2 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1849,9 +1849,9 @@ void ClearTownHouse(Town *t, TileIndex tile)
/* Clear flags for houses that only may exist once/town. */
if (hs->building_flags & BUILDING_IS_CHURCH) {
- CLRBIT(t->flags12, TOWN_HAS_CHURCH);
+ ClrBit(t->flags12, TOWN_HAS_CHURCH);
} else if (hs->building_flags & BUILDING_IS_STADIUM) {
- CLRBIT(t->flags12, TOWN_HAS_STADIUM);
+ ClrBit(t->flags12, TOWN_HAS_STADIUM);
}
/* Do the actual clearing of tiles */
@@ -2140,7 +2140,7 @@ static void UpdateTownGrowRate(Town *t)
}
}
- CLRBIT(t->flags12, TOWN_IS_FUNDED);
+ ClrBit(t->flags12, TOWN_IS_FUNDED);
if (_patches.town_growth_rate == 0 && t->fund_buildings_months == 0) return;
/** Towns are processed every TOWN_GROWTH_FREQUENCY ticks, and this is the
diff --git a/src/train.h b/src/train.h
index 653ba2543..43fc7b9ae 100644
--- a/src/train.h
+++ b/src/train.h
@@ -50,7 +50,7 @@ static inline void SetFrontEngine(Vehicle *v)
static inline void ClearFrontEngine(Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- CLRBIT(v->subtype, Train_Front);
+ ClrBit(v->subtype, Train_Front);
}
/** Check if a vehicle is an articulated part of an engine
@@ -78,7 +78,7 @@ static inline void SetArticulatedPart(Vehicle *v)
static inline void ClearArticulatedPart(Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- CLRBIT(v->subtype, Train_Articulated_Part);
+ ClrBit(v->subtype, Train_Articulated_Part);
}
/** Check if a vehicle is a wagon
@@ -106,7 +106,7 @@ static inline void SetTrainWagon(Vehicle *v)
static inline void ClearTrainWagon(Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- CLRBIT(v->subtype, Train_Wagon);
+ ClrBit(v->subtype, Train_Wagon);
}
/** Check if a vehicle is an engine (can be first in a train)
@@ -134,7 +134,7 @@ static inline void SetTrainEngine(Vehicle *v)
static inline void ClearTrainEngine(Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- CLRBIT(v->subtype, Train_Engine);
+ ClrBit(v->subtype, Train_Engine);
}
/** Check if a vehicle is a free wagon (got no engine in front of it)
@@ -162,7 +162,7 @@ static inline void SetFreeWagon(Vehicle *v)
static inline void ClearFreeWagon(Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- CLRBIT(v->subtype, Train_Free_Wagon);
+ ClrBit(v->subtype, Train_Free_Wagon);
}
/** Check if a vehicle is a multiheaded engine
@@ -190,7 +190,7 @@ static inline void SetMultiheaded(Vehicle *v)
static inline void ClearMultiheaded(Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- CLRBIT(v->subtype, Train_Multiheaded);
+ ClrBit(v->subtype, Train_Multiheaded);
}
/** Check if an engine has an articulated part.
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 03e5068ac..99db615fe 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -208,7 +208,7 @@ void TrainConsistChanged(Vehicle* v)
/* wagon is powered */
SETBIT(u->u.rail.flags, VRF_POWEREDWAGON); // cache 'powered' status
} else {
- CLRBIT(u->u.rail.flags, VRF_POWEREDWAGON);
+ ClrBit(u->u.rail.flags, VRF_POWEREDWAGON);
}
/* Do not count powered wagons for the compatible railtypes, as wagons always
@@ -1458,10 +1458,10 @@ static void SwapTrainFlags(byte *swap_flag1, byte *swap_flag2)
byte flag2 = *swap_flag2;
/* Clear the flags */
- CLRBIT(*swap_flag1, VRF_GOINGUP);
- CLRBIT(*swap_flag1, VRF_GOINGDOWN);
- CLRBIT(*swap_flag2, VRF_GOINGUP);
- CLRBIT(*swap_flag2, VRF_GOINGDOWN);
+ ClrBit(*swap_flag1, VRF_GOINGUP);
+ ClrBit(*swap_flag1, VRF_GOINGDOWN);
+ ClrBit(*swap_flag2, VRF_GOINGUP);
+ ClrBit(*swap_flag2, VRF_GOINGDOWN);
/* Reverse the rail-flags (if needed) */
if (HasBit(flag1, VRF_GOINGUP)) {
@@ -1620,7 +1620,7 @@ static void ReverseTrainDirection(Vehicle *v)
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
}
- CLRBIT(v->u.rail.flags, VRF_REVERSING);
+ ClrBit(v->u.rail.flags, VRF_REVERSING);
}
/** Reverse train.
@@ -1907,7 +1907,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
- CLRBIT(v->current_order.flags, OFB_PART_OF_ORDERS);
+ ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS);
TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
@@ -2277,7 +2277,7 @@ static Track ChooseTrainTrack(Vehicle* v, TileIndex tile, DiagDirection enterdir
/* route found, is the train marked with "path not found" flag? */
if (HasBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) {
/* clear the flag as the PF's problem was solved */
- CLRBIT(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION);
+ ClrBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION);
/* can we also delete the "News" item somehow? */
}
}
@@ -2553,8 +2553,8 @@ static byte AfterSetTrainPos(Vehicle *v, bool new_tile)
v->z_pos = GetSlopeZ(v->x_pos, v->y_pos);
if (new_tile) {
- CLRBIT(v->u.rail.flags, VRF_GOINGUP);
- CLRBIT(v->u.rail.flags, VRF_GOINGDOWN);
+ ClrBit(v->u.rail.flags, VRF_GOINGUP);
+ ClrBit(v->u.rail.flags, VRF_GOINGDOWN);
if (v->u.rail.track == TRACK_BIT_X || v->u.rail.track == TRACK_BIT_Y) {
/* Any track that isn't TRACK_BIT_X or TRACK_BIT_Y cannot be sloped.
@@ -3538,7 +3538,7 @@ void ConvertOldMultiheadToNew()
BEGIN_ENUM_WAGONS(u) {
const RailVehicleInfo *rvi = RailVehInfo(u->engine_type);
- CLRBIT(u->subtype, 7);
+ ClrBit(u->subtype, 7);
switch (u->subtype) {
case 0: /* TS_Front_Engine */
if (rvi->railveh_type == RAILVEH_MULTIHEAD) SetMultiheaded(u);
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 7a6ba1f30..3d2b1af2c 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -1485,8 +1485,8 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y
}
if (v->type == VEH_TRAIN) {
v->u.rail.track = TRACK_BIT_WORMHOLE;
- CLRBIT(v->u.rail.flags, VRF_GOINGUP);
- CLRBIT(v->u.rail.flags, VRF_GOINGDOWN);
+ ClrBit(v->u.rail.flags, VRF_GOINGUP);
+ ClrBit(v->u.rail.flags, VRF_GOINGDOWN);
} else {
v->u.road.state = RVSB_WORMHOLE;
}
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index f711e8aab..66da42d78 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -218,7 +218,7 @@ static CommandCost ClearTile_Unmovable(TileIndex tile, byte flags)
if (IsStatue(tile)) {
TownID town = GetStatueTownID(tile);
- CLRBIT(GetTown(town)->statues, _current_player);
+ ClrBit(GetTown(town)->statues, _current_player);
InvalidateWindow(WC_TOWN_AUTHORITY, town);
}
diff --git a/src/viewport.cpp b/src/viewport.cpp
index dde8a7fe8..57f09c926 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -163,7 +163,7 @@ void InitViewports()
void DeleteWindowViewport(Window *w)
{
- CLRBIT(_active_viewports, w->viewport - _viewports);
+ ClrBit(_active_viewports, w->viewport - _viewports);
w->viewport->width = 0;
w->viewport = NULL;
}