mirror of https://github.com/OpenTTD/OpenTTD.git
Change: Increase house type limit to 4096.
This moves HouseType from m4+m3[6] to m8.
This commit is contained in:
parent
e21c12afeb
commit
c641fd022c
|
@ -721,10 +721,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<li>m3 bit 6 : bit 8 of house type (m4), allowing 512 different types.</li>
|
<li>m3 bits 6..5 : free</li>
|
||||||
<li>m3 bit 5 : free</li>
|
|
||||||
<li>m3 bits 4..0 : triggers activated <a href="#newhouses">(newhouses)</a></li>
|
<li>m3 bits 4..0 : triggers activated <a href="#newhouses">(newhouses)</a></li>
|
||||||
<li>m4 : <a href="landscape_externals.html">town building type</a> (with m3[6] bit)</li>
|
<li>m4 : free</li>
|
||||||
<li>m5 : see m3 bit 7</li>
|
<li>m5 : see m3 bit 7</li>
|
||||||
<li>m6 :
|
<li>m6 :
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -759,10 +758,12 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li>m8 bits 15..12 : free</li>
|
||||||
|
<li>m8 bits 11..0 : <a href="landscape_externals.html">town building type</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<small><a name="newhouses"></a>Newhouses is the name englobing a newGRF feature developed by TTDPatch devs (mainly Csaboka).<br>
|
<small><a name="newhouses"></a>Newhouses is the name englobing a newGRF feature developed by TTDPatch devs (mainly Csaboka).<br>
|
||||||
It allows the replacement of the properties as well as the graphics of houses in the game.<br>
|
It allows the replacement of the properties as well as the graphics of houses in the game.<br>
|
||||||
To distinguish between the standard behaviour and the newGRF one, HouseID (m4 + m3[6]) is tested for anything above 110.<br>
|
To distinguish between the standard behaviour and the newGRF one, HouseID is tested for anything above 110.<br>
|
||||||
110 is the count of standard houses. So above 110 means there is a new definition of at least one house</small>
|
110 is the count of standard houses. So above 110 means there is a new definition of at least one house</small>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -156,17 +156,17 @@ the array so you can quickly see what is used and what is not.
|
||||||
<td class="caption">finished house</td>
|
<td class="caption">finished house</td>
|
||||||
<td class="bits" rowspan=2><span class="used" title="House random bits">XXXX XXXX</span></td>
|
<td class="bits" rowspan=2><span class="used" title="House random bits">XXXX XXXX</span></td>
|
||||||
<td class="bits" rowspan=2><span class="pool" title="Town index on pool">XXXX XXXX XXXX XXXX</span></td>
|
<td class="bits" rowspan=2><span class="pool" title="Town index on pool">XXXX XXXX XXXX XXXX</span></td>
|
||||||
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">1</span> <span class="used" title="House type (m4 + m3[6])">X</span><span class="free">O</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">XXX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">1</span><span class="free">OO</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">X XX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
||||||
<td class="bits" rowspan=2><span class="used" title="House type (m4 + m3[6])">XXXX XXXX</span></td>
|
<td class="bits" rowspan=2><span class="free">OOOO OOOO</span></td>
|
||||||
<td class="bits"><span class="used" title="Age in years, clamped at 255">XXXX XXXX</span></td>
|
<td class="bits"><span class="used" title="Age in years, clamped at 255">XXXX XXXX</span></td>
|
||||||
<td class="bits" rowspan=2><span class="abuse" title="Newhouses activated: periodic processing time remaining; if not, lift position for houses 04 and 05">XXXX XX</span><span class="free">OO</span></td>
|
<td class="bits" rowspan=2><span class="abuse" title="Newhouses activated: periodic processing time remaining; if not, lift position for houses 04 and 05">XXXX XX</span><span class="free">OO</span></td>
|
||||||
<td class="bits" rowspan=2><span class="abuse" title="If newhouses active, m7 is the current animation frame">XXXX</span> <span class="abuse" title="If newhouses active, m7 is the current animantion frame; if not, lift behaviour for houses 04 and 05">XXXX</span></td>
|
<td class="bits" rowspan=2><span class="abuse" title="If newhouses active, m7 is the current animation frame">XXXX</span> <span class="abuse" title="If newhouses active, m7 is the current animantion frame; if not, lift behaviour for houses 04 and 05">XXXX</span></td>
|
||||||
<td class="bits" rowspan=2><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
<td class="bits" rowspan=2><span class="free">OOOO</span> <span class="used" title="House type">XXXX XXXX XXXX</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="caption">house under construction</td>
|
<td class="caption">house under construction</td>
|
||||||
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">O</span> <span class="used" title="House type (m4 + m3[6])">X</span><span class="free">O</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">XXX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
<td class="bits"><span class="used" title="House is complete/in construction (see m5)">O</span><span class="used" title="House type (m4 + m3[6])">X</span><span class="free">O</span><span class="usable" title="Activated triggers (bits 2..4 don't have a meaning)">X XX</span><span class="used" title="Activated triggers (bits 2..4 don't have a meaning)">XX</span></td>
|
||||||
<td class="bits"><span class="free">OOO</span><span class="used" title="Construction stage">XX</span> <span class="used" title="Construction counter">XXX</span></td>
|
<td class="bits"><span class="free">OOO</span><span class="used" title="Construction stage">X X</span><span class="used" title="Construction counter">XXX</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>4</td>
|
<td>4</td>
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
*/
|
*/
|
||||||
static const uint8_t TOWN_HOUSE_COMPLETED = 3;
|
static const uint8_t TOWN_HOUSE_COMPLETED = 3;
|
||||||
|
|
||||||
static const HouseID NUM_HOUSES_PER_GRF = 255; ///< Number of supported houses per NewGRF; limited to 255 to allow extending Action3 with an extended byte later on.
|
|
||||||
|
|
||||||
static const uint HOUSE_NO_CLASS = 0;
|
static const uint HOUSE_NO_CLASS = 0;
|
||||||
static const HouseID NEW_HOUSE_OFFSET = 110; ///< Offset for new houses.
|
static const HouseID NEW_HOUSE_OFFSET = 110; ///< Offset for new houses.
|
||||||
static const HouseID NUM_HOUSES = 512; ///< Total number of houses.
|
static const HouseID NUM_HOUSES = 4096; ///< Total number of houses.
|
||||||
static const HouseID INVALID_HOUSE_ID = 0xFFFF;
|
static const HouseID INVALID_HOUSE_ID = 0xFFFF;
|
||||||
|
|
||||||
|
static const HouseID NUM_HOUSES_PER_GRF = NUM_HOUSES; ///< Number of supported houses per NewGRF.
|
||||||
|
|
||||||
static const uint HOUSE_NUM_ACCEPTS = 16; ///< Max number of cargoes accepted by a tile
|
static const uint HOUSE_NUM_ACCEPTS = 16; ///< Max number of cargoes accepted by a tile
|
||||||
|
|
||||||
enum BuildingFlags {
|
enum BuildingFlags {
|
||||||
|
|
|
@ -457,7 +457,7 @@ static uint32_t GetDistanceFromNearbyHouse(uint8_t parameter, TileIndex tile, Ho
|
||||||
local_houseid = nearby_house_id;
|
local_houseid = nearby_house_id;
|
||||||
} else {
|
} else {
|
||||||
local_houseid = (hs->grf_prop.grffile == this->ro.grffile ? 1 : 2) << 8;
|
local_houseid = (hs->grf_prop.grffile == this->ro.grffile ? 1 : 2) << 8;
|
||||||
local_houseid |= hs->grf_prop.local_id;
|
local_houseid |= ClampTo<uint8_t>(hs->grf_prop.local_id);
|
||||||
}
|
}
|
||||||
return houseclass << 16 | local_houseid;
|
return houseclass << 16 | local_houseid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1523,6 +1523,17 @@ bool AfterLoadGame()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsSavegameVersionBefore(SLV_INCREASE_HOUSE_LIMIT)) {
|
||||||
|
for (auto t : Map::Iterate()) {
|
||||||
|
if (IsTileType(t, MP_HOUSE)) {
|
||||||
|
/* House type is moved from m4 + m3[6] to m8. */
|
||||||
|
SetHouseType(t, t.m4() | (GB(t.m3(), 6, 1) << 8));
|
||||||
|
t.m4() = 0;
|
||||||
|
ClrBit(t.m3(), 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Check and update house and town values */
|
/* Check and update house and town values */
|
||||||
UpdateHousesAndTowns();
|
UpdateHousesAndTowns();
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,8 @@ enum SaveLoadVersion : uint16_t {
|
||||||
SLV_SCRIPT_RANDOMIZER, ///< 333 PR#12063 v14.0-RC1 Save script randomizers.
|
SLV_SCRIPT_RANDOMIZER, ///< 333 PR#12063 v14.0-RC1 Save script randomizers.
|
||||||
SLV_VEHICLE_ECONOMY_AGE, ///< 334 PR#12141 v14.0 Add vehicle age in economy year, for profit stats minimum age
|
SLV_VEHICLE_ECONOMY_AGE, ///< 334 PR#12141 v14.0 Add vehicle age in economy year, for profit stats minimum age
|
||||||
|
|
||||||
|
SLV_INCREASE_HOUSE_LIMIT, ///< 335 PR#12288 Increase house limit to 4096.
|
||||||
|
|
||||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ inline void SetTownIndex(Tile t, TownID index)
|
||||||
inline HouseID GetCleanHouseType(Tile t)
|
inline HouseID GetCleanHouseType(Tile t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert(IsTileType(t, MP_HOUSE));
|
||||||
return t.m4() | (GB(t.m3(), 6, 1) << 8);
|
return GB(t.m8(), 0, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,8 +71,7 @@ inline HouseID GetHouseType(Tile t)
|
||||||
inline void SetHouseType(Tile t, HouseID house_id)
|
inline void SetHouseType(Tile t, HouseID house_id)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert(IsTileType(t, MP_HOUSE));
|
||||||
t.m4() = GB(house_id, 0, 8);
|
SB(t.m8(), 0, 12, house_id);
|
||||||
SB(t.m3(), 6, 1, GB(house_id, 8, 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue