diff options
-rw-r--r-- | disaster_cmd.c | 4 | ||||
-rw-r--r-- | economy.c | 4 | ||||
-rw-r--r-- | player_gui.c | 2 | ||||
-rw-r--r-- | rail_cmd.c | 4 | ||||
-rw-r--r-- | station_cmd.c | 4 | ||||
-rw-r--r-- | tunnelbridge_cmd.c | 4 | ||||
-rw-r--r-- | widget.c | 4 |
7 files changed, 13 insertions, 13 deletions
diff --git a/disaster_cmd.c b/disaster_cmd.c index 601bc641e..1f4c72098 100644 --- a/disaster_cmd.c +++ b/disaster_cmd.c @@ -666,7 +666,7 @@ static void DisasterTick_5_and_6(Vehicle *v) return; } - v->direction = (v->direction + ((Random()&1)?2:-2))&7; + v->direction = (v->direction + (GB(Random(), 0, 1) ? 2 : -2)) & 7; } @@ -902,9 +902,9 @@ static void Disaster6_Init(void) static void Disaster7_Init(void) { + int index = GB(Random(), 0, 4); Industry *i; int maxloop = 15; - int index = Random() & 0xF; do { FOR_ALL_INDUSTRIES(i) { @@ -694,10 +694,10 @@ static void HandleEconomyFluctuations(void) if (_opt.diff.economy == 0) return; if (--_economy.fluct == 0) { - _economy.fluct = - (int)(Random()&3); + _economy.fluct = -(int)GB(Random(), 0, 2); AddNewsItem(STR_7073_WORLD_RECESSION_FINANCIAL, NEWS_FLAGS(NM_NORMAL,0,NT_ECONOMY,0), 0, 0); } else if (_economy.fluct == -12) { - _economy.fluct = (Random()&255) + 312; + _economy.fluct = GB(Random(), 0, 8) + 312; AddNewsItem(STR_7074_RECESSION_OVER_UPTURN_IN, NEWS_FLAGS(NM_NORMAL,0,NT_ECONOMY,0), 0, 0); } } diff --git a/player_gui.c b/player_gui.c index eba18b143..3d97a2612 100644 --- a/player_gui.c +++ b/player_gui.c @@ -342,7 +342,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e) SetWindowDirty(w); break; case 7: - WP(w,facesel_d).face = (InteractiveRandom() & 0x7FFFFFFF) + (WP(w,facesel_d).gender << 31); + WP(w,facesel_d).face = (WP(w,facesel_d).gender << 31) + GB(InteractiveRandom(), 0, 31); SetWindowDirty(w); break; } diff --git a/rail_cmd.c b/rail_cmd.c index 9b39295b8..45021856a 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -2064,8 +2064,8 @@ static void TileLoop_Track(TileIndex tile) modify_me:; /* tile changed? */ - if ( m2 != a2) { - _m[tile].m2 = (_m[tile].m2 & ~RAIL_MAP2LO_GROUND_MASK) | a2; + if (m2 != a2) { + SB(_m[tile].m2, 0, 4, a2); MarkTileDirtyByTile(tile); } } diff --git a/station_cmd.c b/station_cmd.c index e037e5081..2c98db257 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -3016,8 +3016,8 @@ static void Load_STNS(void) // this means it's an oldstyle savegame without support for nonuniform stations if (st->train_tile != 0 && st->trainst_h == 0) { - int w = st->trainst_w >> 4; - int h = st->trainst_w & 0xF; + int w = GB(st->trainst_w, 4, 4); + int h = GB(st->trainst_w, 0, 4); if (_m[st->train_tile].m5 & 1) intswap(w, h); st->trainst_w = w; diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index ff8791f0f..b37de5511 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -964,7 +964,7 @@ static void DrawBridgePillars(const TileInfo *ti, int x, int y, int z) // Draw first piece // (necessary for cantilever bridges) - image = b[12 + (ti->map5&0x01)]; + image = b[12 + GB(ti->map5, 0, 1)]; piece = GetBridgePiece(ti->tile); if (image != 0 && piece != 0) { @@ -972,7 +972,7 @@ static void DrawBridgePillars(const TileInfo *ti, int x, int y, int z) DrawGroundSpriteAt(image, x, y, z); } - image = b[(ti->map5&0x01)*6 + piece]; + image = b[GB(ti->map5, 0, 1) * 6 + piece]; if (image != 0) { int back_height, front_height, i=z; @@ -223,10 +223,10 @@ void DrawWindowWidgets(const Window *w) DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); - c = (wi->unkA&0xFF); + c = GB(wi->unkA, 0, 8); amt1 = (wi->right - wi->left + 1) / c; - d = (wi->unkA >> 8); + d = GB(wi->unkA, 8, 8); amt2 = (wi->bottom - wi->top + 1) / d; color = _color_list[wi->color & 0xF].window_color_bgb; |