CompoundMapObjectID.h 874 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * CompoundMapObjectID.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../constants/EntityIdentifiers.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. struct DLL_LINKAGE CompoundMapObjectID
  14. {
  15. si32 primaryID;
  16. si32 secondaryID;
  17. CompoundMapObjectID(si32 primID, si32 secID) : primaryID(primID), secondaryID(secID) {};
  18. bool operator<(const CompoundMapObjectID& other) const
  19. {
  20. if(this->primaryID != other.primaryID)
  21. return this->primaryID < other.primaryID;
  22. else
  23. return this->secondaryID < other.secondaryID;
  24. }
  25. bool operator==(const CompoundMapObjectID& other) const
  26. {
  27. return (this->primaryID == other.primaryID) && (this->secondaryID == other.secondaryID);
  28. }
  29. };
  30. VCMI_LIB_NAMESPACE_END