Codechange: Use iteration when dealing with all HouseSpecs.

This commit is contained in:
Peter Nelson
2024-03-12 17:28:45 +00:00
committed by Michael Lutz
parent 3e83dcedfd
commit e16b982b6a
4 changed files with 43 additions and 42 deletions

View File

@@ -52,6 +52,15 @@ std::vector<HouseSpec> &HouseSpec::Specs()
return _house_specs;
}
/**
* Gets the index of this spec.
* @return The index.
*/
HouseID HouseSpec::Index() const
{
return static_cast<HouseID>(this - _house_specs.data());
}
/**
* Get the spec for a house ID.
* @param house_id The ID of the house.