mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r11482) -Codechange: Remove the doubled function ClrBitT and rename the remaining to fit with the naming style
This commit is contained in:
parent
71c4325c50
commit
5c31a973a1
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
12
src/train.h
12
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.
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user