mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-26 13:44:16 +01:00
Codechange: Use EnumBitSet for BuildingFlags.
This commit is contained in:
committed by
Peter Nelson
parent
113205c540
commit
95bd53ddf1
@@ -1435,15 +1435,15 @@ void DrawHouseInGUI(int x, int y, HouseID house_id, int view)
|
||||
int y_delta = ScaleGUITrad(TILE_PIXELS / 2);
|
||||
|
||||
const HouseSpec *hs = HouseSpec::Get(house_id);
|
||||
if (hs->building_flags & TILE_SIZE_2x2) {
|
||||
if (hs->building_flags.Test(BuildingFlag::Size2x2)) {
|
||||
draw(x, y - y_delta - y_delta, house_id, view); // North corner.
|
||||
draw(x + x_delta, y - y_delta, house_id + 1, view); // West corner.
|
||||
draw(x - x_delta, y - y_delta, house_id + 2, view); // East corner.
|
||||
draw(x, y, house_id + 3, view); // South corner.
|
||||
} else if (hs->building_flags & TILE_SIZE_2x1) {
|
||||
} else if (hs->building_flags.Test(BuildingFlag::Size2x1)) {
|
||||
draw(x + x_delta / 2, y - y_delta, house_id, view); // North east tile.
|
||||
draw(x - x_delta / 2, y, house_id + 1, view); // South west tile.
|
||||
} else if (hs->building_flags & TILE_SIZE_1x2) {
|
||||
} else if (hs->building_flags.Test(BuildingFlag::Size1x2)) {
|
||||
draw(x - x_delta / 2, y - y_delta, house_id, view); // North west tile.
|
||||
draw(x + x_delta / 2, y, house_id + 1, view); // South east tile.
|
||||
} else {
|
||||
@@ -1643,13 +1643,13 @@ struct BuildHouseWindow : public PickerWindow {
|
||||
ResetObjectToPlace();
|
||||
} else {
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_TOWN, PAL_NONE, HT_RECT | HT_DIAGONAL, this);
|
||||
if (spec->building_flags & TILE_SIZE_2x2) {
|
||||
if (spec->building_flags.Test(BuildingFlag::Size2x2)) {
|
||||
SetTileSelectSize(2, 2);
|
||||
} else if (spec->building_flags & TILE_SIZE_2x1) {
|
||||
} else if (spec->building_flags.Test(BuildingFlag::Size2x1)) {
|
||||
SetTileSelectSize(2, 1);
|
||||
} else if (spec->building_flags & TILE_SIZE_1x2) {
|
||||
} else if (spec->building_flags.Test(BuildingFlag::Size1x2)) {
|
||||
SetTileSelectSize(1, 2);
|
||||
} else if (spec->building_flags & TILE_SIZE_1x1) {
|
||||
} else if (spec->building_flags.Test(BuildingFlag::Size1x1)) {
|
||||
SetTileSelectSize(1, 1);
|
||||
}
|
||||
}
|
||||
@@ -1700,10 +1700,10 @@ struct BuildHouseWindow : public PickerWindow {
|
||||
line << "\n";
|
||||
|
||||
uint8_t size = 0;
|
||||
if ((hs->building_flags & TILE_SIZE_1x1) != 0) size = 0x11;
|
||||
if ((hs->building_flags & TILE_SIZE_2x1) != 0) size = 0x21;
|
||||
if ((hs->building_flags & TILE_SIZE_1x2) != 0) size = 0x12;
|
||||
if ((hs->building_flags & TILE_SIZE_2x2) != 0) size = 0x22;
|
||||
if (hs->building_flags.Test(BuildingFlag::Size1x1)) size = 0x11;
|
||||
if (hs->building_flags.Test(BuildingFlag::Size2x1)) size = 0x21;
|
||||
if (hs->building_flags.Test(BuildingFlag::Size1x2)) size = 0x12;
|
||||
if (hs->building_flags.Test(BuildingFlag::Size2x2)) size = 0x22;
|
||||
SetDParam(0, GB(size, 0, 4));
|
||||
SetDParam(1, GB(size, 4, 4));
|
||||
line << GetString(STR_HOUSE_PICKER_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user