mirror of https://github.com/OpenTTD/OpenTTD
Fix: NewGRF house class mappings were not reset between games. (#11279)
parent
1c620b349f
commit
6643c010bd
|
@ -25,7 +25,7 @@
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
static BuildingCounts<uint32_t> _building_counts;
|
static BuildingCounts<uint32_t> _building_counts;
|
||||||
static HouseClassMapping _class_mapping[HOUSE_CLASS_MAX];
|
static std::array<HouseClassMapping, HOUSE_CLASS_MAX> _class_mapping;
|
||||||
|
|
||||||
HouseOverrideManager _house_mngr(NEW_HOUSE_OFFSET, NUM_HOUSES, INVALID_HOUSE_ID);
|
HouseOverrideManager _house_mngr(NEW_HOUSE_OFFSET, NUM_HOUSES, INVALID_HOUSE_ID);
|
||||||
|
|
||||||
|
@ -72,6 +72,11 @@ uint32_t HouseResolverObject::GetDebugID() const
|
||||||
return HouseSpec::Get(this->house_scope.house_id)->grf_prop.local_id;
|
return HouseSpec::Get(this->house_scope.house_id)->grf_prop.local_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResetHouseClassIDs()
|
||||||
|
{
|
||||||
|
_class_mapping = {};
|
||||||
|
}
|
||||||
|
|
||||||
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32_t grfid)
|
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32_t grfid)
|
||||||
{
|
{
|
||||||
/* Start from 1 because 0 means that no class has been assigned. */
|
/* Start from 1 because 0 means that no class has been assigned. */
|
||||||
|
|
|
@ -87,6 +87,7 @@ struct HouseClassMapping {
|
||||||
uint8_t class_id; ///< The class id within the grf file
|
uint8_t class_id; ///< The class id within the grf file
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ResetHouseClassIDs();
|
||||||
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32_t grfid);
|
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32_t grfid);
|
||||||
|
|
||||||
void InitializeBuildingCounts();
|
void InitializeBuildingCounts();
|
||||||
|
|
|
@ -3842,6 +3842,8 @@ HouseSpec _house_specs[NUM_HOUSES];
|
||||||
|
|
||||||
void ResetHouses()
|
void ResetHouses()
|
||||||
{
|
{
|
||||||
|
ResetHouseClassIDs();
|
||||||
|
|
||||||
auto insert = std::copy(std::begin(_original_house_specs), std::end(_original_house_specs), std::begin(_house_specs));
|
auto insert = std::copy(std::begin(_original_house_specs), std::end(_original_house_specs), std::begin(_house_specs));
|
||||||
std::fill(insert, std::end(_house_specs), HouseSpec{});
|
std::fill(insert, std::end(_house_specs), HouseSpec{});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue