Skip to content

Commit

Permalink
refactor: move BaseGameVersion and SemVersion classes into their own …
Browse files Browse the repository at this point in the history
…separate files
  • Loading branch information
wu-vincent committed Sep 13, 2024
1 parent b497b19 commit 32b1de9
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 19 deletions.
24 changes: 24 additions & 0 deletions include/bedrock/common/resources/base_game_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) 2024, The Endstone Project. (https://endstone.dev) All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include "bedrock/core/semver/sem_version.h"

class BaseGameVersion {
public:
private:
SemVersion sem_version_;
bool never_compatible_;
};
23 changes: 23 additions & 0 deletions include/bedrock/common/shared_constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2024, The Endstone Project. (https://endstone.dev) All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include <string>

#include "bedrock/bedrock.h"

namespace Common {
ENDSTONE_HOOK std::string getGameVersionString();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@

#include <string>

#include "bedrock/bedrock.h"

namespace Common {
ENDSTONE_HOOK std::string getGameVersionString();
}

class SemVersion {
public:
private:
Expand All @@ -33,11 +27,4 @@ class SemVersion {
std::string full_version_string_;
bool valid_version_;
bool any_version_;
};

class BaseGameVersion {
public:
private:
SemVersion sem_version_;
bool never_compatible_;
};
};
2 changes: 1 addition & 1 deletion include/bedrock/world/item/crafting/recipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#pragma once

#include "bedrock/common/game_version.h"
#include "bedrock/common/resources/base_game_version.h"
#include "bedrock/core/utility/uuid.h"
#include "bedrock/world/inventory/network/item_stack_net_id_variant.h"
#include "bedrock/world/item/crafting/recipe_ingredient.h"
Expand Down
2 changes: 1 addition & 1 deletion include/bedrock/world/item/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <string>

#include "bedrock/common/game_version.h"
#include "bedrock/common/resources/base_game_version.h"
#include "bedrock/deps/jsoncpp/value.h"
#include "bedrock/forward.h"
#include "bedrock/world/actor/actor_location.h"
Expand Down
2 changes: 1 addition & 1 deletion include/bedrock/world/level/block/block_legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <shared_mutex>

#include "bedrock/common/game_version.h"
#include "bedrock/common/resources/base_game_version.h"
#include "bedrock/core/hashed_string.h"
#include "bedrock/core/math/color.h"
#include "bedrock/core/math/int_range.h"
Expand Down
2 changes: 1 addition & 1 deletion src/endstone_core/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace fs = std::filesystem;

#include <boost/algorithm/string.hpp>

#include "bedrock/common/game_version.h"
#include "bedrock/common/shared_constants.h"
#include "bedrock/core/threading.h"
#include "bedrock/network/server_network_handler.h"
#include "bedrock/world/actor/player/player.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "bedrock/common/game_version.h"
#include "bedrock/common/shared_constants.h"

#include "endstone/detail/hook.h"

Expand Down

0 comments on commit 32b1de9

Please sign in to comment.