mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r15643) -Fix [FS#2711]: be more strict with zeroing unused map array bits
This commit is contained in:
parent
7c8474da13
commit
e124aa8fd6
@ -173,6 +173,7 @@ static inline void MakeBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, D
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = 1 << 7 | tt << 2 | d;
|
||||
SB(_m[t].m6, 2, 4, bridgetype);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,8 +238,9 @@ static inline void MakeClear(TileIndex t, ClearGround g, uint density)
|
||||
_m[t].m2 = 0;
|
||||
_m[t].m3 = 0;
|
||||
_m[t].m4 = 0 << 5 | 0 << 2;
|
||||
SetClearGroundDensity(t, g, density);
|
||||
SB(_m[t].m6, 2, 4, 0); // Clear the rest of m6, bits 2 to 5
|
||||
SetClearGroundDensity(t, g, density); // Sets m5
|
||||
SB(_m[t].m6, 2, 4, 0); // Other bits are "tropic zone" and "bridge above"
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -257,6 +258,8 @@ static inline void MakeField(TileIndex t, uint field_type, IndustryID industry)
|
||||
_m[t].m3 = field_type;
|
||||
_m[t].m4 = 0 << 5 | 0 << 2;
|
||||
SetClearGroundDensity(t, CLEAR_FIELDS, 3);
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
#endif /* CLEAR_MAP_H */
|
||||
|
@ -165,25 +165,6 @@ static inline bool IsIndustryTileOnWater(TileIndex t)
|
||||
return (GetWaterClass(t) != WATER_CLASS_INVALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the given tile an industry tile
|
||||
* @param t the tile to make an industry tile
|
||||
* @param index the industry this tile belongs to
|
||||
* @param gfx the graphics to use for the tile
|
||||
* @param random the random value
|
||||
*/
|
||||
static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random, WaterClass wc)
|
||||
{
|
||||
SetTileType(t, MP_INDUSTRY);
|
||||
_m[t].m1 = 0;
|
||||
_m[t].m2 = index;
|
||||
_m[t].m3 = 0;
|
||||
_m[t].m4 = 0;
|
||||
SetIndustryGfx(t, gfx);
|
||||
_me[t].m7 = random;
|
||||
SetWaterClass(t, wc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this indutry tile's construction counter value
|
||||
* @param tile the tile to query
|
||||
@ -321,4 +302,24 @@ static inline void SetIndustryTriggers(TileIndex tile, byte triggers)
|
||||
SB(_m[tile].m6, 3, 3, triggers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the given tile an industry tile
|
||||
* @param t the tile to make an industry tile
|
||||
* @param index the industry this tile belongs to
|
||||
* @param gfx the graphics to use for the tile
|
||||
* @param random the random value
|
||||
*/
|
||||
static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random, WaterClass wc)
|
||||
{
|
||||
SetTileType(t, MP_INDUSTRY);
|
||||
_m[t].m1 = 0;
|
||||
_m[t].m2 = index;
|
||||
_m[t].m3 = 0;
|
||||
_m[t].m4 = 0;
|
||||
SetIndustryGfx(t, gfx); // m5, part of m6
|
||||
SetIndustryTriggers(t, 0); // rest of m6
|
||||
SetIndustryRandomBits(t, random); // m7
|
||||
SetWaterClass(t, wc);
|
||||
}
|
||||
|
||||
#endif /* INDUSTRY_MAP_H */
|
||||
|
@ -607,6 +607,8 @@ static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r)
|
||||
_m[t].m3 = r;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = RAIL_TILE_NORMAL << 6 | b;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -618,6 +620,8 @@ static inline void MakeRailDepot(TileIndex t, Owner o, DiagDirection d, RailType
|
||||
_m[t].m3 = r;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = RAIL_TILE_DEPOT << 6 | d;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -629,6 +633,8 @@ static inline void MakeRailWaypoint(TileIndex t, Owner o, Axis a, RailType r, ui
|
||||
_m[t].m3 = r;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = RAIL_TILE_WAYPOINT << 6 | a;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
#endif /* RAIL_MAP_H */
|
||||
|
@ -390,7 +390,6 @@ static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, Tow
|
||||
_m[t].m3 = (HasBit(rot, ROADTYPE_TRAM) ? bits : 0);
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = (HasBit(rot, ROADTYPE_ROAD) ? bits : 0) | ROAD_TILE_NORMAL << 6;
|
||||
SetRoadOwner(t, ROADTYPE_TRAM, tram);
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = rot << 6;
|
||||
SetRoadOwner(t, ROADTYPE_TRAM, tram);
|
||||
|
@ -314,7 +314,9 @@ static inline void MakeStation(TileIndex t, Owner o, StationID sid, StationType
|
||||
_m[t].m3 = 0;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = section;
|
||||
SB(_m[t].m6, 2, 1, 0);
|
||||
SB(_m[t].m6, 3, 3, st);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
static inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
|
||||
|
@ -274,6 +274,8 @@ static inline void MakeTree(TileIndex t, TreeType type, uint count, uint growth,
|
||||
_m[t].m3 = type;
|
||||
_m[t].m4 = 0 << 5 | 0 << 2;
|
||||
_m[t].m5 = count << 6 | growth;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
#endif /* TREE_MAP_H */
|
||||
|
@ -53,6 +53,8 @@ static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d, RoadTyp
|
||||
_m[t].m3 = 0;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = TRANSPORT_ROAD << 2 | d;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
SetRoadOwner(t, ROADTYPE_ROAD, o);
|
||||
if (o != OWNER_TOWN) SetRoadOwner(t, ROADTYPE_TRAM, o);
|
||||
SetRoadTypes(t, r);
|
||||
@ -73,6 +75,8 @@ static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailTyp
|
||||
_m[t].m3 = r;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = TRANSPORT_RAIL << 2 | d;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
#endif /* TUNNEL_MAP_H */
|
||||
|
@ -192,6 +192,8 @@ static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o)
|
||||
_m[t].m3 = 0;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = u;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -146,6 +146,8 @@ static inline void MakeWater(TileIndex t)
|
||||
_m[t].m3 = WATER_CLASS_SEA;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = 0;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
static inline void MakeShore(TileIndex t)
|
||||
@ -156,6 +158,8 @@ static inline void MakeShore(TileIndex t)
|
||||
_m[t].m3 = 0;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = 1;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
static inline void MakeRiver(TileIndex t, uint8 random_bits)
|
||||
@ -166,6 +170,8 @@ static inline void MakeRiver(TileIndex t, uint8 random_bits)
|
||||
_m[t].m3 = WATER_CLASS_RIVER;
|
||||
_m[t].m4 = random_bits;
|
||||
_m[t].m5 = 0;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
static inline void MakeCanal(TileIndex t, Owner o, uint8 random_bits)
|
||||
@ -177,6 +183,8 @@ static inline void MakeCanal(TileIndex t, Owner o, uint8 random_bits)
|
||||
_m[t].m3 = WATER_CLASS_CANAL;
|
||||
_m[t].m4 = random_bits;
|
||||
_m[t].m5 = 0;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
static inline void MakeShipDepot(TileIndex t, Owner o, DepotPart base, Axis a, WaterClass original_water_class)
|
||||
@ -187,6 +195,8 @@ static inline void MakeShipDepot(TileIndex t, Owner o, DepotPart base, Axis a, W
|
||||
_m[t].m3 = original_water_class;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = base + a * 2;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
static inline void MakeLockTile(TileIndex t, Owner o, byte section, WaterClass original_water_class)
|
||||
@ -197,6 +207,8 @@ static inline void MakeLockTile(TileIndex t, Owner o, byte section, WaterClass o
|
||||
_m[t].m3 = original_water_class;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = section;
|
||||
SB(_m[t].m6, 2, 4, 0);
|
||||
_me[t].m7 = 0;
|
||||
}
|
||||
|
||||
static inline void MakeLock(TileIndex t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper)
|
||||
|
Loading…
Reference in New Issue
Block a user