You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are currently a few special cases in StructureCatalogue::get that can probably be removed:
There is some inconsistency with setting the lander tile for the SeedLander:
case StructureID::SID_CARGO_LANDER: // only here for loading games
structure = new CargoLander(tile);
// ...case StructureID::SID_COLONIST_LANDER: // only here for loading games
structure = new ColonistLander(tile);
// ...case StructureID::SID_SEED_LANDER: // only here for loading games
structure = new SeedLander({0, 0});
The MineFacility is constructed with a nullptr for the Mine*:
case StructureID::SID_MINE_FACILITY: // only here for loading games
structure = new MineFacility(nullptr);
Potentially the tile could be used to find the Mine*, which could be set using the MineFacility constructor. It may be possible to remove the MineFacility::mine setter function. This would need some coordination with MapViewState::readStructures, which also uses the mine setter function. Though earlier there is a call to StructureCatalogue::get which could have set the Mine*:
auto& structure = *StructureCatalogue::get(structureId, &tile);
// ...if (structureId == StructureID::SID_MINE_FACILITY)
{
auto* mine = mTileMap->getTile({mapCoordinate.xy, 0}).mine();
if (mine == nullptr)
{
throwstd::runtime_error("Mine Facility is located on a Tile with no Mine.");
}
auto& mineFacility = *static_cast<MineFacility*>(&structure);
mineFacility.mine(mine);
// ...
There is a comment on MineShaft that indicates a special case:
case StructureID::SID_MINE_SHAFT: // only here for loading games
structure = new MineShaft();
Looking into this, it seems that structure is specially created with direct uses of new in Robominer::buildMine and MapViewState::onMineFacilityExtend. Perhaps these methods should be updated to use StructureCatalogue::get for consistency.
The text was updated successfully, but these errors were encountered:
There are currently a few special cases in
StructureCatalogue::get
that can probably be removed:There is some inconsistency with setting the lander
tile
for theSeedLander
:The
MineFacility
is constructed with anullptr
for theMine*
:Potentially the
tile
could be used to find theMine*
, which could be set using theMineFacility
constructor. It may be possible to remove theMineFacility::mine
setter function. This would need some coordination withMapViewState::readStructures
, which also uses themine
setter function. Though earlier there is a call toStructureCatalogue::get
which could have set theMine*
:There is a comment on
MineShaft
that indicates a special case:Looking into this, it seems that structure is specially created with direct uses of
new
inRobominer::buildMine
andMapViewState::onMineFacilityExtend
. Perhaps these methods should be updated to useStructureCatalogue::get
for consistency.The text was updated successfully, but these errors were encountered: