Fix: NewGRF house class mappings were not reset between games. (#11279)
(cherry picked from commit 6643c010bd
)
This commit is contained in:

committed by
Jonathan G Rennison

parent
1637f6f6b0
commit
89b84222d3
@@ -29,7 +29,7 @@
|
||||
#include "table/strings.h"
|
||||
|
||||
static BuildingCounts<uint32> _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);
|
||||
|
||||
@@ -105,6 +105,11 @@ uint32 FakeHouseResolverObject::GetDebugID() const
|
||||
return HouseSpec::Get(this->house_scope.house_id)->grf_prop.local_id;
|
||||
}
|
||||
|
||||
void ResetHouseClassIDs()
|
||||
{
|
||||
_class_mapping = {};
|
||||
}
|
||||
|
||||
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid)
|
||||
{
|
||||
/* Start from 1 because 0 means that no class has been assigned. */
|
||||
|
@@ -134,6 +134,7 @@ struct HouseClassMapping {
|
||||
uint8 class_id; ///< The class id within the grf file
|
||||
};
|
||||
|
||||
void ResetHouseClassIDs();
|
||||
HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid);
|
||||
|
||||
void InitializeBuildingCounts();
|
||||
|
@@ -4452,6 +4452,8 @@ HouseSpec _house_specs[NUM_HOUSES];
|
||||
|
||||
void ResetHouses()
|
||||
{
|
||||
ResetHouseClassIDs();
|
||||
|
||||
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{});
|
||||
|
||||
|
Reference in New Issue
Block a user