Skip to content

Commit

Permalink
chore: add some operators
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Jan 11, 2025
1 parent 95a1951 commit c58acff
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
15 changes: 11 additions & 4 deletions src/mc/common/ActorRuntimeID.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@

class ActorRuntimeID {
public:
// member variables
// NOLINTBEGIN
uint64 rawID;
// NOLINTEND
[[nodiscard]] constexpr bool operator==(ActorRuntimeID const& other) const noexcept { return rawID == other.rawID; }

[[nodiscard]] constexpr std::strong_ordering operator<=>(ActorRuntimeID const& other) const noexcept {
return rawID <=> other.rawID;
}

[[nodiscard]] constexpr ActorRuntimeID() : rawID(0) {}
[[nodiscard]] constexpr ActorRuntimeID(uint64 x) : rawID(x) {}

[[nodiscard]] constexpr operator uint64() const { return rawID; }

public:
// member variables
// NOLINTBEGIN
uint64 rawID;
// NOLINTEND
};

namespace std {
Expand Down
7 changes: 7 additions & 0 deletions src/mc/common/ActorUniqueID.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ namespace mce { class UUID; }
// clang-format on

struct ActorUniqueID {
public:
[[nodiscard]] constexpr bool operator==(ActorUniqueID const& other) const noexcept { return rawID == other.rawID; }

[[nodiscard]] constexpr std::strong_ordering operator<=>(ActorUniqueID const& other) const noexcept {
return rawID <=> other.rawID;
}

public:
// member variables
// NOLINTBEGIN
Expand Down
8 changes: 6 additions & 2 deletions src/mc/world/level/BlockTickingQueue.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "mc/_HeaderOutputPredefine.h"
#include "mc/world/level/TickNextTickData.h"

// auto generated inclusion list
#include "mc/deps/core/container/MovePriorityQueue.h"
Expand Down Expand Up @@ -33,11 +34,14 @@ class BlockTickingQueue {

// BlockTickingQueue inner types define
class BlockTick {
public:
[[nodiscard]] bool operator>(BlockTick const& other) const { return mData > other.mData; }

public:
// member variables
// NOLINTBEGIN
::ll::TypedStorage<1, 1, bool> mIsRemoved;
::ll::TypedStorage<8, 40, ::TickNextTickData> mData;
bool mIsRemoved;
::TickNextTickData mData;
// NOLINTEND
};

Expand Down
7 changes: 7 additions & 0 deletions src/mc/world/level/Tick.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
#include "mc/_HeaderOutputPredefine.h"

struct Tick {
public:
[[nodiscard]] constexpr bool operator==(Tick const& other) const noexcept { return tickID == other.tickID; }

[[nodiscard]] constexpr std::strong_ordering operator<=>(Tick const& other) const noexcept {
return tickID <=> other.tickID;
}

public:
// member variables
// NOLINTBEGIN
Expand Down

0 comments on commit c58acff

Please sign in to comment.