CompoundMapObjectID.h 931 B

1234567891011121314151617181920212223242526272829303132333435363738
  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() : primaryID(0), secondaryID(0) {}
  18. CompoundMapObjectID(si32 primID, si32 secID) : primaryID(primID), secondaryID(secID) {};
  19. bool operator<(const CompoundMapObjectID& other) const
  20. {
  21. if(this->primaryID != other.primaryID)
  22. return this->primaryID < other.primaryID;
  23. else
  24. return this->secondaryID < other.secondaryID;
  25. }
  26. bool operator==(const CompoundMapObjectID& other) const
  27. {
  28. return (this->primaryID == other.primaryID) && (this->secondaryID == other.secondaryID);
  29. }
  30. };
  31. VCMI_LIB_NAMESPACE_END