fork download
  1. #include <iostream>
  2.  
  3. class uint32 {
  4. private:
  5. int _value;
  6. public:
  7. uint32(int i): _value(i) {}
  8.  
  9. friend const uint32 operator < (const uint32& left, const int& right) {
  10. return right > static_cast<const int>(left);
  11. }
  12.  
  13. friend const uint32 operator > (const uint32& left, const int& right) {
  14. return right < static_cast<const int>(left);
  15. }
  16.  
  17. friend const bool operator || (const uint32& left, const uint32& right) {
  18. return static_cast<const bool>(left) && static_cast<const bool>(right);
  19. }
  20.  
  21. friend const uint32& operator++(uint32& i) {
  22. i._value++;
  23. return i;
  24. }
  25.  
  26. operator int() const {
  27. return _value;
  28. }
  29.  
  30. operator bool() const {
  31. return _value != 0;
  32. }
  33.  
  34. };
  35.  
  36. #define PERM_ENCHANTMENT_SLOT 0
  37. #define MAX_ENCHANTMENT_SLOT 15
  38. #define PRISMATIC_ENCHANTMENT_SLOT 6
  39. #define PROP_ENCHANTMENT_SLOT_0 10
  40.  
  41. bool IsBoundByEnchant() {
  42. for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) {
  43. if (enchant_slot > PRISMATIC_ENCHANTMENT_SLOT || enchant_slot < PROP_ENCHANTMENT_SLOT_0) // not holding enchantment id
  44. continue;
  45.  
  46. std::cout << "We are here! enchant_slot = " << (int)enchant_slot << std::endl;
  47.  
  48. }
  49.  
  50. return false;
  51. }
  52.  
  53. int main() {
  54. (void)IsBoundByEnchant();
  55. return 0;
  56. }
  57.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
We are here! enchant_slot = 0
We are here! enchant_slot = 1
We are here! enchant_slot = 2
We are here! enchant_slot = 3
We are here! enchant_slot = 4
We are here! enchant_slot = 5
We are here! enchant_slot = 6
We are here! enchant_slot = 10
We are here! enchant_slot = 11
We are here! enchant_slot = 12
We are here! enchant_slot = 13
We are here! enchant_slot = 14