fix vehicle copy on GetAllCars, TSetOfVehicleData is now vector<>

This commit is contained in:
Lion Kortlepel
2021-03-31 12:12:01 +02:00
parent 7231c69e10
commit 56a02f0215
5 changed files with 50 additions and 26 deletions

View File

@@ -6,20 +6,25 @@ class TVehicleData final {
public:
TVehicleData(int ID, std::string Data);
~TVehicleData();
// We cannot delete this, since vector needs to be able to copy when it resizes.
// Deleting this causes some wacky template errors which are hard to decipher,
// and end up making no sense, so let's just leave the copy ctor.
// TVehicleData(const TVehicleData&) = delete;
[[nodiscard]] bool IsInvalid() const { return mID == -1; }
[[nodiscard]] int ID() const { return mID; }
[[nodiscard]] std::string Data() const { return mData; }
void SetData(const std::string& Data) const { mData = Data; }
void SetData(const std::string& Data) { mData = Data; }
bool operator==(const TVehicleData& v) const { return mID == v.mID; }
private:
int mID { -1 };
mutable std::string mData;
std::string mData;
};
// TODO: unused now, remove?
namespace std {
template <>
struct hash<TVehicleData> {