comparison src/openttd.cpp @ 7928:4e8dfd103163 draft

(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
author skidd13 <skidd13@openttd.org>
date Mon, 19 Nov 2007 21:02:30 +0000
parents ff1975ced735
children 4d13dbed828c
comparison
equal deleted inserted replaced
7927:09dbacdca8de 7928:4e8dfd103163
1131 } 1131 }
1132 #else 1132 #else
1133 StateGameLoop(); 1133 StateGameLoop();
1134 #endif /* ENABLE_NETWORK */ 1134 #endif /* ENABLE_NETWORK */
1135 1135
1136 if (!_pause_game && HASBIT(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations(); 1136 if (!_pause_game && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations();
1137 1137
1138 if (!_pause_game || _cheats.build_in_pause.value) MoveAllTextEffects(); 1138 if (!_pause_game || _cheats.build_in_pause.value) MoveAllTextEffects();
1139 1139
1140 InputLoop(); 1140 InputLoop();
1141 1141
1158 TileIndex tile; 1158 TileIndex tile;
1159 1159
1160 for (tile = 0; tile != MapSize(); tile++) { 1160 for (tile = 0; tile != MapSize(); tile++) {
1161 switch (GetTileType(tile)) { 1161 switch (GetTileType(tile)) {
1162 case MP_ROAD: 1162 case MP_ROAD:
1163 if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HASBIT(_m[tile].m4, 7)) { 1163 if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HasBit(_m[tile].m4, 7)) {
1164 _m[tile].m4 = OWNER_TOWN; 1164 _m[tile].m4 = OWNER_TOWN;
1165 } 1165 }
1166 /* FALLTHROUGH */ 1166 /* FALLTHROUGH */
1167 1167
1168 case MP_TUNNELBRIDGE: 1168 case MP_TUNNELBRIDGE:
1373 case MP_WATER: 1373 case MP_WATER:
1374 if (GetWaterTileType(t) == WATER_TILE_LOCK && GetTileOwner(t) == OWNER_WATER) SetTileOwner(t, OWNER_NONE); 1374 if (GetWaterTileType(t) == WATER_TILE_LOCK && GetTileOwner(t) == OWNER_WATER) SetTileOwner(t, OWNER_NONE);
1375 break; 1375 break;
1376 1376
1377 case MP_STATION: { 1377 case MP_STATION: {
1378 if (HASBIT(_m[t].m6, 3)) SETBIT(_m[t].m6, 2); 1378 if (HasBit(_m[t].m6, 3)) SETBIT(_m[t].m6, 2);
1379 StationGfx gfx = GetStationGfx(t); 1379 StationGfx gfx = GetStationGfx(t);
1380 StationType st; 1380 StationType st;
1381 if ( IS_INT_INSIDE(gfx, 0, 8)) { // Railway station 1381 if ( IS_INT_INSIDE(gfx, 0, 8)) { // Railway station
1382 st = STATION_RAIL; 1382 st = STATION_RAIL;
1383 SetStationGfx(t, gfx - 0); 1383 SetStationGfx(t, gfx - 0);
1532 /* Swap ground type and signal type for plain rail tiles, so the 1532 /* Swap ground type and signal type for plain rail tiles, so the
1533 * ground type uses the same bits as for depots and waypoints. */ 1533 * ground type uses the same bits as for depots and waypoints. */
1534 uint tmp = GB(_m[t].m4, 0, 4); 1534 uint tmp = GB(_m[t].m4, 0, 4);
1535 SB(_m[t].m4, 0, 4, GB(_m[t].m2, 0, 4)); 1535 SB(_m[t].m4, 0, 4, GB(_m[t].m2, 0, 4));
1536 SB(_m[t].m2, 0, 4, tmp); 1536 SB(_m[t].m2, 0, 4, tmp);
1537 } else if (HASBIT(_m[t].m5, 2)) { 1537 } else if (HasBit(_m[t].m5, 2)) {
1538 /* Split waypoint and depot rail type and remove the subtype. */ 1538 /* Split waypoint and depot rail type and remove the subtype. */
1539 CLRBIT(_m[t].m5, 2); 1539 CLRBIT(_m[t].m5, 2);
1540 CLRBIT(_m[t].m5, 6); 1540 CLRBIT(_m[t].m5, 6);
1541 } 1541 }
1542 break; 1542 break;
1578 if (IsRoadStop(t)) SetRoadTypes(t, ROADTYPES_ROAD); 1578 if (IsRoadStop(t)) SetRoadTypes(t, ROADTYPES_ROAD);
1579 break; 1579 break;
1580 1580
1581 case MP_TUNNELBRIDGE: 1581 case MP_TUNNELBRIDGE:
1582 /* Middle part of "old" bridges */ 1582 /* Middle part of "old" bridges */
1583 if (old_bridge && IsBridgeTile(t) && HASBIT(_m[t].m5, 6)) break; 1583 if (old_bridge && IsBridgeTile(t) && HasBit(_m[t].m5, 6)) break;
1584 if ((IsTunnel(t) ? GetTunnelTransportType(t) : (old_bridge ? (TransportType)GB(_m[t].m5, 1, 2) : GetBridgeTransportType(t))) == TRANSPORT_ROAD) { 1584 if ((IsTunnel(t) ? GetTunnelTransportType(t) : (old_bridge ? (TransportType)GB(_m[t].m5, 1, 2) : GetBridgeTransportType(t))) == TRANSPORT_ROAD) {
1585 SetRoadTypes(t, ROADTYPES_ROAD); 1585 SetRoadTypes(t, ROADTYPES_ROAD);
1586 } 1586 }
1587 break; 1587 break;
1588 1588
1595 Vehicle* v; 1595 Vehicle* v;
1596 1596
1597 for (TileIndex t = 0; t < map_size; t++) { 1597 for (TileIndex t = 0; t < map_size; t++) {
1598 if (MayHaveBridgeAbove(t)) ClearBridgeMiddle(t); 1598 if (MayHaveBridgeAbove(t)) ClearBridgeMiddle(t);
1599 if (IsBridgeTile(t)) { 1599 if (IsBridgeTile(t)) {
1600 if (HASBIT(_m[t].m5, 6)) { // middle part 1600 if (HasBit(_m[t].m5, 6)) { // middle part
1601 Axis axis = (Axis)GB(_m[t].m5, 0, 1); 1601 Axis axis = (Axis)GB(_m[t].m5, 0, 1);
1602 1602
1603 if (HASBIT(_m[t].m5, 5)) { // transport route under bridge? 1603 if (HasBit(_m[t].m5, 5)) { // transport route under bridge?
1604 if (GB(_m[t].m5, 3, 2) == TRANSPORT_RAIL) { 1604 if (GB(_m[t].m5, 3, 2) == TRANSPORT_RAIL) {
1605 MakeRailNormal( 1605 MakeRailNormal(
1606 t, 1606 t,
1607 GetTileOwner(t), 1607 GetTileOwner(t),
1608 axis == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X, 1608 axis == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X,
1736 1736
1737 FOR_ALL_WAYPOINTS(wp) { 1737 FOR_ALL_WAYPOINTS(wp) {
1738 if (wp->deleted == 0) { 1738 if (wp->deleted == 0) {
1739 const StationSpec *statspec = NULL; 1739 const StationSpec *statspec = NULL;
1740 1740
1741 if (HASBIT(_m[wp->xy].m3, 4)) 1741 if (HasBit(_m[wp->xy].m3, 4))
1742 statspec = GetCustomStationSpec(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1); 1742 statspec = GetCustomStationSpec(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1);
1743 1743
1744 if (statspec != NULL) { 1744 if (statspec != NULL) {
1745 wp->stat_id = _m[wp->xy].m4 + 1; 1745 wp->stat_id = _m[wp->xy].m4 + 1;
1746 wp->grfid = statspec->grffile->grfid; 1746 wp->grfid = statspec->grffile->grfid;
1770 for (TileIndex t = 0; t < map_size; t++) { 1770 for (TileIndex t = 0; t < map_size; t++) {
1771 switch (GetTileType(t)) { 1771 switch (GetTileType(t)) {
1772 case MP_RAILWAY: 1772 case MP_RAILWAY:
1773 if (HasSignals(t)) { 1773 if (HasSignals(t)) {
1774 /* convert PBS signals to combo-signals */ 1774 /* convert PBS signals to combo-signals */
1775 if (HASBIT(_m[t].m2, 2)) SetSignalType(t, TRACK_X, SIGTYPE_COMBO); 1775 if (HasBit(_m[t].m2, 2)) SetSignalType(t, TRACK_X, SIGTYPE_COMBO);
1776 1776
1777 /* move the signal variant back */ 1777 /* move the signal variant back */
1778 SetSignalVariant(t, TRACK_X, HASBIT(_m[t].m2, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC); 1778 SetSignalVariant(t, TRACK_X, HasBit(_m[t].m2, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC);
1779 CLRBIT(_m[t].m2, 3); 1779 CLRBIT(_m[t].m2, 3);
1780 } 1780 }
1781 1781
1782 /* Clear PBS reservation on track */ 1782 /* Clear PBS reservation on track */
1783 if (!IsTileDepotType(t, TRANSPORT_RAIL)) { 1783 if (!IsTileDepotType(t, TRANSPORT_RAIL)) {
1936 /* The "house is completed" bit is now in m6[2]. */ 1936 /* The "house is completed" bit is now in m6[2]. */
1937 SetHouseCompleted(t, false); 1937 SetHouseCompleted(t, false);
1938 } else { 1938 } else {
1939 /* The "lift has destination" bit has been moved from 1939 /* The "lift has destination" bit has been moved from
1940 * m5[7] to m7[0]. */ 1940 * m5[7] to m7[0]. */
1941 SB(_me[t].m7, 0, 1, HASBIT(_m[t].m5, 7)); 1941 SB(_me[t].m7, 0, 1, HasBit(_m[t].m5, 7));
1942 CLRBIT(_m[t].m5, 7); 1942 CLRBIT(_m[t].m5, 7);
1943 1943
1944 /* The "lift is moving" bit has been removed, as it does 1944 /* The "lift is moving" bit has been removed, as it does
1945 * the same job as the "lift has destination" bit. */ 1945 * the same job as the "lift has destination" bit. */
1946 CLRBIT(_m[t].m1, 7); 1946 CLRBIT(_m[t].m1, 7);
2035 * amount of cargo that has been paid for is stored. */ 2035 * amount of cargo that has been paid for is stored. */
2036 FOR_ALL_VEHICLES(v) { 2036 FOR_ALL_VEHICLES(v) {
2037 const CargoList::List *packets = v->cargo.Packets(); 2037 const CargoList::List *packets = v->cargo.Packets();
2038 for (CargoList::List::const_iterator it = packets->begin(); it != packets->end(); it++) { 2038 for (CargoList::List::const_iterator it = packets->begin(); it != packets->end(); it++) {
2039 CargoPacket *cp = *it; 2039 CargoPacket *cp = *it;
2040 cp->paid_for = HASBIT(v->vehicle_flags, 2); 2040 cp->paid_for = HasBit(v->vehicle_flags, 2);
2041 } 2041 }
2042 CLRBIT(v->vehicle_flags, 2); 2042 CLRBIT(v->vehicle_flags, 2);
2043 v->cargo.InvalidateCache(); 2043 v->cargo.InvalidateCache();
2044 } 2044 }
2045 } 2045 }